aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-01 22:09:03 +0200
committerEli Zaretskii2010-11-01 22:09:03 +0200
commitbbf534ce52f044f79773e91f558227c3e9a1727b (patch)
tree289207d3fa6d3bd520b1e2b69d96f116b8f372c1 /src
parent7ea692f66f4367755bb9e80991182ac55c90ead2 (diff)
downloademacs-bbf534ce52f044f79773e91f558227c3e9a1727b.tar.gz
emacs-bbf534ce52f044f79773e91f558227c3e9a1727b.zip
Finish coding mouse highlight redesigned for portability.
Not compiled yet. nsterm.m (ns_update_window_begin, ns_update_window_end) (ns_update_end, x_destroy_window, ns_frame_up_to_date) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) (ns_dumpglyphs_image, ns_dumpglyphs_stretch) (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) (handle_one_xevent, x_free_frame_resources, x_term_init): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. w32term.c (x_update_window_begin, x_update_window_end) (x_update_end, w32_read_socket, x_free_frame_resources) (w32_initialize_display_info): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code unless the frame is on a window-system.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog26
-rw-r--r--src/nsterm.m112
-rw-r--r--src/w32term.c117
-rw-r--r--src/xdisp.c64
-rw-r--r--src/xterm.c98
5 files changed, 230 insertions, 187 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ed77cbd91e2..ce84ba0f2e5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
12010-11-01 Eli Zaretskii <eliz@gnu.org>
2
3 * nsterm.m (ns_update_window_begin, ns_update_window_end)
4 (ns_update_end, x_destroy_window, ns_frame_up_to_date)
5 (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
6 (ns_dumpglyphs_image, ns_dumpglyphs_stretch)
7 (ns_initialize_display_info, keyDown, mouseMoved, mouseExited):
8 Replace Display_Info with Mouse_HLInfo everywhere where
9 mouse_face_* members were accessed for mouse highlight purposes.
10
11 * xterm.c (x_update_window_begin, x_update_window_end)
12 (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc)
13 (handle_one_xevent, x_free_frame_resources, x_term_init): Replace
14 Display_Info with Mouse_HLInfo everywhere where mouse_face_*
15 members were accessed for mouse highlight purposes.
16
17 * w32term.c (x_update_window_begin, x_update_window_end)
18 (x_update_end, w32_read_socket, x_free_frame_resources)
19 (w32_initialize_display_info): Replace Display_Info with
20 Mouse_HLInfo everywhere where mouse_face_* members were accessed
21 for mouse highlight purposes.
22
23 * xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight)
24 (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code
25 unless the frame is on a window-system.
26
12010-10-31 Eli Zaretskii <eliz@gnu.org> 272010-10-31 Eli Zaretskii <eliz@gnu.org>
2 28
3 * xdisp.c (get_tool_bar_item, handle_tool_bar_click) 29 * xdisp.c (get_tool_bar_item, handle_tool_bar_click)
diff --git a/src/nsterm.m b/src/nsterm.m
index 247ef4dd40c..32235fd29c6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -553,7 +553,7 @@ ns_update_window_begin (struct window *w)
553 -------------------------------------------------------------------------- */ 553 -------------------------------------------------------------------------- */
554{ 554{
555 struct frame *f = XFRAME (WINDOW_FRAME (w)); 555 struct frame *f = XFRAME (WINDOW_FRAME (w));
556 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 556 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
557 NSTRACE (ns_update_window_begin); 557 NSTRACE (ns_update_window_begin);
558 558
559 updated_window = w; 559 updated_window = w;
@@ -561,15 +561,15 @@ ns_update_window_begin (struct window *w)
561 561
562 BLOCK_INPUT; 562 BLOCK_INPUT;
563 563
564 if (f == dpyinfo->mouse_face_mouse_frame) 564 if (f == hlinfo->mouse_face_mouse_frame)
565 { 565 {
566 /* Don't do highlighting for mouse motion during the update. */ 566 /* Don't do highlighting for mouse motion during the update. */
567 dpyinfo->mouse_face_defer = 1; 567 hlinfo->mouse_face_defer = 1;
568 568
569 /* If the frame needs to be redrawn, 569 /* If the frame needs to be redrawn,
570 simply forget about any prior mouse highlighting. */ 570 simply forget about any prior mouse highlighting. */
571 if (FRAME_GARBAGED_P (f)) 571 if (FRAME_GARBAGED_P (f))
572 dpyinfo->mouse_face_window = Qnil; 572 hlinfo->mouse_face_window = Qnil;
573 573
574 /* (further code for mouse faces ifdef'd out in other terms elided) */ 574 /* (further code for mouse faces ifdef'd out in other terms elided) */
575 } 575 }
@@ -586,7 +586,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
586 external (RIF) call; for one window called before update_end 586 external (RIF) call; for one window called before update_end
587 -------------------------------------------------------------------------- */ 587 -------------------------------------------------------------------------- */
588{ 588{
589 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (XFRAME (w->frame)); 589 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
590 590
591 /* note: this fn is nearly identical in all terms */ 591 /* note: this fn is nearly identical in all terms */
592 if (!w->pseudo_window_p) 592 if (!w->pseudo_window_p)
@@ -608,9 +608,9 @@ ns_update_window_end (struct window *w, int cursor_on_p,
608 frame_up_to_date to redisplay the mouse highlight. */ 608 frame_up_to_date to redisplay the mouse highlight. */
609 if (mouse_face_overwritten_p) 609 if (mouse_face_overwritten_p)
610 { 610 {
611 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 611 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
612 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 612 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
613 dpyinfo->mouse_face_window = Qnil; 613 hlinfo->mouse_face_window = Qnil;
614 } 614 }
615 615
616 updated_window = NULL; 616 updated_window = NULL;
@@ -627,8 +627,8 @@ ns_update_end (struct frame *f)
627{ 627{
628 NSView *view = FRAME_NS_VIEW (f); 628 NSView *view = FRAME_NS_VIEW (f);
629 629
630/* if (f == FRAME_NS_DISPLAY_INFO (f)->mouse_face_mouse_frame) */ 630/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
631 FRAME_NS_DISPLAY_INFO (f)->mouse_face_defer = 0; 631 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
632 632
633 BLOCK_INPUT; 633 BLOCK_INPUT;
634 634
@@ -1032,6 +1032,7 @@ x_destroy_window (struct frame *f)
1032{ 1032{
1033 NSView *view = FRAME_NS_VIEW (f); 1033 NSView *view = FRAME_NS_VIEW (f);
1034 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 1034 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
1035 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1035 NSTRACE (x_destroy_window); 1036 NSTRACE (x_destroy_window);
1036 check_ns (); 1037 check_ns ();
1037 1038
@@ -1048,13 +1049,13 @@ x_destroy_window (struct frame *f)
1048 dpyinfo->x_focus_frame = 0; 1049 dpyinfo->x_focus_frame = 0;
1049 if (f == dpyinfo->x_highlight_frame) 1050 if (f == dpyinfo->x_highlight_frame)
1050 dpyinfo->x_highlight_frame = 0; 1051 dpyinfo->x_highlight_frame = 0;
1051 if (f == dpyinfo->mouse_face_mouse_frame) 1052 if (f == hlinfo->mouse_face_mouse_frame)
1052 { 1053 {
1053 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 1054 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1054 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 1055 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1055 dpyinfo->mouse_face_window = Qnil; 1056 hlinfo->mouse_face_window = Qnil;
1056 dpyinfo->mouse_face_deferred_gc = 0; 1057 hlinfo->mouse_face_deferred_gc = 0;
1057 dpyinfo->mouse_face_mouse_frame = 0; 1058 hlinfo->mouse_face_mouse_frame = 0;
1058 } 1059 }
1059 1060
1060 xfree (f->output_data.ns); 1061 xfree (f->output_data.ns);
@@ -1772,18 +1773,18 @@ ns_frame_up_to_date (struct frame *f)
1772 1773
1773 if (FRAME_NS_P (f)) 1774 if (FRAME_NS_P (f))
1774 { 1775 {
1775 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 1776 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1776 if ((dpyinfo->mouse_face_deferred_gc||f ==dpyinfo->mouse_face_mouse_frame) 1777 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
1777 /*&& dpyinfo->mouse_face_mouse_frame*/) 1778 /*&& hlinfo->mouse_face_mouse_frame*/)
1778 { 1779 {
1779 BLOCK_INPUT; 1780 BLOCK_INPUT;
1780 ns_update_begin(f); 1781 ns_update_begin(f);
1781 if (dpyinfo->mouse_face_mouse_frame) 1782 if (hlinfo->mouse_face_mouse_frame)
1782 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 1783 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1783 dpyinfo->mouse_face_mouse_x, 1784 hlinfo->mouse_face_mouse_x,
1784 dpyinfo->mouse_face_mouse_y); 1785 hlinfo->mouse_face_mouse_y);
1785 dpyinfo->mouse_face_deferred_gc = 0; 1786 hlinfo->mouse_face_deferred_gc = 0;
1786 ns_update_end(f); 1787 ns_update_end(f);
1787 UNBLOCK_INPUT; 1788 UNBLOCK_INPUT;
1788 } 1789 }
1789 } 1790 }
@@ -2595,8 +2596,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
2595 2596
2596 if (s->hl == DRAW_MOUSE_FACE) 2597 if (s->hl == DRAW_MOUSE_FACE)
2597 { 2598 {
2598 face = FACE_FROM_ID 2599 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2599 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2600 if (!face) 2600 if (!face)
2601 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2601 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2602 } 2602 }
@@ -2663,8 +2663,8 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
2663 struct face *face; 2663 struct face *face;
2664 if (s->hl == DRAW_MOUSE_FACE) 2664 if (s->hl == DRAW_MOUSE_FACE)
2665 { 2665 {
2666 face = FACE_FROM_ID 2666 face = FACE_FROM_ID (s->f,
2667 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); 2667 MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2668 if (!face) 2668 if (!face)
2669 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2669 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2670 } 2670 }
@@ -2749,8 +2749,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
2749 with its background color), we must clear just the image area. */ 2749 with its background color), we must clear just the image area. */
2750 if (s->hl == DRAW_MOUSE_FACE) 2750 if (s->hl == DRAW_MOUSE_FACE)
2751 { 2751 {
2752 face = FACE_FROM_ID 2752 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2753 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2754 if (!face) 2753 if (!face)
2755 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2754 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2756 } 2755 }
@@ -2873,8 +2872,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
2873 2872
2874 if (s->hl == DRAW_MOUSE_FACE) 2873 if (s->hl == DRAW_MOUSE_FACE)
2875 { 2874 {
2876 face = FACE_FROM_ID 2875 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2877 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2878 if (!face) 2876 if (!face)
2879 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2877 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2880 } 2878 }
@@ -3529,6 +3527,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3529{ 3527{
3530 NSScreen *screen = [NSScreen mainScreen]; 3528 NSScreen *screen = [NSScreen mainScreen];
3531 NSWindowDepth depth = [screen depth]; 3529 NSWindowDepth depth = [screen depth];
3530 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3532 3531
3533 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ 3532 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */
3534 dpyinfo->resy = 72.27; 3533 dpyinfo->resy = 72.27;
@@ -3543,16 +3542,16 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3543 dpyinfo->color_table->colors = NULL; 3542 dpyinfo->color_table->colors = NULL;
3544 dpyinfo->root_window = 42; /* a placeholder.. */ 3543 dpyinfo->root_window = 42; /* a placeholder.. */
3545 3544
3546 dpyinfo->mouse_face_mouse_frame = NULL; 3545 hlinfo->mouse_face_mouse_frame = NULL;
3547 dpyinfo->mouse_face_deferred_gc = 0; 3546 hlinfo->mouse_face_deferred_gc = 0;
3548 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 3547 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
3549 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 3548 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
3550 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 3549 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
3551 dpyinfo->mouse_face_window = dpyinfo->mouse_face_overlay = Qnil; 3550 hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil;
3552 dpyinfo->mouse_face_hidden = 0; 3551 hlinfo->mouse_face_hidden = 0;
3553 3552
3554 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; 3553 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
3555 dpyinfo->mouse_face_defer = 0; 3554 hlinfo->mouse_face_defer = 0;
3556 3555
3557 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; 3556 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL;
3558 3557
@@ -4335,7 +4334,7 @@ ns_term_shutdown (int sig)
4335 4334
4336- (void)keyDown: (NSEvent *)theEvent 4335- (void)keyDown: (NSEvent *)theEvent
4337{ 4336{
4338 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); 4337 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
4339 int code; 4338 int code;
4340 unsigned fnKeysym = 0; 4339 unsigned fnKeysym = 0;
4341 int flags; 4340 int flags;
@@ -4373,10 +4372,10 @@ ns_term_shutdown (int sig)
4373 4372
4374 [NSCursor setHiddenUntilMouseMoves: YES]; 4373 [NSCursor setHiddenUntilMouseMoves: YES];
4375 4374
4376 if (dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4375 if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
4377 { 4376 {
4378 clear_mouse_face (dpyinfo); 4377 clear_mouse_face (hlinfo);
4379 dpyinfo->mouse_face_hidden = 1; 4378 hlinfo->mouse_face_hidden = 1;
4380 } 4379 }
4381 4380
4382 if (!processingCompose) 4381 if (!processingCompose)
@@ -4813,7 +4812,7 @@ ns_term_shutdown (int sig)
4813/* Tell emacs the mouse has moved. */ 4812/* Tell emacs the mouse has moved. */
4814- (void)mouseMoved: (NSEvent *)e 4813- (void)mouseMoved: (NSEvent *)e
4815{ 4814{
4816 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); 4815 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
4817 Lisp_Object frame; 4816 Lisp_Object frame;
4818 4817
4819// NSTRACE (mouseMoved); 4818// NSTRACE (mouseMoved);
@@ -4823,10 +4822,10 @@ ns_term_shutdown (int sig)
4823 = [self convertPoint: [e locationInWindow] fromView: nil]; 4822 = [self convertPoint: [e locationInWindow] fromView: nil];
4824 4823
4825 /* update any mouse face */ 4824 /* update any mouse face */
4826 if (dpyinfo->mouse_face_hidden) 4825 if (hlinfo->mouse_face_hidden)
4827 { 4826 {
4828 dpyinfo->mouse_face_hidden = 0; 4827 hlinfo->mouse_face_hidden = 0;
4829 clear_mouse_face (dpyinfo); 4828 clear_mouse_face (hlinfo);
4830 } 4829 }
4831 4830
4832 /* tooltip handling */ 4831 /* tooltip handling */
@@ -5292,20 +5291,19 @@ ns_term_shutdown (int sig)
5292{ 5291{
5293 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; 5292 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
5294 NSRect r; 5293 NSRect r;
5295 struct ns_display_info *dpyinfo 5294 Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
5296 = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL;
5297 5295
5298 NSTRACE (mouseExited); 5296 NSTRACE (mouseExited);
5299 5297
5300 if (dpyinfo || !emacsframe) 5298 if (hlinfo || !emacsframe)
5301 return; 5299 return;
5302 5300
5303 last_mouse_movement_time = EV_TIMESTAMP (theEvent); 5301 last_mouse_movement_time = EV_TIMESTAMP (theEvent);
5304 5302
5305 if (emacsframe == dpyinfo->mouse_face_mouse_frame) 5303 if (emacsframe == hlinfo->mouse_face_mouse_frame)
5306 { 5304 {
5307 clear_mouse_face (dpyinfo); 5305 clear_mouse_face (hlinfo);
5308 dpyinfo->mouse_face_mouse_frame = 0; 5306 hlinfo->mouse_face_mouse_frame = 0;
5309 } 5307 }
5310} 5308}
5311 5309
diff --git a/src/w32term.c b/src/w32term.c
index 7690f13799f..ba861f083a1 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -505,7 +505,7 @@ static void
505x_update_window_begin (struct window *w) 505x_update_window_begin (struct window *w)
506{ 506{
507 struct frame *f = XFRAME (WINDOW_FRAME (w)); 507 struct frame *f = XFRAME (WINDOW_FRAME (w));
508 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); 508 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
509 509
510 /* Hide the system caret during an update. */ 510 /* Hide the system caret during an update. */
511 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 511 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
@@ -518,15 +518,15 @@ x_update_window_begin (struct window *w)
518 518
519 BLOCK_INPUT; 519 BLOCK_INPUT;
520 520
521 if (f == display_info->mouse_face_mouse_frame) 521 if (f == hlinfo->mouse_face_mouse_frame)
522 { 522 {
523 /* Don't do highlighting for mouse motion during the update. */ 523 /* Don't do highlighting for mouse motion during the update. */
524 display_info->mouse_face_defer = 1; 524 hlinfo->mouse_face_defer = 1;
525 525
526 /* If F needs to be redrawn, simply forget about any prior mouse 526 /* If F needs to be redrawn, simply forget about any prior mouse
527 highlighting. */ 527 highlighting. */
528 if (FRAME_GARBAGED_P (f)) 528 if (FRAME_GARBAGED_P (f))
529 display_info->mouse_face_window = Qnil; 529 hlinfo->mouse_face_window = Qnil;
530 530
531#if 0 /* Rows in a current matrix containing glyphs in mouse-face have 531#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
532 their mouse_face_p flag set, which means that they are always 532 their mouse_face_p flag set, which means that they are always
@@ -540,8 +540,8 @@ x_update_window_begin (struct window *w)
540 Likewise, don't do anything if the frame is garbaged; 540 Likewise, don't do anything if the frame is garbaged;
541 in that case, the frame's current matrix that we would use 541 in that case, the frame's current matrix that we would use
542 is all wrong, and we will redisplay that line anyway. */ 542 is all wrong, and we will redisplay that line anyway. */
543 if (!NILP (display_info->mouse_face_window) 543 if (!NILP (hlinfo->mouse_face_window)
544 && w == XWINDOW (display_info->mouse_face_window)) 544 && w == XWINDOW (hlinfo->mouse_face_window))
545 { 545 {
546 int i; 546 int i;
547 547
@@ -550,7 +550,7 @@ x_update_window_begin (struct window *w)
550 break; 550 break;
551 551
552 if (i < w->desired_matrix->nrows) 552 if (i < w->desired_matrix->nrows)
553 clear_mouse_face (display_info); 553 clear_mouse_face (hlinfo);
554 } 554 }
555#endif /* 0 */ 555#endif /* 0 */
556 } 556 }
@@ -601,7 +601,7 @@ static void
601x_update_window_end (struct window *w, int cursor_on_p, 601x_update_window_end (struct window *w, int cursor_on_p,
602 int mouse_face_overwritten_p) 602 int mouse_face_overwritten_p)
603{ 603{
604 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); 604 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
605 605
606 if (!w->pseudo_window_p) 606 if (!w->pseudo_window_p)
607 { 607 {
@@ -622,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p,
622 XTframe_up_to_date to redisplay the mouse highlight. */ 622 XTframe_up_to_date to redisplay the mouse highlight. */
623 if (mouse_face_overwritten_p) 623 if (mouse_face_overwritten_p)
624 { 624 {
625 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 625 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
626 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 626 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
627 dpyinfo->mouse_face_window = Qnil; 627 hlinfo->mouse_face_window = Qnil;
628 } 628 }
629 629
630 /* Unhide the caret. This won't actually show the cursor, unless it 630 /* Unhide the caret. This won't actually show the cursor, unless it
@@ -649,7 +649,7 @@ x_update_end (struct frame *f)
649 return; 649 return;
650 650
651 /* Mouse highlight may be displayed again. */ 651 /* Mouse highlight may be displayed again. */
652 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; 652 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
653} 653}
654 654
655 655
@@ -662,17 +662,17 @@ w32_frame_up_to_date (struct frame *f)
662{ 662{
663 if (FRAME_W32_P (f)) 663 if (FRAME_W32_P (f))
664 { 664 {
665 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 665 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
666 666
667 if (dpyinfo->mouse_face_deferred_gc 667 if (hlinfo->mouse_face_deferred_gc
668 || f == dpyinfo->mouse_face_mouse_frame) 668 || f == hlinfo->mouse_face_mouse_frame)
669 { 669 {
670 BLOCK_INPUT; 670 BLOCK_INPUT;
671 if (dpyinfo->mouse_face_mouse_frame) 671 if (hlinfo->mouse_face_mouse_frame)
672 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 672 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
673 dpyinfo->mouse_face_mouse_x, 673 hlinfo->mouse_face_mouse_x,
674 dpyinfo->mouse_face_mouse_y); 674 hlinfo->mouse_face_mouse_y);
675 dpyinfo->mouse_face_deferred_gc = 0; 675 hlinfo->mouse_face_deferred_gc = 0;
676 UNBLOCK_INPUT; 676 UNBLOCK_INPUT;
677 } 677 }
678 } 678 }
@@ -999,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
999 struct face *face; 999 struct face *face;
1000 1000
1001 /* What face has to be used last for the mouse face? */ 1001 /* What face has to be used last for the mouse face? */
1002 face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; 1002 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
1003 face = FACE_FROM_ID (s->f, face_id); 1003 face = FACE_FROM_ID (s->f, face_id);
1004 if (face == NULL) 1004 if (face == NULL)
1005 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 1005 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -3964,6 +3964,7 @@ w32_read_socket (struct terminal *terminal, int expected,
3964 W32Msg msg; 3964 W32Msg msg;
3965 struct frame *f; 3965 struct frame *f;
3966 struct w32_display_info *dpyinfo = &one_w32_display_info; 3966 struct w32_display_info *dpyinfo = &one_w32_display_info;
3967 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3967 3968
3968 if (interrupt_input_blocked) 3969 if (interrupt_input_blocked)
3969 { 3970 {
@@ -4064,11 +4065,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4064 4065
4065 if (f && !f->iconified) 4066 if (f && !f->iconified)
4066 { 4067 {
4067 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4068 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4068 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4069 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4069 { 4070 {
4070 clear_mouse_face (dpyinfo); 4071 clear_mouse_face (hlinfo);
4071 dpyinfo->mouse_face_hidden = 1; 4072 hlinfo->mouse_face_hidden = 1;
4072 } 4073 }
4073 4074
4074 if (temp_index == sizeof temp_buffer / sizeof (short)) 4075 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4089,11 +4090,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4089 4090
4090 if (f && !f->iconified) 4091 if (f && !f->iconified)
4091 { 4092 {
4092 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4093 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4093 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4094 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4094 { 4095 {
4095 clear_mouse_face (dpyinfo); 4096 clear_mouse_face (hlinfo);
4096 dpyinfo->mouse_face_hidden = 1; 4097 hlinfo->mouse_face_hidden = 1;
4097 } 4098 }
4098 4099
4099 if (temp_index == sizeof temp_buffer / sizeof (short)) 4100 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4167,11 +4168,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4167 4168
4168 if (f && !f->iconified) 4169 if (f && !f->iconified)
4169 { 4170 {
4170 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4171 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4171 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4172 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4172 { 4173 {
4173 clear_mouse_face (dpyinfo); 4174 clear_mouse_face (hlinfo);
4174 dpyinfo->mouse_face_hidden = 1; 4175 hlinfo->mouse_face_hidden = 1;
4175 } 4176 }
4176 4177
4177 if (temp_index == sizeof temp_buffer / sizeof (short)) 4178 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4205,10 +4206,10 @@ w32_read_socket (struct terminal *terminal, int expected,
4205 else 4206 else
4206 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 4207 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4207 4208
4208 if (dpyinfo->mouse_face_hidden) 4209 if (hlinfo->mouse_face_hidden)
4209 { 4210 {
4210 dpyinfo->mouse_face_hidden = 0; 4211 hlinfo->mouse_face_hidden = 0;
4211 clear_mouse_face (dpyinfo); 4212 clear_mouse_face (hlinfo);
4212 } 4213 }
4213 4214
4214 if (f) 4215 if (f)
@@ -4249,7 +4250,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4249 { 4250 {
4250 /* If we move outside the frame, then we're 4251 /* If we move outside the frame, then we're
4251 certainly no longer on any text in the frame. */ 4252 certainly no longer on any text in the frame. */
4252 clear_mouse_face (dpyinfo); 4253 clear_mouse_face (hlinfo);
4253 } 4254 }
4254 4255
4255 /* If the contents of the global variable help_echo_string 4256 /* If the contents of the global variable help_echo_string
@@ -4538,12 +4539,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4538 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); 4539 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
4539 if (f) 4540 if (f)
4540 { 4541 {
4541 if (f == dpyinfo->mouse_face_mouse_frame) 4542 if (f == hlinfo->mouse_face_mouse_frame)
4542 { 4543 {
4543 /* If we move outside the frame, then we're 4544 /* If we move outside the frame, then we're
4544 certainly no longer on any text in the frame. */ 4545 certainly no longer on any text in the frame. */
4545 clear_mouse_face (dpyinfo); 4546 clear_mouse_face (hlinfo);
4546 dpyinfo->mouse_face_mouse_frame = 0; 4547 hlinfo->mouse_face_mouse_frame = 0;
4547 } 4548 }
4548 4549
4549 /* Generate a nil HELP_EVENT to cancel a help-echo. 4550 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -4573,12 +4574,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4573 if (f == dpyinfo->w32_focus_frame) 4574 if (f == dpyinfo->w32_focus_frame)
4574 x_new_focus_frame (dpyinfo, 0); 4575 x_new_focus_frame (dpyinfo, 0);
4575 4576
4576 if (f == dpyinfo->mouse_face_mouse_frame) 4577 if (f == hlinfo->mouse_face_mouse_frame)
4577 { 4578 {
4578 /* If we move outside the frame, then we're 4579 /* If we move outside the frame, then we're
4579 certainly no longer on any text in the frame. */ 4580 certainly no longer on any text in the frame. */
4580 clear_mouse_face (dpyinfo); 4581 clear_mouse_face (hlinfo);
4581 dpyinfo->mouse_face_mouse_frame = 0; 4582 hlinfo->mouse_face_mouse_frame = 0;
4582 } 4583 }
4583 4584
4584 /* Generate a nil HELP_EVENT to cancel a help-echo. 4585 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -5726,6 +5727,7 @@ void
5726x_free_frame_resources (struct frame *f) 5727x_free_frame_resources (struct frame *f)
5727{ 5728{
5728 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5729 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5730 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
5729 5731
5730 BLOCK_INPUT; 5732 BLOCK_INPUT;
5731 5733
@@ -5764,15 +5766,15 @@ x_free_frame_resources (struct frame *f)
5764 if (f == dpyinfo->x_highlight_frame) 5766 if (f == dpyinfo->x_highlight_frame)
5765 dpyinfo->x_highlight_frame = 0; 5767 dpyinfo->x_highlight_frame = 0;
5766 5768
5767 if (f == dpyinfo->mouse_face_mouse_frame) 5769 if (f == hlinfo->mouse_face_mouse_frame)
5768 { 5770 {
5769 dpyinfo->mouse_face_beg_row 5771 hlinfo->mouse_face_beg_row
5770 = dpyinfo->mouse_face_beg_col = -1; 5772 = hlinfo->mouse_face_beg_col = -1;
5771 dpyinfo->mouse_face_end_row 5773 hlinfo->mouse_face_end_row
5772 = dpyinfo->mouse_face_end_col = -1; 5774 = hlinfo->mouse_face_end_col = -1;
5773 dpyinfo->mouse_face_window = Qnil; 5775 hlinfo->mouse_face_window = Qnil;
5774 dpyinfo->mouse_face_deferred_gc = 0; 5776 hlinfo->mouse_face_deferred_gc = 0;
5775 dpyinfo->mouse_face_mouse_frame = 0; 5777 hlinfo->mouse_face_mouse_frame = 0;
5776 } 5778 }
5777 5779
5778 UNBLOCK_INPUT; 5780 UNBLOCK_INPUT;
@@ -5838,6 +5840,7 @@ void
5838w32_initialize_display_info (Lisp_Object display_name) 5840w32_initialize_display_info (Lisp_Object display_name)
5839{ 5841{
5840 struct w32_display_info *dpyinfo = &one_w32_display_info; 5842 struct w32_display_info *dpyinfo = &one_w32_display_info;
5843 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5841 5844
5842 memset (dpyinfo, 0, sizeof (*dpyinfo)); 5845 memset (dpyinfo, 0, sizeof (*dpyinfo));
5843 5846
@@ -5863,12 +5866,12 @@ w32_initialize_display_info (Lisp_Object display_name)
5863 dpyinfo->smallest_font_height = 1; 5866 dpyinfo->smallest_font_height = 1;
5864 dpyinfo->smallest_char_width = 1; 5867 dpyinfo->smallest_char_width = 1;
5865 5868
5866 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 5869 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
5867 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 5870 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
5868 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 5871 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
5869 dpyinfo->mouse_face_window = Qnil; 5872 hlinfo->mouse_face_window = Qnil;
5870 dpyinfo->mouse_face_overlay = Qnil; 5873 hlinfo->mouse_face_overlay = Qnil;
5871 dpyinfo->mouse_face_hidden = 0; 5874 hlinfo->mouse_face_hidden = 0;
5872 5875
5873 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); 5876 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
5874 /* TODO: dpyinfo->gray */ 5877 /* TODO: dpyinfo->gray */
diff --git a/src/xdisp.c b/src/xdisp.c
index 97c2caeaeb7..73dd7452ad0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23732,7 +23732,8 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
23732#ifdef HAVE_WINDOW_SYSTEM 23732#ifdef HAVE_WINDOW_SYSTEM
23733 /* When we've written over the cursor, arrange for it to 23733 /* When we've written over the cursor, arrange for it to
23734 be displayed again. */ 23734 be displayed again. */
23735 if (phys_cursor_on_p && !w->phys_cursor_on_p) 23735 if (FRAME_WINDOW_P (f)
23736 && phys_cursor_on_p && !w->phys_cursor_on_p)
23736 { 23737 {
23737 BLOCK_INPUT; 23738 BLOCK_INPUT;
23738 display_and_set_cursor (w, 1, 23739 display_and_set_cursor (w, 1,
@@ -23745,13 +23746,16 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
23745 23746
23746#ifdef HAVE_WINDOW_SYSTEM 23747#ifdef HAVE_WINDOW_SYSTEM
23747 /* Change the mouse cursor. */ 23748 /* Change the mouse cursor. */
23748 if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) 23749 if (FRAME_WINDOW_P (f))
23749 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); 23750 {
23750 else if (draw == DRAW_MOUSE_FACE) 23751 if (draw == DRAW_NORMAL_TEXT
23751 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); 23752 && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
23752 else 23753 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
23753 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); 23754 else if (draw == DRAW_MOUSE_FACE)
23754 23755 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
23756 else
23757 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
23758 }
23755#endif /* HAVE_WINDOW_SYSTEM */ 23759#endif /* HAVE_WINDOW_SYSTEM */
23756} 23760}
23757 23761
@@ -24678,8 +24682,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24678 struct frame *f = XFRAME (w->frame); 24682 struct frame *f = XFRAME (w->frame);
24679 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 24683 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
24680#ifdef HAVE_WINDOW_SYSTEM 24684#ifdef HAVE_WINDOW_SYSTEM
24681 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 24685 Display_Info *dpyinfo;
24682 Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 24686 Cursor cursor;
24683#else 24687#else
24684 Cursor cursor = No_Cursor; 24688 Cursor cursor = No_Cursor;
24685#endif 24689#endif
@@ -24792,18 +24796,24 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24792 } 24796 }
24793 24797
24794#ifdef HAVE_WINDOW_SYSTEM 24798#ifdef HAVE_WINDOW_SYSTEM
24795 if (NILP (pointer)) 24799 if (FRAME_WINDOW_P (f))
24796 pointer = Fget_text_property (pos, Qpointer, string);
24797
24798 /* Change the mouse pointer according to what is under X/Y. */
24799 if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
24800 { 24800 {
24801 Lisp_Object map; 24801 dpyinfo = FRAME_X_DISPLAY_INFO (f);
24802 map = Fget_text_property (pos, Qlocal_map, string); 24802 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
24803 if (!KEYMAPP (map)) 24803 if (NILP (pointer))
24804 map = Fget_text_property (pos, Qkeymap, string); 24804 pointer = Fget_text_property (pos, Qpointer, string);
24805 if (!KEYMAPP (map)) 24805
24806 cursor = dpyinfo->vertical_scroll_bar_cursor; 24806 /* Change the mouse pointer according to what is under X/Y. */
24807 if (NILP (pointer)
24808 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
24809 {
24810 Lisp_Object map;
24811 map = Fget_text_property (pos, Qlocal_map, string);
24812 if (!KEYMAPP (map))
24813 map = Fget_text_property (pos, Qkeymap, string);
24814 if (!KEYMAPP (map))
24815 cursor = dpyinfo->vertical_scroll_bar_cursor;
24816 }
24807 } 24817 }
24808#endif 24818#endif
24809 24819
@@ -24939,7 +24949,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24939 clear_mouse_face (hlinfo); 24949 clear_mouse_face (hlinfo);
24940 } 24950 }
24941#ifdef HAVE_WINDOW_SYSTEM 24951#ifdef HAVE_WINDOW_SYSTEM
24942 define_frame_cursor1 (f, cursor, pointer); 24952 if (FRAME_WINDOW_P (f))
24953 define_frame_cursor1 (f, cursor, pointer);
24943#endif 24954#endif
24944} 24955}
24945 24956
@@ -25125,7 +25136,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
25125 if (clear_mouse_face (hlinfo)) 25136 if (clear_mouse_face (hlinfo))
25126 cursor = No_Cursor; 25137 cursor = No_Cursor;
25127#ifdef HAVE_WINDOW_SYSTEM 25138#ifdef HAVE_WINDOW_SYSTEM
25128 if (NILP (pointer)) 25139 if (FRAME_WINDOW_P (f) && NILP (pointer))
25129 { 25140 {
25130 if (area != TEXT_AREA) 25141 if (area != TEXT_AREA)
25131 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 25142 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
@@ -25384,7 +25395,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
25384 25395
25385#ifdef HAVE_WINDOW_SYSTEM 25396#ifdef HAVE_WINDOW_SYSTEM
25386 /* Look for a `pointer' property. */ 25397 /* Look for a `pointer' property. */
25387 if (NILP (pointer)) 25398 if (FRAME_WINDOW_P (f) && NILP (pointer))
25388 { 25399 {
25389 /* Check overlays first. */ 25400 /* Check overlays first. */
25390 for (i = noverlays - 1; i >= 0 && NILP (pointer); --i) 25401 for (i = noverlays - 1; i >= 0 && NILP (pointer); --i)
@@ -25433,9 +25444,10 @@ note_mouse_highlight (struct frame *f, int x, int y)
25433 set_cursor: 25444 set_cursor:
25434 25445
25435#ifdef HAVE_WINDOW_SYSTEM 25446#ifdef HAVE_WINDOW_SYSTEM
25436 define_frame_cursor1 (f, cursor, pointer); 25447 if (FRAME_WINDOW_P (f))
25448 define_frame_cursor1 (f, cursor, pointer);
25437#else 25449#else
25438 /* This is here to prevent a compiler error, due to "label at end of 25450 /* This is here to prevent a compiler error, about "label at end of
25439 compound statement". */ 25451 compound statement". */
25440 return; 25452 return;
25441#endif 25453#endif
diff --git a/src/xterm.c b/src/xterm.c
index 401b3ecfa4e..7dd19fa0993 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -548,22 +548,22 @@ static void
548x_update_window_begin (struct window *w) 548x_update_window_begin (struct window *w)
549{ 549{
550 struct frame *f = XFRAME (WINDOW_FRAME (w)); 550 struct frame *f = XFRAME (WINDOW_FRAME (w));
551 struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 551 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
552 552
553 updated_window = w; 553 updated_window = w;
554 set_output_cursor (&w->cursor); 554 set_output_cursor (&w->cursor);
555 555
556 BLOCK_INPUT; 556 BLOCK_INPUT;
557 557
558 if (f == display_info->mouse_face_mouse_frame) 558 if (f == hlinfo->mouse_face_mouse_frame)
559 { 559 {
560 /* Don't do highlighting for mouse motion during the update. */ 560 /* Don't do highlighting for mouse motion during the update. */
561 display_info->mouse_face_defer = 1; 561 hlinfo->mouse_face_defer = 1;
562 562
563 /* If F needs to be redrawn, simply forget about any prior mouse 563 /* If F needs to be redrawn, simply forget about any prior mouse
564 highlighting. */ 564 highlighting. */
565 if (FRAME_GARBAGED_P (f)) 565 if (FRAME_GARBAGED_P (f))
566 display_info->mouse_face_window = Qnil; 566 hlinfo->mouse_face_window = Qnil;
567 } 567 }
568 568
569 UNBLOCK_INPUT; 569 UNBLOCK_INPUT;
@@ -603,7 +603,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
603static void 603static void
604x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) 604x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
605{ 605{
606 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 606 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
607 607
608 if (!w->pseudo_window_p) 608 if (!w->pseudo_window_p)
609 { 609 {
@@ -624,9 +624,9 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
624 XTframe_up_to_date to redisplay the mouse highlight. */ 624 XTframe_up_to_date to redisplay the mouse highlight. */
625 if (mouse_face_overwritten_p) 625 if (mouse_face_overwritten_p)
626 { 626 {
627 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 627 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
628 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 628 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
629 dpyinfo->mouse_face_window = Qnil; 629 hlinfo->mouse_face_window = Qnil;
630 } 630 }
631 631
632 updated_window = NULL; 632 updated_window = NULL;
@@ -640,7 +640,7 @@ static void
640x_update_end (struct frame *f) 640x_update_end (struct frame *f)
641{ 641{
642 /* Mouse highlight may be displayed again. */ 642 /* Mouse highlight may be displayed again. */
643 FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; 643 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
644 644
645#ifndef XFlush 645#ifndef XFlush
646 BLOCK_INPUT; 646 BLOCK_INPUT;
@@ -659,17 +659,17 @@ XTframe_up_to_date (struct frame *f)
659{ 659{
660 if (FRAME_X_P (f)) 660 if (FRAME_X_P (f))
661 { 661 {
662 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 662 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
663 663
664 if (dpyinfo->mouse_face_deferred_gc 664 if (hlinfo->mouse_face_deferred_gc
665 || f == dpyinfo->mouse_face_mouse_frame) 665 || f == hlinfo->mouse_face_mouse_frame)
666 { 666 {
667 BLOCK_INPUT; 667 BLOCK_INPUT;
668 if (dpyinfo->mouse_face_mouse_frame) 668 if (hlinfo->mouse_face_mouse_frame)
669 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 669 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
670 dpyinfo->mouse_face_mouse_x, 670 hlinfo->mouse_face_mouse_x,
671 dpyinfo->mouse_face_mouse_y); 671 hlinfo->mouse_face_mouse_y);
672 dpyinfo->mouse_face_deferred_gc = 0; 672 hlinfo->mouse_face_deferred_gc = 0;
673 UNBLOCK_INPUT; 673 UNBLOCK_INPUT;
674 } 674 }
675 } 675 }
@@ -970,7 +970,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
970 struct face *face; 970 struct face *face;
971 971
972 /* What face has to be used last for the mouse face? */ 972 /* What face has to be used last for the mouse face? */
973 face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id; 973 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
974 face = FACE_FROM_ID (s->f, face_id); 974 face = FACE_FROM_ID (s->f, face_id);
975 if (face == NULL) 975 if (face == NULL)
976 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 976 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -5703,6 +5703,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
5703 struct frame *f = NULL; 5703 struct frame *f = NULL;
5704 struct coding_system coding; 5704 struct coding_system coding;
5705 XEvent event = *eventp; 5705 XEvent event = *eventp;
5706 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5706 5707
5707 *finish = X_EVENT_NORMAL; 5708 *finish = X_EVENT_NORMAL;
5708 5709
@@ -6152,12 +6153,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6152 6153
6153 /* If mouse-highlight is an integer, input clears out 6154 /* If mouse-highlight is an integer, input clears out
6154 mouse highlighting. */ 6155 mouse highlighting. */
6155 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 6156 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
6156 && (f == 0 6157 && (f == 0
6157 || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) 6158 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)))
6158 { 6159 {
6159 clear_mouse_face (dpyinfo); 6160 clear_mouse_face (hlinfo);
6160 dpyinfo->mouse_face_hidden = 1; 6161 hlinfo->mouse_face_hidden = 1;
6161 } 6162 }
6162 6163
6163#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS 6164#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
@@ -6514,12 +6515,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6514 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); 6515 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window);
6515 if (f) 6516 if (f)
6516 { 6517 {
6517 if (f == dpyinfo->mouse_face_mouse_frame) 6518 if (f == hlinfo->mouse_face_mouse_frame)
6518 { 6519 {
6519 /* If we move outside the frame, then we're 6520 /* If we move outside the frame, then we're
6520 certainly no longer on any text in the frame. */ 6521 certainly no longer on any text in the frame. */
6521 clear_mouse_face (dpyinfo); 6522 clear_mouse_face (hlinfo);
6522 dpyinfo->mouse_face_mouse_frame = 0; 6523 hlinfo->mouse_face_mouse_frame = 0;
6523 } 6524 }
6524 6525
6525 /* Generate a nil HELP_EVENT to cancel a help-echo. 6526 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -6552,10 +6553,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6552 else 6553 else
6553 f = x_window_to_frame (dpyinfo, event.xmotion.window); 6554 f = x_window_to_frame (dpyinfo, event.xmotion.window);
6554 6555
6555 if (dpyinfo->mouse_face_hidden) 6556 if (hlinfo->mouse_face_hidden)
6556 { 6557 {
6557 dpyinfo->mouse_face_hidden = 0; 6558 hlinfo->mouse_face_hidden = 0;
6558 clear_mouse_face (dpyinfo); 6559 clear_mouse_face (hlinfo);
6559 } 6560 }
6560 6561
6561#ifdef USE_GTK 6562#ifdef USE_GTK
@@ -6610,7 +6611,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6610 6611
6611 /* If we move outside the frame, then we're 6612 /* If we move outside the frame, then we're
6612 certainly no longer on any text in the frame. */ 6613 certainly no longer on any text in the frame. */
6613 clear_mouse_face (dpyinfo); 6614 clear_mouse_face (hlinfo);
6614 } 6615 }
6615 6616
6616 /* If the contents of the global variable help_echo_string 6617 /* If the contents of the global variable help_echo_string
@@ -9304,6 +9305,7 @@ x_free_frame_resources (struct frame *f)
9304 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9305 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9305 Lisp_Object bar; 9306 Lisp_Object bar;
9306 struct scroll_bar *b; 9307 struct scroll_bar *b;
9308 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
9307 9309
9308 BLOCK_INPUT; 9310 BLOCK_INPUT;
9309 9311
@@ -9397,15 +9399,15 @@ x_free_frame_resources (struct frame *f)
9397 if (f == dpyinfo->x_highlight_frame) 9399 if (f == dpyinfo->x_highlight_frame)
9398 dpyinfo->x_highlight_frame = 0; 9400 dpyinfo->x_highlight_frame = 0;
9399 9401
9400 if (f == dpyinfo->mouse_face_mouse_frame) 9402 if (f == hlinfo->mouse_face_mouse_frame)
9401 { 9403 {
9402 dpyinfo->mouse_face_beg_row 9404 hlinfo->mouse_face_beg_row
9403 = dpyinfo->mouse_face_beg_col = -1; 9405 = hlinfo->mouse_face_beg_col = -1;
9404 dpyinfo->mouse_face_end_row 9406 hlinfo->mouse_face_end_row
9405 = dpyinfo->mouse_face_end_col = -1; 9407 = hlinfo->mouse_face_end_col = -1;
9406 dpyinfo->mouse_face_window = Qnil; 9408 hlinfo->mouse_face_window = Qnil;
9407 dpyinfo->mouse_face_deferred_gc = 0; 9409 hlinfo->mouse_face_deferred_gc = 0;
9408 dpyinfo->mouse_face_mouse_frame = 0; 9410 hlinfo->mouse_face_mouse_frame = 0;
9409 } 9411 }
9410 9412
9411 UNBLOCK_INPUT; 9413 UNBLOCK_INPUT;
@@ -9782,6 +9784,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9782 struct terminal *terminal; 9784 struct terminal *terminal;
9783 struct x_display_info *dpyinfo; 9785 struct x_display_info *dpyinfo;
9784 XrmDatabase xrdb; 9786 XrmDatabase xrdb;
9787 Mouse_HLInfo *hlinfo;
9785 9788
9786 BLOCK_INPUT; 9789 BLOCK_INPUT;
9787 9790
@@ -9912,6 +9915,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9912 9915
9913 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 9916 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
9914 memset (dpyinfo, 0, sizeof *dpyinfo); 9917 memset (dpyinfo, 0, sizeof *dpyinfo);
9918 hlinfo = &dpyinfo->mouse_highlight;
9915 9919
9916 terminal = x_create_terminal (dpyinfo); 9920 terminal = x_create_terminal (dpyinfo);
9917 9921
@@ -10034,16 +10038,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10034 dpyinfo->bitmaps_size = 0; 10038 dpyinfo->bitmaps_size = 0;
10035 dpyinfo->bitmaps_last = 0; 10039 dpyinfo->bitmaps_last = 0;
10036 dpyinfo->scratch_cursor_gc = 0; 10040 dpyinfo->scratch_cursor_gc = 0;
10037 dpyinfo->mouse_face_mouse_frame = 0; 10041 hlinfo->mouse_face_mouse_frame = 0;
10038 dpyinfo->mouse_face_deferred_gc = 0; 10042 hlinfo->mouse_face_deferred_gc = 0;
10039 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 10043 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10040 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 10044 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10041 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 10045 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
10042 dpyinfo->mouse_face_window = Qnil; 10046 hlinfo->mouse_face_window = Qnil;
10043 dpyinfo->mouse_face_overlay = Qnil; 10047 hlinfo->mouse_face_overlay = Qnil;
10044 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; 10048 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
10045 dpyinfo->mouse_face_defer = 0; 10049 hlinfo->mouse_face_defer = 0;
10046 dpyinfo->mouse_face_hidden = 0; 10050 hlinfo->mouse_face_hidden = 0;
10047 dpyinfo->x_focus_frame = 0; 10051 dpyinfo->x_focus_frame = 0;
10048 dpyinfo->x_focus_event_frame = 0; 10052 dpyinfo->x_focus_event_frame = 0;
10049 dpyinfo->x_highlight_frame = 0; 10053 dpyinfo->x_highlight_frame = 0;