aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-08-27 06:06:30 +0200
committerJoakim Verona2013-08-27 06:06:30 +0200
commit9d1c69140689c3efe53e50b01fe5d7f1d020277e (patch)
tree5868aa61079828f04e103c0c65c30fdf84ce8ac1
parent5a3ec8917482d3187ab187bf0b5dc15f0fc1bb63 (diff)
parent9fed97293c8bc78eef679db1ae3cab468ecc473e (diff)
downloademacs-9d1c69140689c3efe53e50b01fe5d7f1d020277e.tar.gz
emacs-9d1c69140689c3efe53e50b01fe5d7f1d020277e.zip
merge from trunk
-rw-r--r--src/ChangeLog18
-rw-r--r--src/dispextern.h51
-rw-r--r--src/lisp.h30
-rw-r--r--src/msdos.c30
-rw-r--r--src/nsterm.m30
-rw-r--r--src/termchar.h2
-rw-r--r--src/w32console.c8
-rw-r--r--src/w32term.c28
-rw-r--r--src/window.c8
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xterm.c28
-rw-r--r--src/xterm.h2
12 files changed, 94 insertions, 152 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 01f3093b6dd..5633d95cbf2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12013-08-27 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * lisp.h (Mouse_HLInfo): Move from here...
4 * dispextern.h (Mouse_HLInfo): ...to here and offload lisp.h.
5 (reset_mouse_highlight): New function.
6 * msdos.c (dos_set_window_size, IT_update_begin)
7 (internal_terminal_init):
8 * nsterm.m (ns_update_window_end, x_free_frame_resources)
9 (ns_initialize_display_info):
10 * w32console.c (initialize_w32_display):
11 * w32term.c (x_update_window_end, x_free_frame_resources)
12 (w32_initialize_display_info):
13 * xterm.c (x_update_window_end, x_free_frame_resources, x_term_init):
14 * window.c (Fdelete_other_windows_internal):
15 * xdisp.c (clear_mouse_face, cancel_mouse_face): Use it.
16 * termchar.h (toplevel):
17 * xterm.h (toplevel): Include dispextern.h.
18
12013-08-26 Paul Eggert <eggert@cs.ucla.edu> 192013-08-26 Paul Eggert <eggert@cs.ucla.edu>
2 20
3 Fix minor problems found by static checking. 21 Fix minor problems found by static checking.
diff --git a/src/dispextern.h b/src/dispextern.h
index 42b1c01d34e..cdfe4088aa5 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2695,8 +2695,57 @@ enum move_operation_enum
2695 MOVE_TO_POS = 0x08 2695 MOVE_TO_POS = 0x08
2696}; 2696};
2697 2697
2698/***********************************************************************
2699 Mouse Highlight
2700 ***********************************************************************/
2701
2702/* Structure to hold mouse highlight data. */
2703
2704typedef struct {
2705 /* These variables describe the range of text currently shown in its
2706 mouse-face, together with the window they apply to. As long as
2707 the mouse stays within this range, we need not redraw anything on
2708 its account. Rows and columns are glyph matrix positions in
2709 MOUSE_FACE_WINDOW. */
2710 int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
2711 int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
2712 Lisp_Object mouse_face_window;
2713 int mouse_face_face_id;
2714 Lisp_Object mouse_face_overlay;
2715
2716 /* FRAME and X, Y position of mouse when last checked for
2717 highlighting. X and Y can be negative or out of range for the frame. */
2718 struct frame *mouse_face_mouse_frame;
2719 int mouse_face_mouse_x, mouse_face_mouse_y;
2720
2721 /* Nonzero if part of the text currently shown in
2722 its mouse-face is beyond the window end. */
2723 unsigned mouse_face_past_end : 1;
2724
2725 /* Nonzero means defer mouse-motion highlighting. */
2726 unsigned mouse_face_defer : 1;
2727
2728 /* Nonzero means that the mouse highlight should not be shown. */
2729 unsigned mouse_face_hidden : 1;
2730} Mouse_HLInfo;
2731
2732DISPEXTERN_INLINE void
2733reset_mouse_highlight (Mouse_HLInfo *hlinfo)
2734{
2735
2736 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
2737 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
2738 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
2739 hlinfo->mouse_face_beg_x = hlinfo->mouse_face_end_x = 0;
2740 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
2741 hlinfo->mouse_face_mouse_frame = NULL;
2742 hlinfo->mouse_face_window = Qnil;
2743 hlinfo->mouse_face_overlay = Qnil;
2744 hlinfo->mouse_face_past_end = 0;
2745 hlinfo->mouse_face_hidden = 0;
2746 hlinfo->mouse_face_defer = 0;
2747}
2698 2748
2699
2700/*********************************************************************** 2749/***********************************************************************
2701 Window-based redisplay interface 2750 Window-based redisplay interface
2702 ***********************************************************************/ 2751 ***********************************************************************/
diff --git a/src/lisp.h b/src/lisp.h
index 6513e807223..ef5e54d8cb6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2169,36 +2169,6 @@ enum char_bits
2169 CHARACTERBITS = 22 2169 CHARACTERBITS = 22
2170 }; 2170 };
2171 2171
2172/* Structure to hold mouse highlight data. This is here because other
2173 header files need it for defining struct x_output etc. */
2174typedef struct {
2175 /* These variables describe the range of text currently shown in its
2176 mouse-face, together with the window they apply to. As long as
2177 the mouse stays within this range, we need not redraw anything on
2178 its account. Rows and columns are glyph matrix positions in
2179 MOUSE_FACE_WINDOW. */
2180 int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
2181 int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
2182 Lisp_Object mouse_face_window;
2183 int mouse_face_face_id;
2184 Lisp_Object mouse_face_overlay;
2185
2186 /* FRAME and X, Y position of mouse when last checked for
2187 highlighting. X and Y can be negative or out of range for the frame. */
2188 struct frame *mouse_face_mouse_frame;
2189 int mouse_face_mouse_x, mouse_face_mouse_y;
2190
2191 /* Nonzero if part of the text currently shown in
2192 its mouse-face is beyond the window end. */
2193 unsigned mouse_face_past_end : 1;
2194
2195 /* Nonzero means defer mouse-motion highlighting. */
2196 unsigned mouse_face_defer : 1;
2197
2198 /* Nonzero means that the mouse highlight should not be shown. */
2199 unsigned mouse_face_hidden : 1;
2200} Mouse_HLInfo;
2201
2202/* Data type checking. */ 2172/* Data type checking. */
2203 2173
2204LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x)) 2174LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x))
diff --git a/src/msdos.c b/src/msdos.c
index 88a2eb60726..6018f72bfae 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -602,11 +602,7 @@ dos_set_window_size (int *rows, int *cols)
602 Lisp_Object window = hlinfo->mouse_face_window; 602 Lisp_Object window = hlinfo->mouse_face_window;
603 603
604 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 604 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
605 { 605 reset_mouse_highlight (hlinfo);
606 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
607 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
608 hlinfo->mouse_face_window = Qnil;
609 }
610 } 606 }
611 607
612 /* Enable bright background colors. */ 608 /* Enable bright background colors. */
@@ -1276,14 +1272,9 @@ IT_update_begin (struct frame *f)
1276 } 1272 }
1277 } 1273 }
1278 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame)) 1274 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame))
1279 { 1275 /* If the frame with mouse highlight was deleted, invalidate the
1280 /* If the frame with mouse highlight was deleted, invalidate the 1276 highlight info. */
1281 highlight info. */ 1277 reset_mouse_highlight (hlinfo);
1282 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1283 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1284 hlinfo->mouse_face_window = Qnil;
1285 hlinfo->mouse_face_mouse_frame = NULL;
1286 }
1287 1278
1288 unblock_input (); 1279 unblock_input ();
1289} 1280}
@@ -1843,17 +1834,8 @@ internal_terminal_init (void)
1843 if (colors[1] >= 0 && colors[1] < 16) 1834 if (colors[1] >= 0 && colors[1] < 16)
1844 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 1835 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
1845 } 1836 }
1846 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; 1837
1847 the_only_display_info.mouse_highlight.mouse_face_beg_row = 1838 reset_mouse_highlight (&the_only_display_info.mouse_highlight);
1848 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
1849 the_only_display_info.mouse_highlight.mouse_face_end_row =
1850 the_only_display_info.mouse_highlight.mouse_face_end_col = -1;
1851 the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID;
1852 the_only_display_info.mouse_highlight.mouse_face_window = Qnil;
1853 the_only_display_info.mouse_highlight.mouse_face_mouse_x =
1854 the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0;
1855 the_only_display_info.mouse_highlight.mouse_face_defer = 0;
1856 the_only_display_info.mouse_highlight.mouse_face_hidden = 0;
1857 1839
1858 if (have_mouse) /* detected in dos_ttraw, which see */ 1840 if (have_mouse) /* detected in dos_ttraw, which see */
1859 { 1841 {
diff --git a/src/nsterm.m b/src/nsterm.m
index f7cc5933a53..f7f7b897830 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -749,8 +749,6 @@ ns_update_window_end (struct window *w, bool cursor_on_p,
749 external (RIF) call; for one window called before update_end 749 external (RIF) call; for one window called before update_end
750 -------------------------------------------------------------------------- */ 750 -------------------------------------------------------------------------- */
751{ 751{
752 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
753
754 /* note: this fn is nearly identical in all terms */ 752 /* note: this fn is nearly identical in all terms */
755 if (!w->pseudo_window_p) 753 if (!w->pseudo_window_p)
756 { 754 {
@@ -770,11 +768,7 @@ ns_update_window_end (struct window *w, bool cursor_on_p,
770 /* If a row with mouse-face was overwritten, arrange for 768 /* If a row with mouse-face was overwritten, arrange for
771 frame_up_to_date to redisplay the mouse highlight. */ 769 frame_up_to_date to redisplay the mouse highlight. */
772 if (mouse_face_overwritten_p) 770 if (mouse_face_overwritten_p)
773 { 771 reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
774 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
775 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
776 hlinfo->mouse_face_window = Qnil;
777 }
778 772
779 NSTRACE (update_window_end); 773 NSTRACE (update_window_end);
780} 774}
@@ -1183,12 +1177,7 @@ x_free_frame_resources (struct frame *f)
1183 if (f == dpyinfo->x_highlight_frame) 1177 if (f == dpyinfo->x_highlight_frame)
1184 dpyinfo->x_highlight_frame = 0; 1178 dpyinfo->x_highlight_frame = 0;
1185 if (f == hlinfo->mouse_face_mouse_frame) 1179 if (f == hlinfo->mouse_face_mouse_frame)
1186 { 1180 reset_mouse_highlight (hlinfo);
1187 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1188 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1189 hlinfo->mouse_face_window = Qnil;
1190 hlinfo->mouse_face_mouse_frame = 0;
1191 }
1192 1181
1193 if (f->output_data.ns->miniimage != nil) 1182 if (f->output_data.ns->miniimage != nil)
1194 [f->output_data.ns->miniimage release]; 1183 [f->output_data.ns->miniimage release];
@@ -3951,7 +3940,6 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3951{ 3940{
3952 NSScreen *screen = [NSScreen mainScreen]; 3941 NSScreen *screen = [NSScreen mainScreen];
3953 NSWindowDepth depth = [screen depth]; 3942 NSWindowDepth depth = [screen depth];
3954 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3955 3943
3956 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ 3944 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */
3957 dpyinfo->resy = 72.27; 3945 dpyinfo->resy = 72.27;
@@ -3964,22 +3952,12 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3964 dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); 3952 dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table);
3965 dpyinfo->color_table->colors = NULL; 3953 dpyinfo->color_table->colors = NULL;
3966 dpyinfo->root_window = 42; /* a placeholder.. */ 3954 dpyinfo->root_window = 42; /* a placeholder.. */
3967
3968 hlinfo->mouse_face_mouse_frame = NULL;
3969 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
3970 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
3971 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
3972 hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil;
3973 hlinfo->mouse_face_hidden = 0;
3974
3975 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
3976 hlinfo->mouse_face_defer = 0;
3977
3978 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; 3955 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL;
3979
3980 dpyinfo->n_fonts = 0; 3956 dpyinfo->n_fonts = 0;
3981 dpyinfo->smallest_font_height = 1; 3957 dpyinfo->smallest_font_height = 1;
3982 dpyinfo->smallest_char_width = 1; 3958 dpyinfo->smallest_char_width = 1;
3959
3960 reset_mouse_highlight (&dpyinfo->mouse_highlight);
3983} 3961}
3984 3962
3985 3963
diff --git a/src/termchar.h b/src/termchar.h
index 601b9fe8205..687f7fbd119 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -16,6 +16,8 @@ GNU General Public License for more details.
16You should have received a copy of the GNU General Public License 16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include "dispextern.h"
20
19/* Each termcap frame points to its own struct tty_output object in 21/* Each termcap frame points to its own struct tty_output object in
20 the output_data.tty field. The tty_output structure contains the 22 the output_data.tty field. The tty_output structure contains the
21 information that is specific to termcap frames. */ 23 information that is specific to termcap frames. */
diff --git a/src/w32console.c b/src/w32console.c
index ee92a593301..a707344efc8 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -636,13 +636,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
636 term->frame_up_to_date_hook = 0; 636 term->frame_up_to_date_hook = 0;
637 637
638 /* Initialize the mouse-highlight data. */ 638 /* Initialize the mouse-highlight data. */
639 hlinfo = &term->display_info.tty->mouse_highlight; 639 reset_mouse_highlight (&term->display_info.tty->mouse_highlight);
640 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
641 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
642 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
643 hlinfo->mouse_face_mouse_frame = NULL;
644 hlinfo->mouse_face_window = Qnil;
645 hlinfo->mouse_face_hidden = 0;
646 640
647 /* Initialize interrupt_handle. */ 641 /* Initialize interrupt_handle. */
648 init_crit (); 642 init_crit ();
diff --git a/src/w32term.c b/src/w32term.c
index 7a15323551b..ba3aadd0b49 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -678,8 +678,6 @@ static void
678x_update_window_end (struct window *w, bool cursor_on_p, 678x_update_window_end (struct window *w, bool cursor_on_p,
679 bool mouse_face_overwritten_p) 679 bool mouse_face_overwritten_p)
680{ 680{
681 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
682
683 if (!w->pseudo_window_p) 681 if (!w->pseudo_window_p)
684 { 682 {
685 block_input (); 683 block_input ();
@@ -698,11 +696,7 @@ x_update_window_end (struct window *w, bool cursor_on_p,
698 /* If a row with mouse-face was overwritten, arrange for 696 /* If a row with mouse-face was overwritten, arrange for
699 XTframe_up_to_date to redisplay the mouse highlight. */ 697 XTframe_up_to_date to redisplay the mouse highlight. */
700 if (mouse_face_overwritten_p) 698 if (mouse_face_overwritten_p)
701 { 699 reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
702 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
703 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
704 hlinfo->mouse_face_window = Qnil;
705 }
706 700
707 /* Unhide the caret. This won't actually show the cursor, unless it 701 /* Unhide the caret. This won't actually show the cursor, unless it
708 was visible before the corresponding call to HideCaret in 702 was visible before the corresponding call to HideCaret in
@@ -6156,16 +6150,8 @@ x_free_frame_resources (struct frame *f)
6156 dpyinfo->w32_focus_event_frame = 0; 6150 dpyinfo->w32_focus_event_frame = 0;
6157 if (f == dpyinfo->x_highlight_frame) 6151 if (f == dpyinfo->x_highlight_frame)
6158 dpyinfo->x_highlight_frame = 0; 6152 dpyinfo->x_highlight_frame = 0;
6159
6160 if (f == hlinfo->mouse_face_mouse_frame) 6153 if (f == hlinfo->mouse_face_mouse_frame)
6161 { 6154 reset_mouse_highlight (hlinfo);
6162 hlinfo->mouse_face_beg_row
6163 = hlinfo->mouse_face_beg_col = -1;
6164 hlinfo->mouse_face_end_row
6165 = hlinfo->mouse_face_end_col = -1;
6166 hlinfo->mouse_face_window = Qnil;
6167 hlinfo->mouse_face_mouse_frame = 0;
6168 }
6169 6155
6170 unblock_input (); 6156 unblock_input ();
6171} 6157}
@@ -6235,7 +6221,6 @@ void
6235w32_initialize_display_info (Lisp_Object display_name) 6221w32_initialize_display_info (Lisp_Object display_name)
6236{ 6222{
6237 struct w32_display_info *dpyinfo = &one_w32_display_info; 6223 struct w32_display_info *dpyinfo = &one_w32_display_info;
6238 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
6239 6224
6240 memset (dpyinfo, 0, sizeof (*dpyinfo)); 6225 memset (dpyinfo, 0, sizeof (*dpyinfo));
6241 6226
@@ -6258,17 +6243,10 @@ w32_initialize_display_info (Lisp_Object display_name)
6258 dpyinfo->n_fonts = 0; 6243 dpyinfo->n_fonts = 0;
6259 dpyinfo->smallest_font_height = 1; 6244 dpyinfo->smallest_font_height = 1;
6260 dpyinfo->smallest_char_width = 1; 6245 dpyinfo->smallest_char_width = 1;
6261
6262 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
6263 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
6264 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
6265 hlinfo->mouse_face_window = Qnil;
6266 hlinfo->mouse_face_overlay = Qnil;
6267 hlinfo->mouse_face_hidden = 0;
6268
6269 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); 6246 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
6270 /* TODO: dpyinfo->gray */ 6247 /* TODO: dpyinfo->gray */
6271 6248
6249 reset_mouse_highlight (&dpyinfo->mouse_highlight);
6272} 6250}
6273 6251
6274/* Create an xrdb-style database of resources to supersede registry settings. 6252/* Create an xrdb-style database of resources to supersede registry settings.
diff --git a/src/window.c b/src/window.c
index aa52efc1b4e..1331ac014ff 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2845,7 +2845,7 @@ window-start value is reasonable when this function is called. */)
2845 block_input (); 2845 block_input ();
2846 if (!FRAME_INITIAL_P (f)) 2846 if (!FRAME_INITIAL_P (f))
2847 { 2847 {
2848 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 2848 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
2849 2849
2850 /* We are going to free the glyph matrices of WINDOW, and with 2850 /* We are going to free the glyph matrices of WINDOW, and with
2851 that we might lose any information about glyph rows that have 2851 that we might lose any information about glyph rows that have
@@ -2855,11 +2855,7 @@ window-start value is reasonable when this function is called. */)
2855 frame's up-to-date hook that mouse highlight was overwritten, 2855 frame's up-to-date hook that mouse highlight was overwritten,
2856 so that it will arrange for redisplaying the highlight. */ 2856 so that it will arrange for redisplaying the highlight. */
2857 if (EQ (hlinfo->mouse_face_window, window)) 2857 if (EQ (hlinfo->mouse_face_window, window))
2858 { 2858 reset_mouse_highlight (hlinfo);
2859 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
2860 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
2861 hlinfo->mouse_face_window = Qnil;
2862 }
2863 } 2859 }
2864 free_window_matrices (r); 2860 free_window_matrices (r);
2865 2861
diff --git a/src/xdisp.c b/src/xdisp.c
index 024b590a87c..635a86d9bbd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27049,10 +27049,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
27049 cleared = 1; 27049 cleared = 1;
27050 } 27050 }
27051 27051
27052 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 27052 reset_mouse_highlight (hlinfo);
27053 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
27054 hlinfo->mouse_face_window = Qnil;
27055 hlinfo->mouse_face_overlay = Qnil;
27056 return cleared; 27053 return cleared;
27057} 27054}
27058 27055
@@ -28840,11 +28837,7 @@ cancel_mouse_face (struct frame *f)
28840 28837
28841 window = hlinfo->mouse_face_window; 28838 window = hlinfo->mouse_face_window;
28842 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 28839 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
28843 { 28840 reset_mouse_highlight (hlinfo);
28844 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
28845 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
28846 hlinfo->mouse_face_window = Qnil;
28847 }
28848} 28841}
28849 28842
28850 28843
diff --git a/src/xterm.c b/src/xterm.c
index 6730dd3e42e..ce29f355589 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -616,8 +616,6 @@ static void
616x_update_window_end (struct window *w, bool cursor_on_p, 616x_update_window_end (struct window *w, bool cursor_on_p,
617 bool mouse_face_overwritten_p) 617 bool mouse_face_overwritten_p)
618{ 618{
619 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
620
621 if (!w->pseudo_window_p) 619 if (!w->pseudo_window_p)
622 { 620 {
623 block_input (); 621 block_input ();
@@ -636,11 +634,7 @@ x_update_window_end (struct window *w, bool cursor_on_p,
636 /* If a row with mouse-face was overwritten, arrange for 634 /* If a row with mouse-face was overwritten, arrange for
637 XTframe_up_to_date to redisplay the mouse highlight. */ 635 XTframe_up_to_date to redisplay the mouse highlight. */
638 if (mouse_face_overwritten_p) 636 if (mouse_face_overwritten_p)
639 { 637 reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
640 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
641 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
642 hlinfo->mouse_face_window = Qnil;
643 }
644} 638}
645 639
646 640
@@ -9459,16 +9453,8 @@ x_free_frame_resources (struct frame *f)
9459 dpyinfo->x_focus_event_frame = 0; 9453 dpyinfo->x_focus_event_frame = 0;
9460 if (f == dpyinfo->x_highlight_frame) 9454 if (f == dpyinfo->x_highlight_frame)
9461 dpyinfo->x_highlight_frame = 0; 9455 dpyinfo->x_highlight_frame = 0;
9462
9463 if (f == hlinfo->mouse_face_mouse_frame) 9456 if (f == hlinfo->mouse_face_mouse_frame)
9464 { 9457 reset_mouse_highlight (hlinfo);
9465 hlinfo->mouse_face_beg_row
9466 = hlinfo->mouse_face_beg_col = -1;
9467 hlinfo->mouse_face_end_row
9468 = hlinfo->mouse_face_end_col = -1;
9469 hlinfo->mouse_face_window = Qnil;
9470 hlinfo->mouse_face_mouse_frame = 0;
9471 }
9472 9458
9473 unblock_input (); 9459 unblock_input ();
9474} 9460}
@@ -9840,7 +9826,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9840 struct terminal *terminal; 9826 struct terminal *terminal;
9841 struct x_display_info *dpyinfo; 9827 struct x_display_info *dpyinfo;
9842 XrmDatabase xrdb; 9828 XrmDatabase xrdb;
9843 Mouse_HLInfo *hlinfo;
9844 ptrdiff_t lim; 9829 ptrdiff_t lim;
9845 9830
9846 block_input (); 9831 block_input ();
@@ -9985,8 +9970,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9985 /* We have definitely succeeded. Record the new connection. */ 9970 /* We have definitely succeeded. Record the new connection. */
9986 9971
9987 dpyinfo = xzalloc (sizeof *dpyinfo); 9972 dpyinfo = xzalloc (sizeof *dpyinfo);
9988 hlinfo = &dpyinfo->mouse_highlight;
9989
9990 terminal = x_create_terminal (dpyinfo); 9973 terminal = x_create_terminal (dpyinfo);
9991 9974
9992 { 9975 {
@@ -10100,13 +10083,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10100 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen); 10083 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen);
10101 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); 10084 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen);
10102 dpyinfo->icon_bitmap_id = -1; 10085 dpyinfo->icon_bitmap_id = -1;
10103 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10104 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10105 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
10106 hlinfo->mouse_face_window = Qnil;
10107 hlinfo->mouse_face_overlay = Qnil;
10108 dpyinfo->wm_type = X_WMTYPE_UNKNOWN; 10086 dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
10109 10087
10088 reset_mouse_highlight (&dpyinfo->mouse_highlight);
10089
10110 /* See if we can construct pixel values from RGB values. */ 10090 /* See if we can construct pixel values from RGB values. */
10111 if (dpyinfo->visual->class == TrueColor) 10091 if (dpyinfo->visual->class == TrueColor)
10112 { 10092 {
diff --git a/src/xterm.h b/src/xterm.h
index fbc2f05a375..d1a586881b2 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#ifndef XTERM_H 20#ifndef XTERM_H
21#define XTERM_H 21#define XTERM_H
22 22
23#include "dispextern.h"
24
23#include <X11/Xlib.h> 25#include <X11/Xlib.h>
24#include <X11/cursorfont.h> 26#include <X11/cursorfont.h>
25 27