Subject: bug#75930: 30.0.92; Setting default frame background color messes up mouse pointer

From: Lars Rustand <[email-masked]>
Date: Sat, 01 Feb 2025 00:14:47 +0100

Eli Zaretskii <[email-masked]> writes:
>
> So now I'm confused: why is this a bug?

I don't know why you are suddenly confused, because the description of
the bug has not changed. I have simply located the exact parts of the
code responsible for (one half of) the problem, i.e. the cause of the
mouse pointer border color being set to the frame background color.

Maybe my description of the issue I observe has not been clear
enough. Since you have not seen it first-hand, I attach an image which
illustrates the difference in mouse pointer caused by setting the
emacs frame background via the --background argument.

(I don't know how well image attachments work, if at all, on the mailing
list, so I apologize if the image does not make it through. Please let
me know if it doesn't reach you.)

The pointer to the left is how it normally looks, when emacs has not
modified it and the original Xorg pointer is still intact. As you can see
it is very easily visible, even against a dark background, thanks to
the border color.

The pointer on the right is the result of setting the frame background
color through the --background argument. As you can see the pointer is
now much less visible, since the border around the pointer is the exact
same color as the frame background.

Note that in neither of the examples have I set any custom mouse color,
so I would expect it to remain unchanged in both.

After finding the code I pointed to in my previous message, I realized
that this is in fact a two-part problem.

Part 1 is that x_set_mouse_color incorrectly uses the background color
of the current (or default?) frame as the color of the border/outline
of the mouse pointer. This makes that border in effect become
completely invisible when hovering over the emacs frame, which can make
the mouse pointer very hard to see.

Part 2 is that the act of setting a default frame background color
causes x_set_mouse_color to even be called in the first place. The mouse
color should obviously not be changed as a side effect of changing the
frame background color. These are two very different things that has
nothing to do with eachother.

I have identified the cause of part 1, but I have not (yet) found the
cause of part 2.