diff options
| author | Eli Zaretskii | 2010-10-31 20:50:02 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2010-10-31 20:50:02 +0200 |
| commit | 7ea692f66f4367755bb9e80991182ac55c90ead2 (patch) | |
| tree | b645d2ee172a015658b54f2ad245c924ad40e180 /src | |
| parent | d009ae66b405e38113c1ed29ff50832e5eec2b29 (diff) | |
| download | emacs-7ea692f66f4367755bb9e80991182ac55c90ead2.tar.gz emacs-7ea692f66f4367755bb9e80991182ac55c90ead2.zip | |
Start redesigning portable mouse highlight. Not compiled.
xdisp.c (get_tool_bar_item, handle_tool_bar_click)
(note_tool_bar_highlight, draw_glyphs, erase_phys_cursor)
(show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(x_clear_window_mouse_face, cancel_mouse_face, expose_frame):
Replace Display_Info with Mouse_HLInfo everywhere where
mouse_face_* members were accessed for mouse highlight purposes.
frame.h (MOUSE_HL_INFO): New macro.
lisp.h (Mouse_HLInfo): New data type.
xterm.h (struct x_display_info):
w32term.h (struct w32_display_info):
nsterm.h (struct ns_display_info):
termchar.h (struct tty_display_info): Use it instead of
mouse_face_* members.
dispextern.h (DPYINFO_DEFINED): Remove definition.
(FRAME_X_DISPLAY_INFO): Remove definition.
(show_mouse_face, clear_mouse_face): Update type of 1st argument.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 24 | ||||
| -rw-r--r-- | src/dispextern.h | 25 | ||||
| -rw-r--r-- | src/frame.h | 8 | ||||
| -rw-r--r-- | src/lisp.h | 35 | ||||
| -rw-r--r-- | src/nsterm.h | 18 | ||||
| -rw-r--r-- | src/termchar.h | 31 | ||||
| -rw-r--r-- | src/w32term.h | 33 | ||||
| -rw-r--r-- | src/xdisp.c | 386 | ||||
| -rw-r--r-- | src/xterm.h | 33 |
9 files changed, 284 insertions, 309 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3dacd9a5e63..ed77cbd91e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2010-10-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (get_tool_bar_item, handle_tool_bar_click) | ||
| 4 | (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) | ||
| 5 | (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) | ||
| 6 | (note_mode_line_or_margin_highlight, note_mouse_highlight) | ||
| 7 | (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): | ||
| 8 | Replace Display_Info with Mouse_HLInfo everywhere where | ||
| 9 | mouse_face_* members were accessed for mouse highlight purposes. | ||
| 10 | |||
| 11 | * frame.h (MOUSE_HL_INFO): New macro. | ||
| 12 | |||
| 13 | * lisp.h (Mouse_HLInfo): New data type. | ||
| 14 | |||
| 15 | * xterm.h (struct x_display_info): | ||
| 16 | * w32term.h (struct w32_display_info): | ||
| 17 | * nsterm.h (struct ns_display_info): | ||
| 18 | * termchar.h (struct tty_display_info): Use it instead of | ||
| 19 | mouse_face_* members. | ||
| 20 | |||
| 21 | * dispextern.h (DPYINFO_DEFINED): Remove definition. | ||
| 22 | (FRAME_X_DISPLAY_INFO): Remove definition. | ||
| 23 | (show_mouse_face, clear_mouse_face): Update type of 1st argument. | ||
| 24 | |||
| 1 | 2010-10-30 Eli Zaretskii <eliz@gnu.org> | 25 | 2010-10-30 Eli Zaretskii <eliz@gnu.org> |
| 2 | 26 | ||
| 3 | * xdisp.c (coords_in_mouse_face_p): Move prototype out of the | 27 | * xdisp.c (coords_in_mouse_face_p): Move prototype out of the |
diff --git a/src/dispextern.h b/src/dispextern.h index c9006c8e57e..37ab2b4c9b6 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -43,9 +43,12 @@ typedef struct { | |||
| 43 | 43 | ||
| 44 | #endif /* HAVE_X_WINDOWS */ | 44 | #endif /* HAVE_X_WINDOWS */ |
| 45 | 45 | ||
| 46 | #ifdef MSDOS | ||
| 47 | #include "msdos.h" | ||
| 48 | #endif | ||
| 49 | |||
| 46 | #ifdef HAVE_X_WINDOWS | 50 | #ifdef HAVE_X_WINDOWS |
| 47 | typedef struct x_display_info Display_Info; | 51 | typedef struct x_display_info Display_Info; |
| 48 | #define DPYINFO_DEFINED 1 | ||
| 49 | typedef XImage * XImagePtr; | 52 | typedef XImage * XImagePtr; |
| 50 | typedef XImagePtr XImagePtr_or_DC; | 53 | typedef XImagePtr XImagePtr_or_DC; |
| 51 | #define NativeRectangle XRectangle | 54 | #define NativeRectangle XRectangle |
| @@ -54,7 +57,6 @@ typedef XImagePtr XImagePtr_or_DC; | |||
| 54 | #ifdef HAVE_NTGUI | 57 | #ifdef HAVE_NTGUI |
| 55 | #include "w32gui.h" | 58 | #include "w32gui.h" |
| 56 | typedef struct w32_display_info Display_Info; | 59 | typedef struct w32_display_info Display_Info; |
| 57 | #define DPYINFO_DEFINED 1 | ||
| 58 | typedef XImage *XImagePtr; | 60 | typedef XImage *XImagePtr; |
| 59 | typedef HDC XImagePtr_or_DC; | 61 | typedef HDC XImagePtr_or_DC; |
| 60 | #endif | 62 | #endif |
| @@ -63,32 +65,15 @@ typedef HDC XImagePtr_or_DC; | |||
| 63 | #include "nsgui.h" | 65 | #include "nsgui.h" |
| 64 | /* following typedef needed to accomodate the MSDOS port, believe it or not */ | 66 | /* following typedef needed to accomodate the MSDOS port, believe it or not */ |
| 65 | typedef struct ns_display_info Display_Info; | 67 | typedef struct ns_display_info Display_Info; |
| 66 | #define DPYINFO_DEFINED 1 | ||
| 67 | typedef Pixmap XImagePtr; | 68 | typedef Pixmap XImagePtr; |
| 68 | typedef XImagePtr XImagePtr_or_DC; | 69 | typedef XImagePtr XImagePtr_or_DC; |
| 69 | #endif | 70 | #endif |
| 70 | 71 | ||
| 71 | #ifndef DPYINFO_DEFINED | 72 | #ifndef HAVE_WINDOW_SYSTEM |
| 72 | typedef struct tty_display_info Display_Info; | ||
| 73 | typedef int Cursor; | 73 | typedef int Cursor; |
| 74 | #define No_Cursor (0) | 74 | #define No_Cursor (0) |
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | #undef DPYINFO_DEFINED | ||
| 78 | |||
| 79 | #ifdef MSDOS | ||
| 80 | /* This defines FRAME_X_DISPLAY_INFO for MSDOS. */ | ||
| 81 | #include "msdos.h" | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifdef HAVE_GPM | ||
| 85 | #define FRAME_X_DISPLAY_INFO(f) gpm_tty | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #ifndef FRAME_X_DISPLAY_INFO | ||
| 89 | #define FRAME_X_DISPLAY_INFO(f) NULL | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef NativeRectangle | 77 | #ifndef NativeRectangle |
| 93 | #define NativeRectangle int | 78 | #define NativeRectangle int |
| 94 | #endif | 79 | #endif |
diff --git a/src/frame.h b/src/frame.h index e66fd9341c7..00c062cfd36 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -544,6 +544,14 @@ typedef struct frame *FRAME_PTR; | |||
| 544 | #define FRAME_WINDOW_P(f) (0) | 544 | #define FRAME_WINDOW_P(f) (0) |
| 545 | #endif | 545 | #endif |
| 546 | 546 | ||
| 547 | /* Return a pointer to the structure holding information about the | ||
| 548 | region of text, if any, that is currently shown in mouse-face on | ||
| 549 | frame F. */ | ||
| 550 | #define MOUSE_HL_INFO(F) \ | ||
| 551 | (FRAME_WINDOW_P(F) \ | ||
| 552 | ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ | ||
| 553 | : &(((F)->output_data.tty)->mouse_highlight)) | ||
| 554 | |||
| 547 | /* Nonzero if frame F is still alive (not deleted). */ | 555 | /* Nonzero if frame F is still alive (not deleted). */ |
| 548 | #define FRAME_LIVE_P(f) ((f)->terminal != 0) | 556 | #define FRAME_LIVE_P(f) ((f)->terminal != 0) |
| 549 | 557 | ||
diff --git a/src/lisp.h b/src/lisp.h index c9104f88954..4adf9ef9c69 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1563,6 +1563,41 @@ typedef struct { | |||
| 1563 | /* The ID of the mode line highlighting face. */ | 1563 | /* The ID of the mode line highlighting face. */ |
| 1564 | #define GLYPH_MODE_LINE_FACE 1 | 1564 | #define GLYPH_MODE_LINE_FACE 1 |
| 1565 | 1565 | ||
| 1566 | /* Structure to hold mouse highlight data. This is here because other | ||
| 1567 | header files need it for defining struct x_output etc. */ | ||
| 1568 | typedef struct { | ||
| 1569 | /* These variables describe the range of text currently shown in its | ||
| 1570 | mouse-face, together with the window they apply to. As long as | ||
| 1571 | the mouse stays within this range, we need not redraw anything on | ||
| 1572 | its account. Rows and columns are glyph matrix positions in | ||
| 1573 | MOUSE_FACE_WINDOW. */ | ||
| 1574 | int mouse_face_beg_row, mouse_face_beg_col; | ||
| 1575 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 1576 | int mouse_face_end_row, mouse_face_end_col; | ||
| 1577 | int mouse_face_end_x, mouse_face_end_y; | ||
| 1578 | int mouse_face_past_end; | ||
| 1579 | Lisp_Object mouse_face_window; | ||
| 1580 | int mouse_face_face_id; | ||
| 1581 | Lisp_Object mouse_face_overlay; | ||
| 1582 | |||
| 1583 | /* 1 if a mouse motion event came and we didn't handle it right away because | ||
| 1584 | gc was in progress. */ | ||
| 1585 | int mouse_face_deferred_gc; | ||
| 1586 | |||
| 1587 | /* FRAME and X, Y position of mouse when last checked for | ||
| 1588 | highlighting. X and Y can be negative or out of range for the frame. */ | ||
| 1589 | struct frame *mouse_face_mouse_frame; | ||
| 1590 | int mouse_face_mouse_x, mouse_face_mouse_y; | ||
| 1591 | |||
| 1592 | /* Nonzero means defer mouse-motion highlighting. */ | ||
| 1593 | int mouse_face_defer; | ||
| 1594 | |||
| 1595 | /* Nonzero means that the mouse highlight should not be shown. */ | ||
| 1596 | int mouse_face_hidden; | ||
| 1597 | |||
| 1598 | int mouse_face_image_state; | ||
| 1599 | } Mouse_HLInfo; | ||
| 1600 | |||
| 1566 | /* Data type checking */ | 1601 | /* Data type checking */ |
| 1567 | 1602 | ||
| 1568 | #define NILP(x) EQ (x, Qnil) | 1603 | #define NILP(x) EQ (x, Qnil) |
diff --git a/src/nsterm.h b/src/nsterm.h index 21b18f15cae..7ee960bd7a6 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -492,21 +492,9 @@ struct ns_display_info | |||
| 492 | /* The cursor to use for vertical scroll bars. */ | 492 | /* The cursor to use for vertical scroll bars. */ |
| 493 | Cursor vertical_scroll_bar_cursor; | 493 | Cursor vertical_scroll_bar_cursor; |
| 494 | 494 | ||
| 495 | /* most mouse face stuff moved in here as of 21+ (and reasonably so) */ | 495 | /* Information about the range of text currently shown in |
| 496 | int mouse_face_beg_row, mouse_face_beg_col; | 496 | mouse-face. */ |
| 497 | int mouse_face_end_row, mouse_face_end_col; | 497 | Mouse_HLInfo mouse_highlight; |
| 498 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 499 | int mouse_face_end_x, mouse_face_end_y; | ||
| 500 | int mouse_face_past_end; | ||
| 501 | Lisp_Object mouse_face_window; | ||
| 502 | int mouse_face_face_id; | ||
| 503 | int mouse_face_deferred_gc; | ||
| 504 | Lisp_Object mouse_face_overlay; | ||
| 505 | FRAME_PTR mouse_face_mouse_frame; | ||
| 506 | int mouse_face_mouse_x, mouse_face_mouse_y; | ||
| 507 | int mouse_face_defer; | ||
| 508 | int mouse_face_hidden; | ||
| 509 | int mouse_face_image_state; | ||
| 510 | 498 | ||
| 511 | struct frame *x_highlight_frame; | 499 | struct frame *x_highlight_frame; |
| 512 | struct frame *x_focus_frame; | 500 | struct frame *x_focus_frame; |
diff --git a/src/termchar.h b/src/termchar.h index 1b4cd0891da..ac652640b17 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -70,34 +70,9 @@ struct tty_display_info | |||
| 70 | struct frame *previous_frame; | 70 | struct frame *previous_frame; |
| 71 | int previous_color_mode; | 71 | int previous_color_mode; |
| 72 | 72 | ||
| 73 | /* These variables describe the range of text currently shown in its | 73 | /* Information about the range of text currently shown in |
| 74 | mouse-face, together with the window they apply to. As long as | 74 | mouse-face. */ |
| 75 | the mouse stays within this range, we need not redraw anything on | 75 | Mouse_HLInfo mouse_highlight; |
| 76 | its account. Rows and columns are glyph matrix positions in | ||
| 77 | MOUSE_FACE_WINDOW. */ | ||
| 78 | int mouse_face_beg_row, mouse_face_beg_col; | ||
| 79 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 80 | int mouse_face_end_row, mouse_face_end_col; | ||
| 81 | int mouse_face_end_x, mouse_face_end_y; | ||
| 82 | int mouse_face_past_end; | ||
| 83 | Lisp_Object mouse_face_window; | ||
| 84 | int mouse_face_face_id; | ||
| 85 | Lisp_Object mouse_face_overlay; | ||
| 86 | |||
| 87 | /* 1 if a mouse motion event came and we didn't handle it right away because | ||
| 88 | gc was in progress. */ | ||
| 89 | int mouse_face_deferred_gc; | ||
| 90 | |||
| 91 | /* FRAME and X, Y position of mouse when last checked for | ||
| 92 | highlighting. X and Y can be negative or out of range for the frame. */ | ||
| 93 | struct frame *mouse_face_mouse_frame; | ||
| 94 | int mouse_face_mouse_x, mouse_face_mouse_y; | ||
| 95 | |||
| 96 | /* Nonzero means defer mouse-motion highlighting. */ | ||
| 97 | int mouse_face_defer; | ||
| 98 | |||
| 99 | /* Nonzero means that the mouse highlight should not be shown. */ | ||
| 100 | int mouse_face_hidden; | ||
| 101 | 76 | ||
| 102 | /* Buffer used internally by termcap (see tgetent in the Termcap | 77 | /* Buffer used internally by termcap (see tgetent in the Termcap |
| 103 | manual). Only init_tty and delete_tty should change this. */ | 78 | manual). Only init_tty and delete_tty should change this. */ |
diff --git a/src/w32term.h b/src/w32term.h index ea245144ac3..bd535cae57a 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -143,36 +143,9 @@ struct w32_display_info | |||
| 143 | /* Reusable Graphics Context for drawing a cursor in a non-default face. */ | 143 | /* Reusable Graphics Context for drawing a cursor in a non-default face. */ |
| 144 | XGCValues *scratch_cursor_gc; | 144 | XGCValues *scratch_cursor_gc; |
| 145 | 145 | ||
| 146 | /* These variables describe the range of text currently shown in its | 146 | /* Information about the range of text currently shown in |
| 147 | mouse-face, together with the window they apply to. As long as | 147 | mouse-face. */ |
| 148 | the mouse stays within this range, we need not redraw anything on | 148 | Mouse_HLInfo mouse_highlight; |
| 149 | its account. Rows and columns are glyph matrix positions in | ||
| 150 | MOUSE_FACE_WINDOW. */ | ||
| 151 | int mouse_face_beg_row, mouse_face_beg_col; | ||
| 152 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 153 | int mouse_face_end_row, mouse_face_end_col; | ||
| 154 | int mouse_face_end_x, mouse_face_end_y; | ||
| 155 | int mouse_face_past_end; | ||
| 156 | Lisp_Object mouse_face_window; | ||
| 157 | int mouse_face_face_id; | ||
| 158 | Lisp_Object mouse_face_overlay; | ||
| 159 | |||
| 160 | /* 1 if a mouse motion event came and we didn't handle it right away because | ||
| 161 | gc was in progress. */ | ||
| 162 | int mouse_face_deferred_gc; | ||
| 163 | |||
| 164 | /* FRAME and X, Y position of mouse when last checked for | ||
| 165 | highlighting. X and Y can be negative or out of range for the frame. */ | ||
| 166 | struct frame *mouse_face_mouse_frame; | ||
| 167 | int mouse_face_mouse_x, mouse_face_mouse_y; | ||
| 168 | |||
| 169 | /* Nonzero means defer mouse-motion highlighting. */ | ||
| 170 | int mouse_face_defer; | ||
| 171 | |||
| 172 | /* Nonzero means that the mouse highlight should not be shown. */ | ||
| 173 | int mouse_face_hidden; | ||
| 174 | |||
| 175 | int mouse_face_image_state; | ||
| 176 | 149 | ||
| 177 | char *w32_id_name; | 150 | char *w32_id_name; |
| 178 | 151 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 6339bb900af..97c2caeaeb7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10738,7 +10738,7 @@ static int | |||
| 10738 | get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, | 10738 | get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, |
| 10739 | int *hpos, int *vpos, int *prop_idx) | 10739 | int *hpos, int *vpos, int *prop_idx) |
| 10740 | { | 10740 | { |
| 10741 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 10741 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 10742 | struct window *w = XWINDOW (f->tool_bar_window); | 10742 | struct window *w = XWINDOW (f->tool_bar_window); |
| 10743 | int area; | 10743 | int area; |
| 10744 | 10744 | ||
| @@ -10753,14 +10753,14 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, | |||
| 10753 | return -1; | 10753 | return -1; |
| 10754 | 10754 | ||
| 10755 | /* Is mouse on the highlighted item? */ | 10755 | /* Is mouse on the highlighted item? */ |
| 10756 | if (EQ (f->tool_bar_window, dpyinfo->mouse_face_window) | 10756 | if (EQ (f->tool_bar_window, hlinfo->mouse_face_window) |
| 10757 | && *vpos >= dpyinfo->mouse_face_beg_row | 10757 | && *vpos >= hlinfo->mouse_face_beg_row |
| 10758 | && *vpos <= dpyinfo->mouse_face_end_row | 10758 | && *vpos <= hlinfo->mouse_face_end_row |
| 10759 | && (*vpos > dpyinfo->mouse_face_beg_row | 10759 | && (*vpos > hlinfo->mouse_face_beg_row |
| 10760 | || *hpos >= dpyinfo->mouse_face_beg_col) | 10760 | || *hpos >= hlinfo->mouse_face_beg_col) |
| 10761 | && (*vpos < dpyinfo->mouse_face_end_row | 10761 | && (*vpos < hlinfo->mouse_face_end_row |
| 10762 | || *hpos < dpyinfo->mouse_face_end_col | 10762 | || *hpos < hlinfo->mouse_face_end_col |
| 10763 | || dpyinfo->mouse_face_past_end)) | 10763 | || hlinfo->mouse_face_past_end)) |
| 10764 | return 0; | 10764 | return 0; |
| 10765 | 10765 | ||
| 10766 | return 1; | 10766 | return 1; |
| @@ -10777,7 +10777,7 @@ void | |||
| 10777 | handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | 10777 | handle_tool_bar_click (struct frame *f, int x, int y, int down_p, |
| 10778 | unsigned int modifiers) | 10778 | unsigned int modifiers) |
| 10779 | { | 10779 | { |
| 10780 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 10780 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 10781 | struct window *w = XWINDOW (f->tool_bar_window); | 10781 | struct window *w = XWINDOW (f->tool_bar_window); |
| 10782 | int hpos, vpos, prop_idx; | 10782 | int hpos, vpos, prop_idx; |
| 10783 | struct glyph *glyph; | 10783 | struct glyph *glyph; |
| @@ -10796,8 +10796,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 10796 | if (down_p) | 10796 | if (down_p) |
| 10797 | { | 10797 | { |
| 10798 | /* Show item in pressed state. */ | 10798 | /* Show item in pressed state. */ |
| 10799 | show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); | 10799 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); |
| 10800 | dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; | 10800 | hlinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; |
| 10801 | last_tool_bar_item = prop_idx; | 10801 | last_tool_bar_item = prop_idx; |
| 10802 | } | 10802 | } |
| 10803 | else | 10803 | else |
| @@ -10807,8 +10807,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 10807 | EVENT_INIT (event); | 10807 | EVENT_INIT (event); |
| 10808 | 10808 | ||
| 10809 | /* Show item in released state. */ | 10809 | /* Show item in released state. */ |
| 10810 | show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); | 10810 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); |
| 10811 | dpyinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; | 10811 | hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; |
| 10812 | 10812 | ||
| 10813 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); | 10813 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); |
| 10814 | 10814 | ||
| @@ -10838,6 +10838,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10838 | Lisp_Object window = f->tool_bar_window; | 10838 | Lisp_Object window = f->tool_bar_window; |
| 10839 | struct window *w = XWINDOW (window); | 10839 | struct window *w = XWINDOW (window); |
| 10840 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 10840 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 10841 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 10841 | int hpos, vpos; | 10842 | int hpos, vpos; |
| 10842 | struct glyph *glyph; | 10843 | struct glyph *glyph; |
| 10843 | struct glyph_row *row; | 10844 | struct glyph_row *row; |
| @@ -10851,7 +10852,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10851 | values when mouse moves outside of the frame. */ | 10852 | values when mouse moves outside of the frame. */ |
| 10852 | if (x <= 0 || y <= 0) | 10853 | if (x <= 0 || y <= 0) |
| 10853 | { | 10854 | { |
| 10854 | clear_mouse_face (dpyinfo); | 10855 | clear_mouse_face (hlinfo); |
| 10855 | return; | 10856 | return; |
| 10856 | } | 10857 | } |
| 10857 | 10858 | ||
| @@ -10859,14 +10860,14 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10859 | if (rc < 0) | 10860 | if (rc < 0) |
| 10860 | { | 10861 | { |
| 10861 | /* Not on tool-bar item. */ | 10862 | /* Not on tool-bar item. */ |
| 10862 | clear_mouse_face (dpyinfo); | 10863 | clear_mouse_face (hlinfo); |
| 10863 | return; | 10864 | return; |
| 10864 | } | 10865 | } |
| 10865 | else if (rc == 0) | 10866 | else if (rc == 0) |
| 10866 | /* On same tool-bar item as before. */ | 10867 | /* On same tool-bar item as before. */ |
| 10867 | goto set_help_echo; | 10868 | goto set_help_echo; |
| 10868 | 10869 | ||
| 10869 | clear_mouse_face (dpyinfo); | 10870 | clear_mouse_face (hlinfo); |
| 10870 | 10871 | ||
| 10871 | /* Mouse is down, but on different tool-bar item? */ | 10872 | /* Mouse is down, but on different tool-bar item? */ |
| 10872 | mouse_down_p = (dpyinfo->grabbed | 10873 | mouse_down_p = (dpyinfo->grabbed |
| @@ -10876,7 +10877,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10876 | && last_tool_bar_item != prop_idx) | 10877 | && last_tool_bar_item != prop_idx) |
| 10877 | return; | 10878 | return; |
| 10878 | 10879 | ||
| 10879 | dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; | 10880 | hlinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; |
| 10880 | draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; | 10881 | draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; |
| 10881 | 10882 | ||
| 10882 | /* If tool-bar item is not enabled, don't highlight it. */ | 10883 | /* If tool-bar item is not enabled, don't highlight it. */ |
| @@ -10890,22 +10891,22 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10890 | x += row->glyphs[TEXT_AREA][i].pixel_width; | 10891 | x += row->glyphs[TEXT_AREA][i].pixel_width; |
| 10891 | 10892 | ||
| 10892 | /* Record this as the current active region. */ | 10893 | /* Record this as the current active region. */ |
| 10893 | dpyinfo->mouse_face_beg_col = hpos; | 10894 | hlinfo->mouse_face_beg_col = hpos; |
| 10894 | dpyinfo->mouse_face_beg_row = vpos; | 10895 | hlinfo->mouse_face_beg_row = vpos; |
| 10895 | dpyinfo->mouse_face_beg_x = x; | 10896 | hlinfo->mouse_face_beg_x = x; |
| 10896 | dpyinfo->mouse_face_beg_y = row->y; | 10897 | hlinfo->mouse_face_beg_y = row->y; |
| 10897 | dpyinfo->mouse_face_past_end = 0; | 10898 | hlinfo->mouse_face_past_end = 0; |
| 10898 | 10899 | ||
| 10899 | dpyinfo->mouse_face_end_col = hpos + 1; | 10900 | hlinfo->mouse_face_end_col = hpos + 1; |
| 10900 | dpyinfo->mouse_face_end_row = vpos; | 10901 | hlinfo->mouse_face_end_row = vpos; |
| 10901 | dpyinfo->mouse_face_end_x = x + glyph->pixel_width; | 10902 | hlinfo->mouse_face_end_x = x + glyph->pixel_width; |
| 10902 | dpyinfo->mouse_face_end_y = row->y; | 10903 | hlinfo->mouse_face_end_y = row->y; |
| 10903 | dpyinfo->mouse_face_window = window; | 10904 | hlinfo->mouse_face_window = window; |
| 10904 | dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; | 10905 | hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; |
| 10905 | 10906 | ||
| 10906 | /* Display it as active. */ | 10907 | /* Display it as active. */ |
| 10907 | show_mouse_face (dpyinfo, draw); | 10908 | show_mouse_face (hlinfo, draw); |
| 10908 | dpyinfo->mouse_face_image_state = draw; | 10909 | hlinfo->mouse_face_image_state = draw; |
| 10909 | } | 10910 | } |
| 10910 | 10911 | ||
| 10911 | set_help_echo: | 10912 | set_help_echo: |
| @@ -21300,7 +21301,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, | |||
| 21300 | if (head && !overlaps && row->contains_overlapping_glyphs_p) | 21301 | if (head && !overlaps && row->contains_overlapping_glyphs_p) |
| 21301 | { | 21302 | { |
| 21302 | struct glyph_string *h, *t; | 21303 | struct glyph_string *h, *t; |
| 21303 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 21304 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 21304 | int mouse_beg_col, mouse_end_col, check_mouse_face = 0; | 21305 | int mouse_beg_col, mouse_end_col, check_mouse_face = 0; |
| 21305 | int dummy_x = 0; | 21306 | int dummy_x = 0; |
| 21306 | 21307 | ||
| @@ -21310,16 +21311,16 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, | |||
| 21310 | { | 21311 | { |
| 21311 | struct glyph_row *mouse_beg_row, *mouse_end_row; | 21312 | struct glyph_row *mouse_beg_row, *mouse_end_row; |
| 21312 | 21313 | ||
| 21313 | mouse_beg_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); | 21314 | mouse_beg_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); |
| 21314 | mouse_end_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); | 21315 | mouse_end_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); |
| 21315 | 21316 | ||
| 21316 | if (row >= mouse_beg_row && row <= mouse_end_row) | 21317 | if (row >= mouse_beg_row && row <= mouse_end_row) |
| 21317 | { | 21318 | { |
| 21318 | check_mouse_face = 1; | 21319 | check_mouse_face = 1; |
| 21319 | mouse_beg_col = (row == mouse_beg_row) | 21320 | mouse_beg_col = (row == mouse_beg_row) |
| 21320 | ? dpyinfo->mouse_face_beg_col : 0; | 21321 | ? hlinfo->mouse_face_beg_col : 0; |
| 21321 | mouse_end_col = (row == mouse_end_row) | 21322 | mouse_end_col = (row == mouse_end_row) |
| 21322 | ? dpyinfo->mouse_face_end_col | 21323 | ? hlinfo->mouse_face_end_col |
| 21323 | : row->used[TEXT_AREA]; | 21324 | : row->used[TEXT_AREA]; |
| 21324 | } | 21325 | } |
| 21325 | } | 21326 | } |
| @@ -23363,7 +23364,7 @@ void | |||
| 23363 | erase_phys_cursor (struct window *w) | 23364 | erase_phys_cursor (struct window *w) |
| 23364 | { | 23365 | { |
| 23365 | struct frame *f = XFRAME (w->frame); | 23366 | struct frame *f = XFRAME (w->frame); |
| 23366 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 23367 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 23367 | int hpos = w->phys_cursor.hpos; | 23368 | int hpos = w->phys_cursor.hpos; |
| 23368 | int vpos = w->phys_cursor.vpos; | 23369 | int vpos = w->phys_cursor.vpos; |
| 23369 | int mouse_face_here_p = 0; | 23370 | int mouse_face_here_p = 0; |
| @@ -23419,7 +23420,7 @@ erase_phys_cursor (struct window *w) | |||
| 23419 | 23420 | ||
| 23420 | /* If the cursor is in the mouse face area, redisplay that when | 23421 | /* If the cursor is in the mouse face area, redisplay that when |
| 23421 | we clear the cursor. */ | 23422 | we clear the cursor. */ |
| 23422 | if (! NILP (dpyinfo->mouse_face_window) | 23423 | if (! NILP (hlinfo->mouse_face_window) |
| 23423 | && coords_in_mouse_face_p (w, hpos, vpos) | 23424 | && coords_in_mouse_face_p (w, hpos, vpos) |
| 23424 | /* Don't redraw the cursor's spot in mouse face if it is at the | 23425 | /* Don't redraw the cursor's spot in mouse face if it is at the |
| 23425 | end of a line (on a newline). The cursor appears there, but | 23426 | end of a line (on a newline). The cursor appears there, but |
| @@ -23611,40 +23612,52 @@ x_clear_cursor (struct window *w) | |||
| 23611 | update_window_cursor (w, 0); | 23612 | update_window_cursor (w, 0); |
| 23612 | } | 23613 | } |
| 23613 | 23614 | ||
| 23615 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 23616 | |||
| 23617 | /* Implementation of draw_row_with_mouse_face for GUI sessions and | ||
| 23618 | GPM. MSDOS has its own implementation on msdos.c. */ | ||
| 23619 | #ifndef MSDOS | ||
| 23614 | void | 23620 | void |
| 23615 | draw_row_with_mouse_face (struct frame *w, int start_x, struct glyph_row *row, | 23621 | draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, |
| 23616 | int start_hpos, int end_hpos, | 23622 | int start_hpos, int end_hpos, |
| 23617 | enum draw_glyphs_face draw) | 23623 | enum draw_glyphs_face draw) |
| 23618 | { | 23624 | { |
| 23619 | draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); | 23625 | #ifdef HAVE_WINDOW_SYSTEM |
| 23626 | if (FRAME_WINDOW_P (XFRAME (w->frame))) | ||
| 23627 | { | ||
| 23628 | draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); | ||
| 23629 | return; | ||
| 23630 | } | ||
| 23631 | #endif | ||
| 23632 | #ifdef HAVE_GPM | ||
| 23633 | tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); | ||
| 23634 | #endif | ||
| 23620 | } | 23635 | } |
| 23621 | 23636 | #endif /* not MSDOS */ | |
| 23622 | |||
| 23623 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 23624 | 23637 | ||
| 23625 | /* EXPORT: | 23638 | /* EXPORT: |
| 23626 | Display the active region described by mouse_face_* according to DRAW. */ | 23639 | Display the active region described by mouse_face_* according to DRAW. */ |
| 23627 | 23640 | ||
| 23628 | void | 23641 | void |
| 23629 | show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | 23642 | show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) |
| 23630 | { | 23643 | { |
| 23631 | struct window *w = XWINDOW (dpyinfo->mouse_face_window); | 23644 | struct window *w = XWINDOW (hlinfo->mouse_face_window); |
| 23632 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 23645 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 23633 | 23646 | ||
| 23634 | if (/* If window is in the process of being destroyed, don't bother | 23647 | if (/* If window is in the process of being destroyed, don't bother |
| 23635 | to do anything. */ | 23648 | to do anything. */ |
| 23636 | w->current_matrix != NULL | 23649 | w->current_matrix != NULL |
| 23637 | /* Don't update mouse highlight if hidden */ | 23650 | /* Don't update mouse highlight if hidden */ |
| 23638 | && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) | 23651 | && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden) |
| 23639 | /* Recognize when we are called to operate on rows that don't exist | 23652 | /* Recognize when we are called to operate on rows that don't exist |
| 23640 | anymore. This can happen when a window is split. */ | 23653 | anymore. This can happen when a window is split. */ |
| 23641 | && dpyinfo->mouse_face_end_row < w->current_matrix->nrows) | 23654 | && hlinfo->mouse_face_end_row < w->current_matrix->nrows) |
| 23642 | { | 23655 | { |
| 23643 | int phys_cursor_on_p = w->phys_cursor_on_p; | 23656 | int phys_cursor_on_p = w->phys_cursor_on_p; |
| 23644 | struct glyph_row *row, *first, *last; | 23657 | struct glyph_row *row, *first, *last; |
| 23645 | 23658 | ||
| 23646 | first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); | 23659 | first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); |
| 23647 | last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); | 23660 | last = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); |
| 23648 | 23661 | ||
| 23649 | for (row = first; row <= last && row->enabled_p; ++row) | 23662 | for (row = first; row <= last && row->enabled_p; ++row) |
| 23650 | { | 23663 | { |
| @@ -23659,13 +23672,13 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23659 | highlighted area in R2L rows. */ | 23672 | highlighted area in R2L rows. */ |
| 23660 | if (!row->reversed_p) | 23673 | if (!row->reversed_p) |
| 23661 | { | 23674 | { |
| 23662 | start_hpos = dpyinfo->mouse_face_beg_col; | 23675 | start_hpos = hlinfo->mouse_face_beg_col; |
| 23663 | start_x = dpyinfo->mouse_face_beg_x; | 23676 | start_x = hlinfo->mouse_face_beg_x; |
| 23664 | } | 23677 | } |
| 23665 | else if (row == last) | 23678 | else if (row == last) |
| 23666 | { | 23679 | { |
| 23667 | start_hpos = dpyinfo->mouse_face_end_col; | 23680 | start_hpos = hlinfo->mouse_face_end_col; |
| 23668 | start_x = dpyinfo->mouse_face_end_x; | 23681 | start_x = hlinfo->mouse_face_end_x; |
| 23669 | } | 23682 | } |
| 23670 | else | 23683 | else |
| 23671 | { | 23684 | { |
| @@ -23675,8 +23688,8 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23675 | } | 23688 | } |
| 23676 | else if (row->reversed_p && row == last) | 23689 | else if (row->reversed_p && row == last) |
| 23677 | { | 23690 | { |
| 23678 | start_hpos = dpyinfo->mouse_face_end_col; | 23691 | start_hpos = hlinfo->mouse_face_end_col; |
| 23679 | start_x = dpyinfo->mouse_face_end_x; | 23692 | start_x = hlinfo->mouse_face_end_x; |
| 23680 | } | 23693 | } |
| 23681 | else | 23694 | else |
| 23682 | { | 23695 | { |
| @@ -23687,9 +23700,9 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23687 | if (row == last) | 23700 | if (row == last) |
| 23688 | { | 23701 | { |
| 23689 | if (!row->reversed_p) | 23702 | if (!row->reversed_p) |
| 23690 | end_hpos = dpyinfo->mouse_face_end_col; | 23703 | end_hpos = hlinfo->mouse_face_end_col; |
| 23691 | else if (row == first) | 23704 | else if (row == first) |
| 23692 | end_hpos = dpyinfo->mouse_face_beg_col; | 23705 | end_hpos = hlinfo->mouse_face_beg_col; |
| 23693 | else | 23706 | else |
| 23694 | { | 23707 | { |
| 23695 | end_hpos = row->used[TEXT_AREA]; | 23708 | end_hpos = row->used[TEXT_AREA]; |
| @@ -23698,7 +23711,7 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23698 | } | 23711 | } |
| 23699 | } | 23712 | } |
| 23700 | else if (row->reversed_p && row == first) | 23713 | else if (row->reversed_p && row == first) |
| 23701 | end_hpos = dpyinfo->mouse_face_beg_col; | 23714 | end_hpos = hlinfo->mouse_face_beg_col; |
| 23702 | else | 23715 | else |
| 23703 | { | 23716 | { |
| 23704 | end_hpos = row->used[TEXT_AREA]; | 23717 | end_hpos = row->used[TEXT_AREA]; |
| @@ -23732,7 +23745,7 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23732 | 23745 | ||
| 23733 | #ifdef HAVE_WINDOW_SYSTEM | 23746 | #ifdef HAVE_WINDOW_SYSTEM |
| 23734 | /* Change the mouse cursor. */ | 23747 | /* Change the mouse cursor. */ |
| 23735 | if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) | 23748 | if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) |
| 23736 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); | 23749 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); |
| 23737 | else if (draw == DRAW_MOUSE_FACE) | 23750 | else if (draw == DRAW_MOUSE_FACE) |
| 23738 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); | 23751 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); |
| @@ -23748,20 +23761,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23748 | face was actually drawn unhighlighted. */ | 23761 | face was actually drawn unhighlighted. */ |
| 23749 | 23762 | ||
| 23750 | int | 23763 | int |
| 23751 | clear_mouse_face (Display_Info *dpyinfo) | 23764 | clear_mouse_face (Mouse_HLInfo *hlinfo) |
| 23752 | { | 23765 | { |
| 23753 | int cleared = 0; | 23766 | int cleared = 0; |
| 23754 | 23767 | ||
| 23755 | if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window)) | 23768 | if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window)) |
| 23756 | { | 23769 | { |
| 23757 | show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); | 23770 | show_mouse_face (hlinfo, DRAW_NORMAL_TEXT); |
| 23758 | cleared = 1; | 23771 | cleared = 1; |
| 23759 | } | 23772 | } |
| 23760 | 23773 | ||
| 23761 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | 23774 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
| 23762 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | 23775 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
| 23763 | dpyinfo->mouse_face_window = Qnil; | 23776 | hlinfo->mouse_face_window = Qnil; |
| 23764 | dpyinfo->mouse_face_overlay = Qnil; | 23777 | hlinfo->mouse_face_overlay = Qnil; |
| 23765 | return cleared; | 23778 | return cleared; |
| 23766 | } | 23779 | } |
| 23767 | 23780 | ||
| @@ -23770,43 +23783,43 @@ clear_mouse_face (Display_Info *dpyinfo) | |||
| 23770 | static int | 23783 | static int |
| 23771 | coords_in_mouse_face_p (struct window *w, int hpos, int vpos) | 23784 | coords_in_mouse_face_p (struct window *w, int hpos, int vpos) |
| 23772 | { | 23785 | { |
| 23773 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); | 23786 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); |
| 23774 | 23787 | ||
| 23775 | /* Quickly resolve the easy cases. */ | 23788 | /* Quickly resolve the easy cases. */ |
| 23776 | if (!(WINDOWP (dpyinfo->mouse_face_window) | 23789 | if (!(WINDOWP (hlinfo->mouse_face_window) |
| 23777 | && XWINDOW (dpyinfo->mouse_face_window) == w)) | 23790 | && XWINDOW (hlinfo->mouse_face_window) == w)) |
| 23778 | return 0; | 23791 | return 0; |
| 23779 | if (vpos < dpyinfo->mouse_face_beg_row | 23792 | if (vpos < hlinfo->mouse_face_beg_row |
| 23780 | || vpos > dpyinfo->mouse_face_end_row) | 23793 | || vpos > hlinfo->mouse_face_end_row) |
| 23781 | return 0; | 23794 | return 0; |
| 23782 | if (vpos > dpyinfo->mouse_face_beg_row | 23795 | if (vpos > hlinfo->mouse_face_beg_row |
| 23783 | && vpos < dpyinfo->mouse_face_end_row) | 23796 | && vpos < hlinfo->mouse_face_end_row) |
| 23784 | return 1; | 23797 | return 1; |
| 23785 | 23798 | ||
| 23786 | if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) | 23799 | if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) |
| 23787 | { | 23800 | { |
| 23788 | if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) | 23801 | if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) |
| 23789 | { | 23802 | { |
| 23790 | if (dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col) | 23803 | if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col) |
| 23791 | return 1; | 23804 | return 1; |
| 23792 | } | 23805 | } |
| 23793 | else if ((vpos == dpyinfo->mouse_face_beg_row | 23806 | else if ((vpos == hlinfo->mouse_face_beg_row |
| 23794 | && hpos >= dpyinfo->mouse_face_beg_col) | 23807 | && hpos >= hlinfo->mouse_face_beg_col) |
| 23795 | || (vpos == dpyinfo->mouse_face_end_row | 23808 | || (vpos == hlinfo->mouse_face_end_row |
| 23796 | && hpos < dpyinfo->mouse_face_end_col)) | 23809 | && hpos < hlinfo->mouse_face_end_col)) |
| 23797 | return 1; | 23810 | return 1; |
| 23798 | } | 23811 | } |
| 23799 | else | 23812 | else |
| 23800 | { | 23813 | { |
| 23801 | if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) | 23814 | if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) |
| 23802 | { | 23815 | { |
| 23803 | if (dpyinfo->mouse_face_end_col < hpos && hpos <= dpyinfo->mouse_face_beg_col) | 23816 | if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col) |
| 23804 | return 1; | 23817 | return 1; |
| 23805 | } | 23818 | } |
| 23806 | else if ((vpos == dpyinfo->mouse_face_beg_row | 23819 | else if ((vpos == hlinfo->mouse_face_beg_row |
| 23807 | && hpos <= dpyinfo->mouse_face_beg_col) | 23820 | && hpos <= hlinfo->mouse_face_beg_col) |
| 23808 | || (vpos == dpyinfo->mouse_face_end_row | 23821 | || (vpos == hlinfo->mouse_face_end_row |
| 23809 | && hpos > dpyinfo->mouse_face_end_col)) | 23822 | && hpos > hlinfo->mouse_face_end_col)) |
| 23810 | return 1; | 23823 | return 1; |
| 23811 | } | 23824 | } |
| 23812 | return 0; | 23825 | return 0; |
| @@ -23947,7 +23960,7 @@ rows_from_pos_range (struct window *w, | |||
| 23947 | } | 23960 | } |
| 23948 | } | 23961 | } |
| 23949 | 23962 | ||
| 23950 | /* This function sets the mouse_face_* elements of DPYINFO, assuming | 23963 | /* This function sets the mouse_face_* elements of HLINFO, assuming |
| 23951 | the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in | 23964 | the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in |
| 23952 | window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions | 23965 | window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions |
| 23953 | for the overlay or run of text properties specifying the mouse | 23966 | for the overlay or run of text properties specifying the mouse |
| @@ -23958,7 +23971,7 @@ rows_from_pos_range (struct window *w, | |||
| 23958 | 23971 | ||
| 23959 | static void | 23972 | static void |
| 23960 | mouse_face_from_buffer_pos (Lisp_Object window, | 23973 | mouse_face_from_buffer_pos (Lisp_Object window, |
| 23961 | Display_Info *dpyinfo, | 23974 | Mouse_HLInfo *hlinfo, |
| 23962 | EMACS_INT mouse_charpos, | 23975 | EMACS_INT mouse_charpos, |
| 23963 | EMACS_INT start_charpos, | 23976 | EMACS_INT start_charpos, |
| 23964 | EMACS_INT end_charpos, | 23977 | EMACS_INT end_charpos, |
| @@ -24003,7 +24016,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24003 | if (r2 == NULL) | 24016 | if (r2 == NULL) |
| 24004 | { | 24017 | { |
| 24005 | r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 24018 | r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); |
| 24006 | dpyinfo->mouse_face_past_end = 1; | 24019 | hlinfo->mouse_face_past_end = 1; |
| 24007 | } | 24020 | } |
| 24008 | else if (!NILP (after_string)) | 24021 | else if (!NILP (after_string)) |
| 24009 | { | 24022 | { |
| @@ -24032,10 +24045,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24032 | r1 = tem; | 24045 | r1 = tem; |
| 24033 | } | 24046 | } |
| 24034 | 24047 | ||
| 24035 | dpyinfo->mouse_face_beg_y = r1->y; | 24048 | hlinfo->mouse_face_beg_y = r1->y; |
| 24036 | dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); | 24049 | hlinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); |
| 24037 | dpyinfo->mouse_face_end_y = r2->y; | 24050 | hlinfo->mouse_face_end_y = r2->y; |
| 24038 | dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); | 24051 | hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); |
| 24039 | 24052 | ||
| 24040 | /* For a bidi-reordered row, the positions of BEFORE_STRING, | 24053 | /* For a bidi-reordered row, the positions of BEFORE_STRING, |
| 24041 | AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS | 24054 | AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS |
| @@ -24094,8 +24107,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24094 | } | 24107 | } |
| 24095 | x += glyph->pixel_width; | 24108 | x += glyph->pixel_width; |
| 24096 | } | 24109 | } |
| 24097 | dpyinfo->mouse_face_beg_x = x; | 24110 | hlinfo->mouse_face_beg_x = x; |
| 24098 | dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; | 24111 | hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; |
| 24099 | } | 24112 | } |
| 24100 | else | 24113 | else |
| 24101 | { | 24114 | { |
| @@ -24147,8 +24160,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24147 | glyph++; /* first glyph to the right of the highlighted area */ | 24160 | glyph++; /* first glyph to the right of the highlighted area */ |
| 24148 | for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++) | 24161 | for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++) |
| 24149 | x += g->pixel_width; | 24162 | x += g->pixel_width; |
| 24150 | dpyinfo->mouse_face_beg_x = x; | 24163 | hlinfo->mouse_face_beg_x = x; |
| 24151 | dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; | 24164 | hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; |
| 24152 | } | 24165 | } |
| 24153 | 24166 | ||
| 24154 | /* If the highlight ends in a different row, compute GLYPH and END | 24167 | /* If the highlight ends in a different row, compute GLYPH and END |
| @@ -24211,8 +24224,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24211 | for (; glyph <= end; ++glyph) | 24224 | for (; glyph <= end; ++glyph) |
| 24212 | x += glyph->pixel_width; | 24225 | x += glyph->pixel_width; |
| 24213 | 24226 | ||
| 24214 | dpyinfo->mouse_face_end_x = x; | 24227 | hlinfo->mouse_face_end_x = x; |
| 24215 | dpyinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; | 24228 | hlinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; |
| 24216 | } | 24229 | } |
| 24217 | else | 24230 | else |
| 24218 | { | 24231 | { |
| @@ -24258,16 +24271,16 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24258 | } | 24271 | } |
| 24259 | x += end->pixel_width; | 24272 | x += end->pixel_width; |
| 24260 | } | 24273 | } |
| 24261 | dpyinfo->mouse_face_end_x = x; | 24274 | hlinfo->mouse_face_end_x = x; |
| 24262 | dpyinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; | 24275 | hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; |
| 24263 | } | 24276 | } |
| 24264 | 24277 | ||
| 24265 | dpyinfo->mouse_face_window = window; | 24278 | hlinfo->mouse_face_window = window; |
| 24266 | dpyinfo->mouse_face_face_id | 24279 | hlinfo->mouse_face_face_id |
| 24267 | = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, | 24280 | = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, |
| 24268 | mouse_charpos + 1, | 24281 | mouse_charpos + 1, |
| 24269 | !dpyinfo->mouse_face_hidden, -1); | 24282 | !hlinfo->mouse_face_hidden, -1); |
| 24270 | show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); | 24283 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| 24271 | } | 24284 | } |
| 24272 | 24285 | ||
| 24273 | /* The following function is not used anymore (replaced with | 24286 | /* The following function is not used anymore (replaced with |
| @@ -24356,11 +24369,11 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, | |||
| 24356 | 24369 | ||
| 24357 | /* Find the positions of the first and the last glyphs in window W's | 24370 | /* Find the positions of the first and the last glyphs in window W's |
| 24358 | current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT | 24371 | current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT |
| 24359 | (assumed to be a string), and return in DPYINFO's mouse_face | 24372 | (assumed to be a string), and return in HLINFO's mouse_face_* |
| 24360 | members the pixel and column/row coordinates of those glyphs. */ | 24373 | members the pixel and column/row coordinates of those glyphs. */ |
| 24361 | 24374 | ||
| 24362 | static void | 24375 | static void |
| 24363 | mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | 24376 | mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, |
| 24364 | Lisp_Object object, | 24377 | Lisp_Object object, |
| 24365 | EMACS_INT startpos, EMACS_INT endpos) | 24378 | EMACS_INT startpos, EMACS_INT endpos) |
| 24366 | { | 24379 | { |
| @@ -24385,10 +24398,10 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24385 | if (EQ (g->object, object) | 24398 | if (EQ (g->object, object) |
| 24386 | && startpos <= g->charpos && g->charpos <= endpos) | 24399 | && startpos <= g->charpos && g->charpos <= endpos) |
| 24387 | { | 24400 | { |
| 24388 | dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; | 24401 | hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; |
| 24389 | dpyinfo->mouse_face_beg_y = r->y; | 24402 | hlinfo->mouse_face_beg_y = r->y; |
| 24390 | dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; | 24403 | hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; |
| 24391 | dpyinfo->mouse_face_beg_x = gx; | 24404 | hlinfo->mouse_face_beg_x = gx; |
| 24392 | found = 1; | 24405 | found = 1; |
| 24393 | break; | 24406 | break; |
| 24394 | } | 24407 | } |
| @@ -24403,12 +24416,12 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24403 | if (EQ ((g-1)->object, object) | 24416 | if (EQ ((g-1)->object, object) |
| 24404 | && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) | 24417 | && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) |
| 24405 | { | 24418 | { |
| 24406 | dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; | 24419 | hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; |
| 24407 | dpyinfo->mouse_face_beg_y = r->y; | 24420 | hlinfo->mouse_face_beg_y = r->y; |
| 24408 | dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; | 24421 | hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; |
| 24409 | for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) | 24422 | for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) |
| 24410 | gx += g1->pixel_width; | 24423 | gx += g1->pixel_width; |
| 24411 | dpyinfo->mouse_face_beg_x = gx; | 24424 | hlinfo->mouse_face_beg_x = gx; |
| 24412 | found = 1; | 24425 | found = 1; |
| 24413 | break; | 24426 | break; |
| 24414 | } | 24427 | } |
| @@ -24442,8 +24455,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24442 | r--; | 24455 | r--; |
| 24443 | 24456 | ||
| 24444 | /* Set the end row and its vertical pixel coordinate. */ | 24457 | /* Set the end row and its vertical pixel coordinate. */ |
| 24445 | dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; | 24458 | hlinfo->mouse_face_end_row = r - w->current_matrix->rows; |
| 24446 | dpyinfo->mouse_face_end_y = r->y; | 24459 | hlinfo->mouse_face_end_y = r->y; |
| 24447 | 24460 | ||
| 24448 | /* Compute and set the end column and the end column's horizontal | 24461 | /* Compute and set the end column and the end column's horizontal |
| 24449 | pixel coordinate. */ | 24462 | pixel coordinate. */ |
| @@ -24455,11 +24468,11 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24455 | if (EQ ((e-1)->object, object) | 24468 | if (EQ ((e-1)->object, object) |
| 24456 | && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) | 24469 | && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) |
| 24457 | break; | 24470 | break; |
| 24458 | dpyinfo->mouse_face_end_col = e - g; | 24471 | hlinfo->mouse_face_end_col = e - g; |
| 24459 | 24472 | ||
| 24460 | for (gx = r->x; g < e; ++g) | 24473 | for (gx = r->x; g < e; ++g) |
| 24461 | gx += g->pixel_width; | 24474 | gx += g->pixel_width; |
| 24462 | dpyinfo->mouse_face_end_x = gx; | 24475 | hlinfo->mouse_face_end_x = gx; |
| 24463 | } | 24476 | } |
| 24464 | else | 24477 | else |
| 24465 | { | 24478 | { |
| @@ -24472,8 +24485,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24472 | break; | 24485 | break; |
| 24473 | gx += e->pixel_width; | 24486 | gx += e->pixel_width; |
| 24474 | } | 24487 | } |
| 24475 | dpyinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; | 24488 | hlinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; |
| 24476 | dpyinfo->mouse_face_end_x = gx; | 24489 | hlinfo->mouse_face_end_x = gx; |
| 24477 | } | 24490 | } |
| 24478 | } | 24491 | } |
| 24479 | 24492 | ||
| @@ -24663,8 +24676,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24663 | { | 24676 | { |
| 24664 | struct window *w = XWINDOW (window); | 24677 | struct window *w = XWINDOW (window); |
| 24665 | struct frame *f = XFRAME (w->frame); | 24678 | struct frame *f = XFRAME (w->frame); |
| 24666 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 24679 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 24667 | #ifdef HAVE_WINDOW_SYSTEM | 24680 | #ifdef HAVE_WINDOW_SYSTEM |
| 24681 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 24668 | Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; | 24682 | Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; |
| 24669 | #else | 24683 | #else |
| 24670 | Cursor cursor = No_Cursor; | 24684 | Cursor cursor = No_Cursor; |
| @@ -24871,58 +24885,58 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24871 | 24885 | ||
| 24872 | /* If GLYPH's position is included in the region that is | 24886 | /* If GLYPH's position is included in the region that is |
| 24873 | already drawn in mouse face, we have nothing to do. */ | 24887 | already drawn in mouse face, we have nothing to do. */ |
| 24874 | if ( EQ (window, dpyinfo->mouse_face_window) | 24888 | if ( EQ (window, hlinfo->mouse_face_window) |
| 24875 | && (!row->reversed_p | 24889 | && (!row->reversed_p |
| 24876 | ? (dpyinfo->mouse_face_beg_col <= hpos | 24890 | ? (hlinfo->mouse_face_beg_col <= hpos |
| 24877 | && hpos < dpyinfo->mouse_face_end_col) | 24891 | && hpos < hlinfo->mouse_face_end_col) |
| 24878 | /* In R2L rows we swap BEG and END, see below. */ | 24892 | /* In R2L rows we swap BEG and END, see below. */ |
| 24879 | : (dpyinfo->mouse_face_end_col <= hpos | 24893 | : (hlinfo->mouse_face_end_col <= hpos |
| 24880 | && hpos < dpyinfo->mouse_face_beg_col)) | 24894 | && hpos < hlinfo->mouse_face_beg_col)) |
| 24881 | && dpyinfo->mouse_face_beg_row == vpos ) | 24895 | && hlinfo->mouse_face_beg_row == vpos ) |
| 24882 | return; | 24896 | return; |
| 24883 | 24897 | ||
| 24884 | if (clear_mouse_face (dpyinfo)) | 24898 | if (clear_mouse_face (hlinfo)) |
| 24885 | cursor = No_Cursor; | 24899 | cursor = No_Cursor; |
| 24886 | 24900 | ||
| 24887 | if (!row->reversed_p) | 24901 | if (!row->reversed_p) |
| 24888 | { | 24902 | { |
| 24889 | dpyinfo->mouse_face_beg_col = hpos; | 24903 | hlinfo->mouse_face_beg_col = hpos; |
| 24890 | dpyinfo->mouse_face_beg_x = original_x_pixel | 24904 | hlinfo->mouse_face_beg_x = original_x_pixel |
| 24891 | - (total_pixel_width + dx); | 24905 | - (total_pixel_width + dx); |
| 24892 | dpyinfo->mouse_face_end_col = hpos + gseq_length; | 24906 | hlinfo->mouse_face_end_col = hpos + gseq_length; |
| 24893 | dpyinfo->mouse_face_end_x = 0; | 24907 | hlinfo->mouse_face_end_x = 0; |
| 24894 | } | 24908 | } |
| 24895 | else | 24909 | else |
| 24896 | { | 24910 | { |
| 24897 | /* In R2L rows, show_mouse_face expects BEG and END | 24911 | /* In R2L rows, show_mouse_face expects BEG and END |
| 24898 | coordinates to be swapped. */ | 24912 | coordinates to be swapped. */ |
| 24899 | dpyinfo->mouse_face_end_col = hpos; | 24913 | hlinfo->mouse_face_end_col = hpos; |
| 24900 | dpyinfo->mouse_face_end_x = original_x_pixel | 24914 | hlinfo->mouse_face_end_x = original_x_pixel |
| 24901 | - (total_pixel_width + dx); | 24915 | - (total_pixel_width + dx); |
| 24902 | dpyinfo->mouse_face_beg_col = hpos + gseq_length; | 24916 | hlinfo->mouse_face_beg_col = hpos + gseq_length; |
| 24903 | dpyinfo->mouse_face_beg_x = 0; | 24917 | hlinfo->mouse_face_beg_x = 0; |
| 24904 | } | 24918 | } |
| 24905 | 24919 | ||
| 24906 | dpyinfo->mouse_face_beg_row = vpos; | 24920 | hlinfo->mouse_face_beg_row = vpos; |
| 24907 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; | 24921 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row; |
| 24908 | dpyinfo->mouse_face_beg_y = 0; | 24922 | hlinfo->mouse_face_beg_y = 0; |
| 24909 | dpyinfo->mouse_face_end_y = 0; | 24923 | hlinfo->mouse_face_end_y = 0; |
| 24910 | dpyinfo->mouse_face_past_end = 0; | 24924 | hlinfo->mouse_face_past_end = 0; |
| 24911 | dpyinfo->mouse_face_window = window; | 24925 | hlinfo->mouse_face_window = window; |
| 24912 | 24926 | ||
| 24913 | dpyinfo->mouse_face_face_id = face_at_string_position (w, string, | 24927 | hlinfo->mouse_face_face_id = face_at_string_position (w, string, |
| 24914 | charpos, | 24928 | charpos, |
| 24915 | 0, 0, 0, | 24929 | 0, 0, 0, |
| 24916 | &ignore, | 24930 | &ignore, |
| 24917 | glyph->face_id, | 24931 | glyph->face_id, |
| 24918 | 1); | 24932 | 1); |
| 24919 | show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); | 24933 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| 24920 | 24934 | ||
| 24921 | if (NILP (pointer)) | 24935 | if (NILP (pointer)) |
| 24922 | pointer = Qhand; | 24936 | pointer = Qhand; |
| 24923 | } | 24937 | } |
| 24924 | else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) | 24938 | else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) |
| 24925 | clear_mouse_face (dpyinfo); | 24939 | clear_mouse_face (hlinfo); |
| 24926 | } | 24940 | } |
| 24927 | #ifdef HAVE_WINDOW_SYSTEM | 24941 | #ifdef HAVE_WINDOW_SYSTEM |
| 24928 | define_frame_cursor1 (f, cursor, pointer); | 24942 | define_frame_cursor1 (f, cursor, pointer); |
| @@ -24939,7 +24953,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24939 | void | 24953 | void |
| 24940 | note_mouse_highlight (struct frame *f, int x, int y) | 24954 | note_mouse_highlight (struct frame *f, int x, int y) |
| 24941 | { | 24955 | { |
| 24942 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 24956 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 24943 | enum window_part part; | 24957 | enum window_part part; |
| 24944 | Lisp_Object window; | 24958 | Lisp_Object window; |
| 24945 | struct window *w; | 24959 | struct window *w; |
| @@ -24958,16 +24972,16 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24958 | || f->pointer_invisible) | 24972 | || f->pointer_invisible) |
| 24959 | return; | 24973 | return; |
| 24960 | 24974 | ||
| 24961 | dpyinfo->mouse_face_mouse_x = x; | 24975 | hlinfo->mouse_face_mouse_x = x; |
| 24962 | dpyinfo->mouse_face_mouse_y = y; | 24976 | hlinfo->mouse_face_mouse_y = y; |
| 24963 | dpyinfo->mouse_face_mouse_frame = f; | 24977 | hlinfo->mouse_face_mouse_frame = f; |
| 24964 | 24978 | ||
| 24965 | if (dpyinfo->mouse_face_defer) | 24979 | if (hlinfo->mouse_face_defer) |
| 24966 | return; | 24980 | return; |
| 24967 | 24981 | ||
| 24968 | if (gc_in_progress) | 24982 | if (gc_in_progress) |
| 24969 | { | 24983 | { |
| 24970 | dpyinfo->mouse_face_deferred_gc = 1; | 24984 | hlinfo->mouse_face_deferred_gc = 1; |
| 24971 | return; | 24985 | return; |
| 24972 | } | 24986 | } |
| 24973 | 24987 | ||
| @@ -24976,10 +24990,10 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24976 | 24990 | ||
| 24977 | /* If we were displaying active text in another window, clear that. | 24991 | /* If we were displaying active text in another window, clear that. |
| 24978 | Also clear if we move out of text area in same window. */ | 24992 | Also clear if we move out of text area in same window. */ |
| 24979 | if (! EQ (window, dpyinfo->mouse_face_window) | 24993 | if (! EQ (window, hlinfo->mouse_face_window) |
| 24980 | || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE | 24994 | || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE |
| 24981 | && !NILP (dpyinfo->mouse_face_window))) | 24995 | && !NILP (hlinfo->mouse_face_window))) |
| 24982 | clear_mouse_face (dpyinfo); | 24996 | clear_mouse_face (hlinfo); |
| 24983 | 24997 | ||
| 24984 | /* Not on a window -> return. */ | 24998 | /* Not on a window -> return. */ |
| 24985 | if (!WINDOWP (window)) | 24999 | if (!WINDOWP (window)) |
| @@ -25108,7 +25122,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25108 | && glyph->type == STRETCH_GLYPH | 25122 | && glyph->type == STRETCH_GLYPH |
| 25109 | && glyph->avoid_cursor_p)) | 25123 | && glyph->avoid_cursor_p)) |
| 25110 | { | 25124 | { |
| 25111 | if (clear_mouse_face (dpyinfo)) | 25125 | if (clear_mouse_face (hlinfo)) |
| 25112 | cursor = No_Cursor; | 25126 | cursor = No_Cursor; |
| 25113 | #ifdef HAVE_WINDOW_SYSTEM | 25127 | #ifdef HAVE_WINDOW_SYSTEM |
| 25114 | if (NILP (pointer)) | 25128 | if (NILP (pointer)) |
| @@ -25164,8 +25178,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25164 | the one we are currently highlighting, we have to | 25178 | the one we are currently highlighting, we have to |
| 25165 | check if we enter the overlapping overlay, and then | 25179 | check if we enter the overlapping overlay, and then |
| 25166 | highlight only that. */ | 25180 | highlight only that. */ |
| 25167 | || (OVERLAYP (dpyinfo->mouse_face_overlay) | 25181 | || (OVERLAYP (hlinfo->mouse_face_overlay) |
| 25168 | && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) | 25182 | && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay))) |
| 25169 | { | 25183 | { |
| 25170 | /* Find the highest priority overlay with a mouse-face. */ | 25184 | /* Find the highest priority overlay with a mouse-face. */ |
| 25171 | overlay = Qnil; | 25185 | overlay = Qnil; |
| @@ -25178,12 +25192,12 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25178 | 25192 | ||
| 25179 | /* If we're highlighting the same overlay as before, there's | 25193 | /* If we're highlighting the same overlay as before, there's |
| 25180 | no need to do that again. */ | 25194 | no need to do that again. */ |
| 25181 | if (!NILP (overlay) && EQ (overlay, dpyinfo->mouse_face_overlay)) | 25195 | if (!NILP (overlay) && EQ (overlay, hlinfo->mouse_face_overlay)) |
| 25182 | goto check_help_echo; | 25196 | goto check_help_echo; |
| 25183 | dpyinfo->mouse_face_overlay = overlay; | 25197 | hlinfo->mouse_face_overlay = overlay; |
| 25184 | 25198 | ||
| 25185 | /* Clear the display of the old active region, if any. */ | 25199 | /* Clear the display of the old active region, if any. */ |
| 25186 | if (clear_mouse_face (dpyinfo)) | 25200 | if (clear_mouse_face (hlinfo)) |
| 25187 | cursor = No_Cursor; | 25201 | cursor = No_Cursor; |
| 25188 | 25202 | ||
| 25189 | /* If no overlay applies, get a text property. */ | 25203 | /* If no overlay applies, get a text property. */ |
| @@ -25207,14 +25221,14 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25207 | b = make_number (0); | 25221 | b = make_number (0); |
| 25208 | if (NILP (e)) | 25222 | if (NILP (e)) |
| 25209 | e = make_number (SCHARS (object) - 1); | 25223 | e = make_number (SCHARS (object) - 1); |
| 25210 | mouse_face_from_string_pos (w, dpyinfo, object, | 25224 | mouse_face_from_string_pos (w, hlinfo, object, |
| 25211 | XINT (b), XINT (e)); | 25225 | XINT (b), XINT (e)); |
| 25212 | dpyinfo->mouse_face_past_end = 0; | 25226 | hlinfo->mouse_face_past_end = 0; |
| 25213 | dpyinfo->mouse_face_window = window; | 25227 | hlinfo->mouse_face_window = window; |
| 25214 | dpyinfo->mouse_face_face_id | 25228 | hlinfo->mouse_face_face_id |
| 25215 | = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, | 25229 | = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, |
| 25216 | glyph->face_id, 1); | 25230 | glyph->face_id, 1); |
| 25217 | show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); | 25231 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| 25218 | cursor = No_Cursor; | 25232 | cursor = No_Cursor; |
| 25219 | } | 25233 | } |
| 25220 | else | 25234 | else |
| @@ -25289,7 +25303,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25289 | if (!STRINGP (after_string)) after_string = Qnil; | 25303 | if (!STRINGP (after_string)) after_string = Qnil; |
| 25290 | } | 25304 | } |
| 25291 | 25305 | ||
| 25292 | mouse_face_from_buffer_pos (window, dpyinfo, pos, | 25306 | mouse_face_from_buffer_pos (window, hlinfo, pos, |
| 25293 | XFASTINT (before), | 25307 | XFASTINT (before), |
| 25294 | XFASTINT (after), | 25308 | XFASTINT (after), |
| 25295 | before_string, after_string, | 25309 | before_string, after_string, |
| @@ -25436,13 +25450,13 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25436 | void | 25450 | void |
| 25437 | x_clear_window_mouse_face (struct window *w) | 25451 | x_clear_window_mouse_face (struct window *w) |
| 25438 | { | 25452 | { |
| 25439 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); | 25453 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); |
| 25440 | Lisp_Object window; | 25454 | Lisp_Object window; |
| 25441 | 25455 | ||
| 25442 | BLOCK_INPUT; | 25456 | BLOCK_INPUT; |
| 25443 | XSETWINDOW (window, w); | 25457 | XSETWINDOW (window, w); |
| 25444 | if (EQ (window, dpyinfo->mouse_face_window)) | 25458 | if (EQ (window, hlinfo->mouse_face_window)) |
| 25445 | clear_mouse_face (dpyinfo); | 25459 | clear_mouse_face (hlinfo); |
| 25446 | UNBLOCK_INPUT; | 25460 | UNBLOCK_INPUT; |
| 25447 | } | 25461 | } |
| 25448 | 25462 | ||
| @@ -25455,14 +25469,14 @@ void | |||
| 25455 | cancel_mouse_face (struct frame *f) | 25469 | cancel_mouse_face (struct frame *f) |
| 25456 | { | 25470 | { |
| 25457 | Lisp_Object window; | 25471 | Lisp_Object window; |
| 25458 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 25472 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 25459 | 25473 | ||
| 25460 | window = dpyinfo->mouse_face_window; | 25474 | window = hlinfo->mouse_face_window; |
| 25461 | if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) | 25475 | if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) |
| 25462 | { | 25476 | { |
| 25463 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | 25477 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
| 25464 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | 25478 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
| 25465 | dpyinfo->mouse_face_window = Qnil; | 25479 | hlinfo->mouse_face_window = Qnil; |
| 25466 | } | 25480 | } |
| 25467 | } | 25481 | } |
| 25468 | 25482 | ||
| @@ -25923,12 +25937,12 @@ expose_frame (struct frame *f, int x, int y, int w, int h) | |||
| 25923 | focus-follows-mouse with delayed raise. --jason 2001-10-12 */ | 25937 | focus-follows-mouse with delayed raise. --jason 2001-10-12 */ |
| 25924 | if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) | 25938 | if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) |
| 25925 | { | 25939 | { |
| 25926 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 25940 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 25927 | if (f == dpyinfo->mouse_face_mouse_frame) | 25941 | if (f == hlinfo->mouse_face_mouse_frame) |
| 25928 | { | 25942 | { |
| 25929 | int x = dpyinfo->mouse_face_mouse_x; | 25943 | int x = hlinfo->mouse_face_mouse_x; |
| 25930 | int y = dpyinfo->mouse_face_mouse_y; | 25944 | int y = hlinfo->mouse_face_mouse_y; |
| 25931 | clear_mouse_face (dpyinfo); | 25945 | clear_mouse_face (hlinfo); |
| 25932 | note_mouse_highlight (f, x, y); | 25946 | note_mouse_highlight (f, x, y); |
| 25933 | } | 25947 | } |
| 25934 | } | 25948 | } |
diff --git a/src/xterm.h b/src/xterm.h index d884945f985..ec99a659b8e 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -190,36 +190,9 @@ struct x_display_info | |||
| 190 | /* Reusable Graphics Context for drawing a cursor in a non-default face. */ | 190 | /* Reusable Graphics Context for drawing a cursor in a non-default face. */ |
| 191 | GC scratch_cursor_gc; | 191 | GC scratch_cursor_gc; |
| 192 | 192 | ||
| 193 | /* These variables describe the range of text currently shown in its | 193 | /* Information about the range of text currently shown in |
| 194 | mouse-face, together with the window they apply to. As long as | 194 | mouse-face. */ |
| 195 | the mouse stays within this range, we need not redraw anything on | 195 | Mouse_HLInfo mouse_highlight; |
| 196 | its account. Rows and columns are glyph matrix positions in | ||
| 197 | MOUSE_FACE_WINDOW. */ | ||
| 198 | int mouse_face_beg_row, mouse_face_beg_col; | ||
| 199 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 200 | int mouse_face_end_row, mouse_face_end_col; | ||
| 201 | int mouse_face_end_x, mouse_face_end_y; | ||
| 202 | int mouse_face_past_end; | ||
| 203 | Lisp_Object mouse_face_window; | ||
| 204 | int mouse_face_face_id; | ||
| 205 | Lisp_Object mouse_face_overlay; | ||
| 206 | |||
| 207 | /* 1 if a mouse motion event came and we didn't handle it right away because | ||
| 208 | gc was in progress. */ | ||
| 209 | int mouse_face_deferred_gc; | ||
| 210 | |||
| 211 | /* FRAME and X, Y position of mouse when last checked for | ||
| 212 | highlighting. X and Y can be negative or out of range for the frame. */ | ||
| 213 | struct frame *mouse_face_mouse_frame; | ||
| 214 | int mouse_face_mouse_x, mouse_face_mouse_y; | ||
| 215 | |||
| 216 | /* Nonzero means defer mouse-motion highlighting. */ | ||
| 217 | int mouse_face_defer; | ||
| 218 | |||
| 219 | /* Nonzero means that the mouse highlight should not be shown. */ | ||
| 220 | int mouse_face_hidden; | ||
| 221 | |||
| 222 | int mouse_face_image_state; | ||
| 223 | 196 | ||
| 224 | char *x_id_name; | 197 | char *x_id_name; |
| 225 | 198 | ||