Mercurial > emacs
changeset 111341:f79bd5f589f7
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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 01 Nov 2010 22:09:03 +0200 |
parents | 2186ab0af4a5 |
children | 7f466168c008 |
files | src/ChangeLog src/nsterm.m src/w32term.c src/xdisp.c src/xterm.c |
diffstat | 5 files changed, 235 insertions(+), 192 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sun Oct 31 20:50:02 2010 +0200 +++ b/src/ChangeLog Mon Nov 01 22:09:03 2010 +0200 @@ -1,3 +1,29 @@ +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)
--- a/src/nsterm.m Sun Oct 31 20:50:02 2010 +0200 +++ b/src/nsterm.m Mon Nov 01 22:09:03 2010 +0200 @@ -553,7 +553,7 @@ -------------------------------------------------------------------------- */ { 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 @@ 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 @@ 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 @@ 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 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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 @@ 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; - - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 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; + + 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)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 @@ [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 @@ /* 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 @@ = [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 @@ { 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; } }
--- a/src/w32term.c Sun Oct 31 20:50:02 2010 +0200 +++ b/src/w32term.c Mon Nov 01 22:09:03 2010 +0200 @@ -505,7 +505,7 @@ 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 @@ 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 @@ 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 @@ break; if (i < w->desired_matrix->nrows) - clear_mouse_face (display_info); + clear_mouse_face (hlinfo); } #endif /* 0 */ } @@ -601,7 +601,7 @@ 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 @@ 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 @@ 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 @@ { if (FRAME_W32_P (f)) { - struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); - - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + + 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 */
--- a/src/xdisp.c Sun Oct 31 20:50:02 2010 +0200 +++ b/src/xdisp.c Mon Nov 01 22:09:03 2010 +0200 @@ -23732,7 +23732,8 @@ #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 @@ #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 @@ 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 @@ } #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))) - { - 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; + if (FRAME_WINDOW_P (f)) + { + 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 @@ 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 @@ 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 @@ #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 @@ 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
--- a/src/xterm.c Sun Oct 31 20:50:02 2010 +0200 +++ b/src/xterm.c Mon Nov 01 22:09:03 2010 +0200 @@ -548,22 +548,22 @@ 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; /* 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; } UNBLOCK_INPUT; @@ -603,7 +603,7 @@ static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); if (!w->pseudo_window_p) { @@ -624,9 +624,9 @@ 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; } updated_window = NULL; @@ -640,7 +640,7 @@ x_update_end (struct frame *f) { /* Mouse highlight may be displayed again. */ - FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; + MOUSE_HL_INFO (f)->mouse_face_defer = 0; #ifndef XFlush BLOCK_INPUT; @@ -659,17 +659,17 @@ { if (FRAME_X_P (f)) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + + 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; } } @@ -970,7 +970,7 @@ struct face *face; /* What face has to be used last for the mouse face? */ - face_id = FRAME_X_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); @@ -5703,6 +5703,7 @@ struct frame *f = NULL; struct coding_system coding; XEvent event = *eventp; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; *finish = X_EVENT_NORMAL; @@ -6152,12 +6153,12 @@ /* If mouse-highlight is an integer, input clears out mouse highlighting. */ - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) && (f == 0 - || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) + || !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 defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS @@ -6514,12 +6515,12 @@ f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); 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. @@ -6552,10 +6553,10 @@ else f = x_window_to_frame (dpyinfo, event.xmotion.window); - 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); } #ifdef USE_GTK @@ -6610,7 +6611,7 @@ /* 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 @@ -9304,6 +9305,7 @@ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object bar; struct scroll_bar *b; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; BLOCK_INPUT; @@ -9397,15 +9399,15 @@ if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->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; + if (f == hlinfo->mouse_face_mouse_frame) + { + 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; @@ -9782,6 +9784,7 @@ struct terminal *terminal; struct x_display_info *dpyinfo; XrmDatabase xrdb; + Mouse_HLInfo *hlinfo; BLOCK_INPUT; @@ -9912,6 +9915,7 @@ dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); memset (dpyinfo, 0, sizeof *dpyinfo); + hlinfo = &dpyinfo->mouse_highlight; terminal = x_create_terminal (dpyinfo); @@ -10034,16 +10038,16 @@ dpyinfo->bitmaps_size = 0; dpyinfo->bitmaps_last = 0; dpyinfo->scratch_cursor_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; - 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 = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 0; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_mouse_frame = 0; + 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 = Qnil; + hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; + hlinfo->mouse_face_defer = 0; + hlinfo->mouse_face_hidden = 0; dpyinfo->x_focus_frame = 0; dpyinfo->x_focus_event_frame = 0; dpyinfo->x_highlight_frame = 0;