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)
......
This diff is collapsed.
This diff is collapsed.
......@@ -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;
/* 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 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
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 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
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 @@ static void
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 @@ XTframe_up_to_date (struct frame *f)
{
if (FRAME_X_P (f))
{
struct x_display_info *dpyinfo = FRAME_X_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;
}
}
......@@ -970,7 +970,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_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 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
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 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
/* 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 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
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 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
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 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
/* 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 @@ x_free_frame_resources (struct frame *f)
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 @@ 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;
......@@ -9782,6 +9784,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
struct terminal *terminal;
struct x_display_info *dpyinfo;
XrmDatabase xrdb;
Mouse_HLInfo *hlinfo;
BLOCK_INPUT;
......@@ -9912,6 +9915,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
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 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment