diff options
| author | Eli Zaretskii | 2025-02-02 08:23:02 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-02-02 08:23:02 +0200 |
| commit | 354b2907fce6a4ce9f5e8ea0faf69974e21e749b (patch) | |
| tree | 91c0983d95f726d94d230b1aa1f3f8cc6436ab79 /src | |
| parent | 42f1318e6579f94b90ef101f3f03ca65fb229262 (diff) | |
| download | emacs-354b2907fce6a4ce9f5e8ea0faf69974e21e749b.tar.gz emacs-354b2907fce6a4ce9f5e8ea0faf69974e21e749b.zip | |
Fix mouse pointer inside mouse-face on text with 'pointer' property
* src/dispnew.c (gui_update_window_end): Don't consider mouse face
overwritten.
* src/xdisp.c (show_mouse_face): Accept an additional argument;
redefine the mouse cursor only if that argument is 'true'. All
callers changed. (Bug#75931)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 35 |
2 files changed, 18 insertions, 20 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index c062ea42f3d..5f5575d484b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -4597,9 +4597,6 @@ gui_update_window_end (struct window *w, bool cursor_on_p, | |||
| 4597 | w->output_cursor.hpos, w->output_cursor.vpos, | 4597 | w->output_cursor.hpos, w->output_cursor.vpos, |
| 4598 | w->output_cursor.x, w->output_cursor.y); | 4598 | w->output_cursor.x, w->output_cursor.y); |
| 4599 | 4599 | ||
| 4600 | if (cursor_in_mouse_face_p (w) && cursor_on_p) | ||
| 4601 | mouse_face_overwritten_p = 1; | ||
| 4602 | |||
| 4603 | if (draw_window_fringes (w, true)) | 4600 | if (draw_window_fringes (w, true)) |
| 4604 | { | 4601 | { |
| 4605 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) | 4602 | if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) |
diff --git a/src/xdisp.c b/src/xdisp.c index 0b8dbf514c1..36e82f873ab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1229,7 +1229,7 @@ static void get_cursor_offset_for_mouse_face (struct window *w, | |||
| 1229 | 1229 | ||
| 1230 | static void produce_special_glyphs (struct it *, enum display_element_type); | 1230 | static void produce_special_glyphs (struct it *, enum display_element_type); |
| 1231 | static void pad_mode_line (struct it *, bool); | 1231 | static void pad_mode_line (struct it *, bool); |
| 1232 | static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face); | 1232 | static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face, bool); |
| 1233 | static bool coords_in_mouse_face_p (struct window *, int, int); | 1233 | static bool coords_in_mouse_face_p (struct window *, int, int); |
| 1234 | static void reset_box_start_end_flags (struct it *); | 1234 | static void reset_box_start_end_flags (struct it *); |
| 1235 | 1235 | ||
| @@ -15052,14 +15052,14 @@ handle_tab_bar_click (struct frame *f, int x, int y, bool down_p, | |||
| 15052 | { | 15052 | { |
| 15053 | /* Show the clicked button in pressed state. */ | 15053 | /* Show the clicked button in pressed state. */ |
| 15054 | if (!NILP (Vmouse_highlight)) | 15054 | if (!NILP (Vmouse_highlight)) |
| 15055 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | 15055 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN, true); |
| 15056 | f->last_tab_bar_item = prop_idx; /* record the pressed tab */ | 15056 | f->last_tab_bar_item = prop_idx; /* record the pressed tab */ |
| 15057 | } | 15057 | } |
| 15058 | else | 15058 | else |
| 15059 | { | 15059 | { |
| 15060 | /* Show item in released state. */ | 15060 | /* Show item in released state. */ |
| 15061 | if (!NILP (Vmouse_highlight)) | 15061 | if (!NILP (Vmouse_highlight)) |
| 15062 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | 15062 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED, true); |
| 15063 | f->last_tab_bar_item = -1; | 15063 | f->last_tab_bar_item = -1; |
| 15064 | } | 15064 | } |
| 15065 | 15065 | ||
| @@ -15157,7 +15157,7 @@ note_tab_bar_highlight (struct frame *f, int x, int y) | |||
| 15157 | hlinfo->mouse_face_face_id = TAB_BAR_FACE_ID; | 15157 | hlinfo->mouse_face_face_id = TAB_BAR_FACE_ID; |
| 15158 | 15158 | ||
| 15159 | /* Display it as active. */ | 15159 | /* Display it as active. */ |
| 15160 | show_mouse_face (hlinfo, draw); | 15160 | show_mouse_face (hlinfo, draw, true); |
| 15161 | } | 15161 | } |
| 15162 | 15162 | ||
| 15163 | set_help_echo: | 15163 | set_help_echo: |
| @@ -16074,7 +16074,7 @@ handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p, | |||
| 16074 | { | 16074 | { |
| 16075 | /* Show item in pressed state. */ | 16075 | /* Show item in pressed state. */ |
| 16076 | if (!NILP (Vmouse_highlight)) | 16076 | if (!NILP (Vmouse_highlight)) |
| 16077 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | 16077 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN, true); |
| 16078 | f->last_tool_bar_item = prop_idx; | 16078 | f->last_tool_bar_item = prop_idx; |
| 16079 | } | 16079 | } |
| 16080 | else | 16080 | else |
| @@ -16085,7 +16085,7 @@ handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p, | |||
| 16085 | 16085 | ||
| 16086 | /* Show item in released state. */ | 16086 | /* Show item in released state. */ |
| 16087 | if (!NILP (Vmouse_highlight)) | 16087 | if (!NILP (Vmouse_highlight)) |
| 16088 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | 16088 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED, true); |
| 16089 | 16089 | ||
| 16090 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); | 16090 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); |
| 16091 | 16091 | ||
| @@ -16181,7 +16181,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 16181 | hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; | 16181 | hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; |
| 16182 | 16182 | ||
| 16183 | /* Display it as active. */ | 16183 | /* Display it as active. */ |
| 16184 | show_mouse_face (hlinfo, draw); | 16184 | show_mouse_face (hlinfo, draw, true); |
| 16185 | } | 16185 | } |
| 16186 | 16186 | ||
| 16187 | set_help_echo: | 16187 | set_help_echo: |
| @@ -34196,12 +34196,13 @@ erase_phys_cursor (struct window *w) | |||
| 34196 | /* Since erasing the phys cursor will probably lead to corruption of | 34196 | /* Since erasing the phys cursor will probably lead to corruption of |
| 34197 | the mouse face display if the glyph's pixel_width is not kept up | 34197 | the mouse face display if the glyph's pixel_width is not kept up |
| 34198 | to date with the :box property of the mouse face, just redraw the | 34198 | to date with the :box property of the mouse face, just redraw the |
| 34199 | mouse face. */ | 34199 | mouse face, but leave the mouse cursor as it was. */ |
| 34200 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) && mouse_face_here_p) | 34200 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) && mouse_face_here_p) |
| 34201 | { | 34201 | { |
| 34202 | w->phys_cursor_on_p = false; | 34202 | w->phys_cursor_on_p = false; |
| 34203 | w->phys_cursor_type = NO_CURSOR; | 34203 | w->phys_cursor_type = NO_CURSOR; |
| 34204 | show_mouse_face (MOUSE_HL_INFO (WINDOW_XFRAME (w)), DRAW_MOUSE_FACE); | 34204 | show_mouse_face (MOUSE_HL_INFO (WINDOW_XFRAME (w)), DRAW_MOUSE_FACE, |
| 34205 | false); | ||
| 34205 | return; | 34206 | return; |
| 34206 | } | 34207 | } |
| 34207 | #endif | 34208 | #endif |
| @@ -34462,7 +34463,8 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, | |||
| 34462 | /* Display the active region described by mouse_face_* according to DRAW. */ | 34463 | /* Display the active region described by mouse_face_* according to DRAW. */ |
| 34463 | 34464 | ||
| 34464 | static void | 34465 | static void |
| 34465 | show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) | 34466 | show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw, |
| 34467 | bool define_mouse_cursor) | ||
| 34466 | { | 34468 | { |
| 34467 | /* Don't bother doing anything if the mouse-face window is not set | 34469 | /* Don't bother doing anything if the mouse-face window is not set |
| 34468 | up. */ | 34470 | up. */ |
| @@ -34604,7 +34606,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) | |||
| 34604 | 34606 | ||
| 34605 | #ifdef HAVE_WINDOW_SYSTEM | 34607 | #ifdef HAVE_WINDOW_SYSTEM |
| 34606 | /* Change the mouse cursor. */ | 34608 | /* Change the mouse cursor. */ |
| 34607 | if (FRAME_WINDOW_P (f) && NILP (track_mouse)) | 34609 | if (FRAME_WINDOW_P (f) && NILP (track_mouse) && define_mouse_cursor) |
| 34608 | { | 34610 | { |
| 34609 | if (draw == DRAW_NORMAL_TEXT | 34611 | if (draw == DRAW_NORMAL_TEXT |
| 34610 | #ifndef HAVE_EXT_TOOL_BAR | 34612 | #ifndef HAVE_EXT_TOOL_BAR |
| @@ -34612,8 +34614,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) | |||
| 34612 | #endif | 34614 | #endif |
| 34613 | && !EQ (hlinfo->mouse_face_window, f->tab_bar_window)) | 34615 | && !EQ (hlinfo->mouse_face_window, f->tab_bar_window)) |
| 34614 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->text_cursor); | 34616 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->text_cursor); |
| 34615 | else | 34617 | else if (draw == DRAW_MOUSE_FACE) |
| 34616 | if (draw == DRAW_MOUSE_FACE) | ||
| 34617 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->hand_cursor); | 34618 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->hand_cursor); |
| 34618 | else | 34619 | else |
| 34619 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->nontext_cursor); | 34620 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_OUTPUT_DATA (f)->nontext_cursor); |
| @@ -34632,7 +34633,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo) | |||
| 34632 | bool cleared | 34633 | bool cleared |
| 34633 | = !hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window); | 34634 | = !hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window); |
| 34634 | if (cleared) | 34635 | if (cleared) |
| 34635 | show_mouse_face (hlinfo, DRAW_NORMAL_TEXT); | 34636 | show_mouse_face (hlinfo, DRAW_NORMAL_TEXT, true); |
| 34636 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; | 34637 | hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; |
| 34637 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; | 34638 | hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; |
| 34638 | hlinfo->mouse_face_window = Qnil; | 34639 | hlinfo->mouse_face_window = Qnil; |
| @@ -35199,7 +35200,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 35199 | = face_at_buffer_position (w, mouse_charpos, &ignore, | 35200 | = face_at_buffer_position (w, mouse_charpos, &ignore, |
| 35200 | mouse_charpos + 1, | 35201 | mouse_charpos + 1, |
| 35201 | !hlinfo->mouse_face_hidden, -1, 0); | 35202 | !hlinfo->mouse_face_hidden, -1, 0); |
| 35202 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 35203 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE, true); |
| 35203 | } | 35204 | } |
| 35204 | 35205 | ||
| 35205 | /* The following function is not used anymore (replaced with | 35206 | /* The following function is not used anymore (replaced with |
| @@ -35909,7 +35910,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 35909 | face_at_string_position (w, string, charpos, 0, &ignore, | 35910 | face_at_string_position (w, string, charpos, 0, &ignore, |
| 35910 | glyph->face_id, true, 0); | 35911 | glyph->face_id, true, 0); |
| 35911 | 35912 | ||
| 35912 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 35913 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE, true); |
| 35913 | mouse_face_shown = true; | 35914 | mouse_face_shown = true; |
| 35914 | 35915 | ||
| 35915 | if (NILP (pointer)) | 35916 | if (NILP (pointer)) |
| @@ -36448,7 +36449,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 36448 | hlinfo->mouse_face_face_id | 36449 | hlinfo->mouse_face_face_id |
| 36449 | = face_at_string_position (w, object, pos, 0, &ignore, | 36450 | = face_at_string_position (w, object, pos, 0, &ignore, |
| 36450 | glyph->face_id, true, 0); | 36451 | glyph->face_id, true, 0); |
| 36451 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 36452 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE, true); |
| 36452 | cursor = No_Cursor; | 36453 | cursor = No_Cursor; |
| 36453 | } | 36454 | } |
| 36454 | else | 36455 | else |