Commit bbf534ce authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 7ea692f6
2010-11-01 Eli Zaretskii <eliz@gnu.org>
* 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.
2010-10-31 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (get_tool_bar_item, handle_tool_bar_click)
......
......@@ -553,7 +553,7 @@ Free a pool and temporary objects it refers to (callable from C)
-------------------------------------------------------------------------- */
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
NSTRACE (ns_update_window_begin);
updated_window = w;
......@@ -561,15 +561,15 @@ Free a pool and temporary objects it refers to (callable from C)
BLOCK_INPUT;
if (f == dpyinfo->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
dpyinfo->mouse_face_defer = 1;
hlinfo->mouse_face_defer = 1;
/* If the frame needs to be redrawn,
simply forget about any prior mouse highlighting. */
if (FRAME_GARBAGED_P (f))
dpyinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_window = Qnil;
/* (further code for mouse faces ifdef'd out in other terms elided) */
}
......@@ -586,7 +586,7 @@ Free a pool and temporary objects it refers to (callable from C)
external (RIF) call; for one window called before update_end
-------------------------------------------------------------------------- */
{
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (XFRAME (w->frame));
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
/* note: this fn is nearly identical in all terms */
if (!w->pseudo_window_p)
......@@ -608,9 +608,9 @@ Free a pool and temporary objects it refers to (callable from C)
frame_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
{
dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
}
updated_window = NULL;
......@@ -627,8 +627,8 @@ Free a pool and temporary objects it refers to (callable from C)
{
NSView *view = FRAME_NS_VIEW (f);
/* if (f == FRAME_NS_DISPLAY_INFO (f)->mouse_face_mouse_frame) */
FRAME_NS_DISPLAY_INFO (f)->mouse_face_defer = 0;
/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
MOUSE_HL_INFO (f)->mouse_face_defer = 0;
BLOCK_INPUT;
......@@ -1032,6 +1032,7 @@ Free a pool and temporary objects it refers to (callable from C)
{
NSView *view = FRAME_NS_VIEW (f);
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
NSTRACE (x_destroy_window);
check_ns ();
......@@ -1048,13 +1049,13 @@ Free a pool and temporary objects it refers to (callable from C)
dpyinfo->x_focus_frame = 0;
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
if (f == dpyinfo->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_window = Qnil;
dpyinfo->mouse_face_deferred_gc = 0;
dpyinfo->mouse_face_mouse_frame = 0;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
}
xfree (f->output_data.ns);
......@@ -1772,18 +1773,18 @@ Free a pool and temporary objects it refers to (callable from C)
if (FRAME_NS_P (f))
{
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
if ((dpyinfo->mouse_face_deferred_gc||f ==dpyinfo->mouse_face_mouse_frame)
/*&& dpyinfo->mouse_face_mouse_frame*/)
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
/*&& hlinfo->mouse_face_mouse_frame*/)
{
BLOCK_INPUT;
ns_update_begin(f);
if (dpyinfo->mouse_face_mouse_frame)
note_mouse_highlight (dpyinfo->mouse_face_mouse_frame,
dpyinfo->mouse_face_mouse_x,
dpyinfo->mouse_face_mouse_y);
dpyinfo->mouse_face_deferred_gc = 0;
ns_update_end(f);
ns_update_begin(f);
if (hlinfo->mouse_face_mouse_frame)
note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
hlinfo->mouse_face_mouse_x,
hlinfo->mouse_face_mouse_y);
hlinfo->mouse_face_deferred_gc = 0;
ns_update_end(f);
UNBLOCK_INPUT;
}
}
......@@ -2595,8 +2596,7 @@ Function modeled after x_draw_glyph_string_box ().
if (s->hl == DRAW_MOUSE_FACE)
{
face = FACE_FROM_ID
(s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
......@@ -2663,8 +2663,8 @@ Function modeled after x_draw_glyph_string_box ().
struct face *face;
if (s->hl == DRAW_MOUSE_FACE)
{
face = FACE_FROM_ID
(s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
face = FACE_FROM_ID (s->f,
MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
......@@ -2749,8 +2749,7 @@ Function modeled after x_draw_glyph_string_box ().
with its background color), we must clear just the image area. */
if (s->hl == DRAW_MOUSE_FACE)
{
face = FACE_FROM_ID
(s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
......@@ -2873,8 +2872,7 @@ overwriting cursor (usually when cursor on a tab) */
if (s->hl == DRAW_MOUSE_FACE)
{
face = FACE_FROM_ID
(s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
......@@ -3529,6 +3527,7 @@ Convert modifier code (see lisp.h) to lisp symbol
{
NSScreen *screen = [NSScreen mainScreen];
NSWindowDepth depth = [screen depth];
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */
dpyinfo->resy = 72.27;
......@@ -3543,16 +3542,16 @@ Convert modifier code (see lisp.h) to lisp symbol
dpyinfo->color_table->colors = NULL;
dpyinfo->root_window = 42; /* a placeholder.. */
dpyinfo->mouse_face_mouse_frame = NULL;
dpyinfo->mouse_face_deferred_gc = 0;
dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
dpyinfo->mouse_face_window = dpyinfo->mouse_face_overlay = Qnil;
dpyinfo->mouse_face_hidden = 0;
hlinfo->mouse_face_mouse_frame = NULL;
hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil;
hlinfo->mouse_face_hidden = 0;
dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0;
dpyinfo->mouse_face_defer = 0;
hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
hlinfo->mouse_face_defer = 0;
dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL;
......@@ -4335,7 +4334,7 @@ - (void)resetCursorRects
- (void)keyDown: (NSEvent *)theEvent
{
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
int code;
unsigned fnKeysym = 0;
int flags;
......@@ -4373,10 +4372,10 @@ most recently updated (I guess), which is not the correct one. */
[NSCursor setHiddenUntilMouseMoves: YES];
if (dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
{
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
if (!processingCompose)
......@@ -4813,7 +4812,7 @@ - (void) scrollWheel: (NSEvent *)theEvent
/* Tell emacs the mouse has moved. */
- (void)mouseMoved: (NSEvent *)e
{
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
Lisp_Object frame;
// NSTRACE (mouseMoved);
......@@ -4823,10 +4822,10 @@ - (void)mouseMoved: (NSEvent *)e
= [self convertPoint: [e locationInWindow] fromView: nil];
/* update any mouse face */
if (dpyinfo->mouse_face_hidden)
if (hlinfo->mouse_face_hidden)
{
dpyinfo->mouse_face_hidden = 0;
clear_mouse_face (dpyinfo);
hlinfo->mouse_face_hidden = 0;
clear_mouse_face (hlinfo);
}
/* tooltip handling */
......@@ -5292,20 +5291,19 @@ - (void)mouseExited: (NSEvent *)theEvent
{
NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
NSRect r;
struct ns_display_info *dpyinfo
= emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL;
Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
NSTRACE (mouseExited);
if (dpyinfo || !emacsframe)
if (hlinfo || !emacsframe)
return;
last_mouse_movement_time = EV_TIMESTAMP (theEvent);
if (emacsframe == dpyinfo->mouse_face_mouse_frame)
if (emacsframe == hlinfo->mouse_face_mouse_frame)
{
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_mouse_frame = 0;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_mouse_frame = 0;
}
}
......
......@@ -505,7 +505,7 @@ static void
x_update_window_begin (struct window *w)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
/* Hide the system caret during an update. */
if (w32_use_visible_system_caret && w32_system_caret_hwnd)
......@@ -518,15 +518,15 @@ x_update_window_begin (struct window *w)
BLOCK_INPUT;
if (f == display_info->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
display_info->mouse_face_defer = 1;
hlinfo->mouse_face_defer = 1;
/* If F needs to be redrawn, simply forget about any prior mouse
highlighting. */
if (FRAME_GARBAGED_P (f))
display_info->mouse_face_window = Qnil;
hlinfo->mouse_face_window = Qnil;
#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
their mouse_face_p flag set, which means that they are always
......@@ -540,8 +540,8 @@ x_update_window_begin (struct window *w)
Likewise, don't do anything if the frame is garbaged;
in that case, the frame's current matrix that we would use
is all wrong, and we will redisplay that line anyway. */
if (!NILP (display_info->mouse_face_window)
&& w == XWINDOW (display_info->mouse_face_window))
if (!NILP (hlinfo->mouse_face_window)
&& w == XWINDOW (hlinfo->mouse_face_window))
{
int i;
......@@ -550,7 +550,7 @@ x_update_window_begin (struct window *w)
break;
if (i < w->desired_matrix->nrows)
clear_mouse_face (display_info);
clear_mouse_face (hlinfo);
}
#endif /* 0 */
}
......@@ -601,7 +601,7 @@ static void
x_update_window_end (struct window *w, int cursor_on_p,
int mouse_face_overwritten_p)
{
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame));
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
if (!w->pseudo_window_p)
{
......@@ -622,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p,
XTframe_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
{
dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
}
/* Unhide the caret. This won't actually show the cursor, unless it
......@@ -649,7 +649,7 @@ x_update_end (struct frame *f)
return;
/* Mouse highlight may be displayed again. */
FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0;
MOUSE_HL_INFO (f)->mouse_face_defer = 0;
}
......@@ -662,17 +662,17 @@ w32_frame_up_to_date (struct frame *f)
{
if (FRAME_W32_P (f))
{
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
if (dpyinfo->mouse_face_deferred_gc
|| f == dpyinfo->mouse_face_mouse_frame)
if (hlinfo->mouse_face_deferred_gc
|| f == hlinfo->mouse_face_mouse_frame)
{
BLOCK_INPUT;
if (dpyinfo->mouse_face_mouse_frame)
note_mouse_highlight (dpyinfo->mouse_face_mouse_frame,
dpyinfo->mouse_face_mouse_x,
dpyinfo->mouse_face_mouse_y);
dpyinfo->mouse_face_deferred_gc = 0;
if (hlinfo->mouse_face_mouse_frame)
note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
hlinfo->mouse_face_mouse_x,
hlinfo->mouse_face_mouse_y);
hlinfo->mouse_face_deferred_gc = 0;
UNBLOCK_INPUT;
}
}
......@@ -999,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
struct face *face;
/* What face has to be used last for the mouse face? */
face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id;
face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
face = FACE_FROM_ID (s->f, face_id);
if (face == NULL)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
......@@ -3964,6 +3964,7 @@ w32_read_socket (struct terminal *terminal, int expected,
W32Msg msg;
struct frame *f;
struct w32_display_info *dpyinfo = &one_w32_display_info;
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
if (interrupt_input_blocked)
{
......@@ -4064,11 +4065,11 @@ w32_read_socket (struct terminal *terminal, int expected,
if (f && !f->iconified)
{
if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
{
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
if (temp_index == sizeof temp_buffer / sizeof (short))
......@@ -4089,11 +4090,11 @@ w32_read_socket (struct terminal *terminal, int expected,
if (f && !f->iconified)
{
if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
{
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
if (temp_index == sizeof temp_buffer / sizeof (short))
......@@ -4167,11 +4168,11 @@ w32_read_socket (struct terminal *terminal, int expected,
if (f && !f->iconified)
{
if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
{
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_hidden = 1;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
if (temp_index == sizeof temp_buffer / sizeof (short))
......@@ -4205,10 +4206,10 @@ w32_read_socket (struct terminal *terminal, int expected,
else
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (dpyinfo->mouse_face_hidden)
if (hlinfo->mouse_face_hidden)
{
dpyinfo->mouse_face_hidden = 0;
clear_mouse_face (dpyinfo);
hlinfo->mouse_face_hidden = 0;
clear_mouse_face (hlinfo);
}
if (f)
......@@ -4249,7 +4250,7 @@ w32_read_socket (struct terminal *terminal, int expected,
{
/* If we move outside the frame, then we're
certainly no longer on any text in the frame. */
clear_mouse_face (dpyinfo);
clear_mouse_face (hlinfo);
}
/* If the contents of the global variable help_echo_string
......@@ -4538,12 +4539,12 @@ w32_read_socket (struct terminal *terminal, int expected,
f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f)
{
if (f == dpyinfo->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
/* If we move outside the frame, then we're
certainly no longer on any text in the frame. */
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_mouse_frame = 0;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_mouse_frame = 0;
}
/* Generate a nil HELP_EVENT to cancel a help-echo.
......@@ -4573,12 +4574,12 @@ w32_read_socket (struct terminal *terminal, int expected,
if (f == dpyinfo->w32_focus_frame)
x_new_focus_frame (dpyinfo, 0);
if (f == dpyinfo->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
/* If we move outside the frame, then we're
certainly no longer on any text in the frame. */
clear_mouse_face (dpyinfo);
dpyinfo->mouse_face_mouse_frame = 0;
clear_mouse_face (hlinfo);
hlinfo->mouse_face_mouse_frame = 0;
}
/* Generate a nil HELP_EVENT to cancel a help-echo.
......@@ -5726,6 +5727,7 @@ void
x_free_frame_resources (struct frame *f)
{
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
BLOCK_INPUT;
......@@ -5764,15 +5766,15 @@ x_free_frame_resources (struct frame *f)
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
if (f == dpyinfo->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
dpyinfo->mouse_face_beg_row
= dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row
= dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_window = Qnil;
dpyinfo->mouse_face_deferred_gc = 0;
dpyinfo->mouse_face_mouse_frame = 0;
hlinfo->mouse_face_beg_row
= hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row
= hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_deferred_gc = 0;
hlinfo->mouse_face_mouse_frame = 0;
}
UNBLOCK_INPUT;
......@@ -5838,6 +5840,7 @@ void
w32_initialize_display_info (Lisp_Object display_name)
{
struct w32_display_info *dpyinfo = &one_w32_display_info;
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
memset (dpyinfo, 0, sizeof (*dpyinfo));
......@@ -5863,12 +5866,12 @@ w32_initialize_display_info (Lisp_Object display_name)
dpyinfo->smallest_font_height = 1;
dpyinfo->smallest_char_width = 1;
dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
dpyinfo->mouse_face_window = Qnil;
dpyinfo->mouse_face_overlay = Qnil;
dpyinfo->mouse_face_hidden = 0;
hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
hlinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_overlay = Qnil;
hlinfo->mouse_face_hidden = 0;
dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
/* TODO: dpyinfo->gray */
......
......@@ -23732,7 +23732,8 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
#ifdef HAVE_WINDOW_SYSTEM
/* When we've written over the cursor, arrange for it to
be displayed again. */
if (phys_cursor_on_p && !w->phys_cursor_on_p)
if (FRAME_WINDOW_P (f)
&& phys_cursor_on_p && !w->phys_cursor_on_p)
{
BLOCK_INPUT;
display_and_set_cursor (w, 1,
......@@ -23745,13 +23746,16 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
#ifdef HAVE_WINDOW_SYSTEM
/* Change the mouse cursor. */
if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
else if (draw == DRAW_MOUSE_FACE)
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
else
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
if (FRAME_WINDOW_P (f))
{
if (draw == DRAW_NORMAL_TEXT
&& !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
else if (draw == DRAW_MOUSE_FACE)
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
else
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
}
#endif /* HAVE_WINDOW_SYSTEM */
}
......@@ -24678,8 +24682,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
struct frame *f = XFRAME (w->frame);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
#ifdef HAVE_WINDOW_SYSTEM
Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
Display_Info *dpyinfo;
Cursor cursor;
#else
Cursor cursor = No_Cursor;
#endif
......@@ -24792,18 +24796,24 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
}
#ifdef HAVE_WINDOW_SYSTEM
if (NILP (pointer))
pointer = Fget_text_property (pos, Qpointer, string);
/* Change the mouse pointer according to what is under X/Y. */
if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
if (FRAME_WINDOW_P (f))
{
Lisp_Object map;
map = Fget_text_property (pos, Qlocal_map, string);
if (!KEYMAPP (map))
map = Fget_text_property (pos, Qkeymap, string);
if (!KEYMAPP (map))
cursor = dpyinfo->vertical_scroll_bar_cursor;
dpyinfo = FRAME_X_DISPLAY_INFO (f);
cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
if (NILP (pointer))
pointer = Fget_text_property (pos, Qpointer, string);
/* Change the mouse pointer according to what is under X/Y. */
if (NILP (pointer)
&& ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
{
Lisp_Object map;
map = Fget_text_property (pos, Qlocal_map, string);
if (!KEYMAPP (map))
map = Fget_text_property (pos, Qkeymap, string);
if (!KEYMAPP (map))
cursor = dpyinfo->vertical_scroll_bar_cursor;
}
}
#endif
......@@ -24939,7 +24949,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
clear_mouse_face (hlinfo);
}
#ifdef HAVE_WINDOW_SYSTEM
define_frame_cursor1 (f, cursor, pointer);
if (FRAME_WINDOW_P (f))
define_frame_cursor1 (f, cursor, pointer);
#endif
}
......@@ -25125,7 +25136,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
if (clear_mouse_face (hlinfo))
cursor = No_Cursor;
#ifdef HAVE_WINDOW_SYSTEM
if (NILP (pointer))
if (FRAME_WINDOW_P (f) && NILP (pointer))
{
if (area != TEXT_AREA)
cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
......@@ -25384,7 +25395,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
#ifdef HAVE_WINDOW_SYSTEM
/* Look for a `pointer' property. */
if (NILP (pointer))
if (FRAME_WINDOW_P (f) && NILP (pointer))
{
/* Check overlays first. */
for (i = noverlays - 1; i >= 0 && NILP (pointer); --i)
......@@ -25433,9 +25444,10 @@ note_mouse_highlight (struct frame *f, int x, int y)
set_cursor:
#ifdef HAVE_WINDOW_SYSTEM
define_frame_cursor1 (f, cursor, pointer);
if (FRAME_WINDOW_P (f))
define_frame_cursor1 (f, cursor, pointer);
#else
/* This is here to prevent a compiler error, due to "label at end of
/* This is here to prevent a compiler error, about "label at end of
compound statement". */
return;
#endif
......
......@@ -548,22 +548,22 @@ static void
x_update_window_begin (struct window *w)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
updated_window = w;
set_output_cursor (&w->cursor);
BLOCK_INPUT;
if (f == display_info->mouse_face_mouse_frame)
if (f == hlinfo->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
display_info->mouse_face_defer = 1;
hlinfo->mouse_face_defer = 1;