Subject: Re: bug#75931: 31.0.50; mouse-face and pointer properties make pointer change back and forth

From: Eli Zaretskii <[email-masked]>
Date: Thu, 30 Jan 2025 13:36:49 +0200

> Date: Thu, 30 Jan 2025 06:57:32 -0300
> Cc: [email-masked]
> From: Mauro Aranda <[email-masked]>
> 
> Now, if I go back to your commit, then commenting out that change in
> dispnew.c does indeed solve the problem.  But the next commit to xdisp.c
> is this:
> commit 2028df7826bb2c2909b2aaeba47282ca70c514e3
> Author: Po Lu <[email-masked]>
> Date:   Thu Oct 14 18:38:26 2021 +0800
> 
>      Fix minor issues with text display when cursor is in mouse face
> 
>       * src/xdisp.c (get_cursor_offset_for_mouse_face): Don't calculate
>      offsets for the glyph the cursor is on, and move some logic to
>      get_glyph_pixel_width_delta_for_mouse_face.
>      (fill_composite_glyph_string)
>      (fill_gstring_glyph_string)
>      (fill_glyphless_glyph_string)
>      (fill_glyph_string)
>      (fill_image_glyph_string)
>      (fill_xwidget_glyph_string)
>      (fill_stretch_glyph_string): Set s->face to mouse face whenever
>      appropriate.
>      (get_glyph_pixel_width_delta_for_mouse_face): New function.
>      (set_glyph_string_background_width): Update background width and
>      s->width to take into account differing :box properties of the mouse
>      face, when producing strings for the cursor.
>      (erase_phys_cursor): Redraw mouse face when erasing a cursor on top of
>      the mouse face.
>       * src/xterm.c (x_set_mouse_face_gc): Stop setting s->face when under
>      mouse face because redisplay now does that for us.
>       * src/w32term.c (w32_set_mouse_face_gc): Likewise.
> 
> And that commit makes the issue reappear.  And as I said, now reverting
> the change in dispnew.c only solves half the problem.
> 
> Perhaps it is the call to show_mouse_face that was added to
> erase_phys_cursor.

Yes, I think so.  If you arrange for that call to show_mouse_face to
not redefine the mouse cursor near the end of show_mouse_face, does
the problem go away? or do you still need to revert those two lines in
dispnew.c added by my changes?

Po Lu, do you see any reason to recompute the mouse cursor in that
case?