aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 6e1d85de924..cb9dddd82cb 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2667,8 +2667,57 @@ enum move_operation_enum
2667 MOVE_TO_POS = 0x08 2667 MOVE_TO_POS = 0x08
2668}; 2668};
2669 2669
2670/***********************************************************************
2671 Mouse Highlight
2672 ***********************************************************************/
2673
2674/* Structure to hold mouse highlight data. */
2675
2676typedef struct {
2677 /* These variables describe the range of text currently shown in its
2678 mouse-face, together with the window they apply to. As long as
2679 the mouse stays within this range, we need not redraw anything on
2680 its account. Rows and columns are glyph matrix positions in
2681 MOUSE_FACE_WINDOW. */
2682 int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
2683 int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
2684 Lisp_Object mouse_face_window;
2685 int mouse_face_face_id;
2686 Lisp_Object mouse_face_overlay;
2687
2688 /* FRAME and X, Y position of mouse when last checked for
2689 highlighting. X and Y can be negative or out of range for the frame. */
2690 struct frame *mouse_face_mouse_frame;
2691 int mouse_face_mouse_x, mouse_face_mouse_y;
2692
2693 /* Nonzero if part of the text currently shown in
2694 its mouse-face is beyond the window end. */
2695 unsigned mouse_face_past_end : 1;
2696
2697 /* Nonzero means defer mouse-motion highlighting. */
2698 unsigned mouse_face_defer : 1;
2699
2700 /* Nonzero means that the mouse highlight should not be shown. */
2701 unsigned mouse_face_hidden : 1;
2702} Mouse_HLInfo;
2703
2704DISPEXTERN_INLINE void
2705reset_mouse_highlight (Mouse_HLInfo *hlinfo)
2706{
2707
2708 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
2709 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
2710 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
2711 hlinfo->mouse_face_beg_x = hlinfo->mouse_face_end_x = 0;
2712 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
2713 hlinfo->mouse_face_mouse_frame = NULL;
2714 hlinfo->mouse_face_window = Qnil;
2715 hlinfo->mouse_face_overlay = Qnil;
2716 hlinfo->mouse_face_past_end = 0;
2717 hlinfo->mouse_face_hidden = 0;
2718 hlinfo->mouse_face_defer = 0;
2719}
2670 2720
2671
2672/*********************************************************************** 2721/***********************************************************************
2673 Window-based redisplay interface 2722 Window-based redisplay interface
2674 ***********************************************************************/ 2723 ***********************************************************************/
diff --git a/src/lisp.h b/src/lisp.h
index f609727fe27..3dab0d6ddfd 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2164,36 +2164,6 @@ enum char_bits
2164 CHARACTERBITS = 22 2164 CHARACTERBITS = 22
2165 }; 2165 };
2166 2166
2167/* Structure to hold mouse highlight data. This is here because other
2168 header files need it for defining struct x_output etc. */
2169typedef struct {
2170 /* These variables describe the range of text currently shown in its
2171 mouse-face, together with the window they apply to. As long as
2172 the mouse stays within this range, we need not redraw anything on
2173 its account. Rows and columns are glyph matrix positions in
2174 MOUSE_FACE_WINDOW. */
2175 int mouse_face_beg_row, mouse_face_beg_col, mouse_face_beg_x;
2176 int mouse_face_end_row, mouse_face_end_col, mouse_face_end_x;
2177 Lisp_Object mouse_face_window;
2178 int mouse_face_face_id;
2179 Lisp_Object mouse_face_overlay;
2180
2181 /* FRAME and X, Y position of mouse when last checked for
2182 highlighting. X and Y can be negative or out of range for the frame. */
2183 struct frame *mouse_face_mouse_frame;
2184 int mouse_face_mouse_x, mouse_face_mouse_y;
2185
2186 /* Nonzero if part of the text currently shown in
2187 its mouse-face is beyond the window end. */
2188 unsigned mouse_face_past_end : 1;
2189
2190 /* Nonzero means defer mouse-motion highlighting. */
2191 unsigned mouse_face_defer : 1;
2192
2193 /* Nonzero means that the mouse highlight should not be shown. */
2194 unsigned mouse_face_hidden : 1;
2195} Mouse_HLInfo;
2196
2197/* Data type checking. */ 2167/* Data type checking. */
2198 2168
2199LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x)) 2169LISP_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 6ef32608a56..e40572bf13d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2842,7 +2842,7 @@ window-start value is reasonable when this function is called. */)
2842 block_input (); 2842 block_input ();
2843 if (!FRAME_INITIAL_P (f)) 2843 if (!FRAME_INITIAL_P (f))
2844 { 2844 {
2845 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 2845 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
2846 2846
2847 /* We are going to free the glyph matrices of WINDOW, and with 2847 /* We are going to free the glyph matrices of WINDOW, and with
2848 that we might lose any information about glyph rows that have 2848 that we might lose any information about glyph rows that have
@@ -2852,11 +2852,7 @@ window-start value is reasonable when this function is called. */)
2852 frame's up-to-date hook that mouse highlight was overwritten, 2852 frame's up-to-date hook that mouse highlight was overwritten,
2853 so that it will arrange for redisplaying the highlight. */ 2853 so that it will arrange for redisplaying the highlight. */
2854 if (EQ (hlinfo->mouse_face_window, window)) 2854 if (EQ (hlinfo->mouse_face_window, window))
2855 { 2855 reset_mouse_highlight (hlinfo);
2856 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
2857 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
2858 hlinfo->mouse_face_window = Qnil;
2859 }
2860 } 2856 }
2861 free_window_matrices (r); 2857 free_window_matrices (r);
2862 2858
diff --git a/src/xdisp.c b/src/xdisp.c
index 0617a3e6430..98ff1aae1d8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -26795,10 +26795,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
26795 cleared = 1; 26795 cleared = 1;
26796 } 26796 }
26797 26797
26798 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 26798 reset_mouse_highlight (hlinfo);
26799 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
26800 hlinfo->mouse_face_window = Qnil;
26801 hlinfo->mouse_face_overlay = Qnil;
26802 return cleared; 26799 return cleared;
26803} 26800}
26804 26801
@@ -28586,11 +28583,7 @@ cancel_mouse_face (struct frame *f)
28586 28583
28587 window = hlinfo->mouse_face_window; 28584 window = hlinfo->mouse_face_window;
28588 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 28585 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
28589 { 28586 reset_mouse_highlight (hlinfo);
28590 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
28591 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
28592 hlinfo->mouse_face_window = Qnil;
28593 }
28594} 28587}
28595 28588
28596 28589
diff --git a/src/xterm.c b/src/xterm.c
index cea952f44d2..7014bdb9740 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -613,8 +613,6 @@ static void
613x_update_window_end (struct window *w, bool cursor_on_p, 613x_update_window_end (struct window *w, bool cursor_on_p,
614 bool mouse_face_overwritten_p) 614 bool mouse_face_overwritten_p)
615{ 615{
616 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
617
618 if (!w->pseudo_window_p) 616 if (!w->pseudo_window_p)
619 { 617 {
620 block_input (); 618 block_input ();
@@ -633,11 +631,7 @@ x_update_window_end (struct window *w, bool cursor_on_p,
633 /* If a row with mouse-face was overwritten, arrange for 631 /* If a row with mouse-face was overwritten, arrange for
634 XTframe_up_to_date to redisplay the mouse highlight. */ 632 XTframe_up_to_date to redisplay the mouse highlight. */
635 if (mouse_face_overwritten_p) 633 if (mouse_face_overwritten_p)
636 { 634 reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
637 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
638 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
639 hlinfo->mouse_face_window = Qnil;
640 }
641} 635}
642 636
643 637
@@ -9445,16 +9439,8 @@ x_free_frame_resources (struct frame *f)
9445 dpyinfo->x_focus_event_frame = 0; 9439 dpyinfo->x_focus_event_frame = 0;
9446 if (f == dpyinfo->x_highlight_frame) 9440 if (f == dpyinfo->x_highlight_frame)
9447 dpyinfo->x_highlight_frame = 0; 9441 dpyinfo->x_highlight_frame = 0;
9448
9449 if (f == hlinfo->mouse_face_mouse_frame) 9442 if (f == hlinfo->mouse_face_mouse_frame)
9450 { 9443 reset_mouse_highlight (hlinfo);
9451 hlinfo->mouse_face_beg_row
9452 = hlinfo->mouse_face_beg_col = -1;
9453 hlinfo->mouse_face_end_row
9454 = hlinfo->mouse_face_end_col = -1;
9455 hlinfo->mouse_face_window = Qnil;
9456 hlinfo->mouse_face_mouse_frame = 0;
9457 }
9458 9444
9459 unblock_input (); 9445 unblock_input ();
9460} 9446}
@@ -9826,7 +9812,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9826 struct terminal *terminal; 9812 struct terminal *terminal;
9827 struct x_display_info *dpyinfo; 9813 struct x_display_info *dpyinfo;
9828 XrmDatabase xrdb; 9814 XrmDatabase xrdb;
9829 Mouse_HLInfo *hlinfo;
9830 ptrdiff_t lim; 9815 ptrdiff_t lim;
9831 9816
9832 block_input (); 9817 block_input ();
@@ -9967,8 +9952,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9967 /* We have definitely succeeded. Record the new connection. */ 9952 /* We have definitely succeeded. Record the new connection. */
9968 9953
9969 dpyinfo = xzalloc (sizeof *dpyinfo); 9954 dpyinfo = xzalloc (sizeof *dpyinfo);
9970 hlinfo = &dpyinfo->mouse_highlight;
9971
9972 terminal = x_create_terminal (dpyinfo); 9955 terminal = x_create_terminal (dpyinfo);
9973 9956
9974 { 9957 {
@@ -10082,13 +10065,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10082 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen); 10065 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen);
10083 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); 10066 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen);
10084 dpyinfo->icon_bitmap_id = -1; 10067 dpyinfo->icon_bitmap_id = -1;
10085 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10086 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10087 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
10088 hlinfo->mouse_face_window = Qnil;
10089 hlinfo->mouse_face_overlay = Qnil;
10090 dpyinfo->wm_type = X_WMTYPE_UNKNOWN; 10068 dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
10091 10069
10070 reset_mouse_highlight (&dpyinfo->mouse_highlight);
10071
10092 /* See if we can construct pixel values from RGB values. */ 10072 /* See if we can construct pixel values from RGB values. */
10093 if (dpyinfo->visual->class == TrueColor) 10073 if (dpyinfo->visual->class == TrueColor)
10094 { 10074 {
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