Subject: Re: bug#78218: 30.1; mouse-highlight variable does not work on macOS

From: Eli Zaretskii <[email-masked]>
Date: Sun, 04 May 2025 08:47:54 +0300

> From: Gerd Möllmann <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Sun, 04 May 2025 06:51:47 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Gerd Möllmann <[email-masked]>
> >> Cc: [email-masked],  [email-masked],  [email-masked]
> >> Date: Sat, 03 May 2025 14:44:08 +0200
> >> 
> >> Eli Zaretskii <[email-masked]> writes:
> >> 
> >> > AFAICT, it wasn't implemented (except for MS-DOS).  I've now fixed
> >> > that for the MS-Windows console.  I don't have access to a Unix
> >> > terminal with a mouse, so I cannot work on fixing this, but AFAIU the
> >> > fix should be in handle_one_term_event.
> >> 
> >> That function is part of the GMP mouse handling, AFAICS.
> >
> > Yes, that's what I had in mind.  For xterm-mouse we'll need something
> > else.
> >
> >> Also something one should maybe take into account is if/how multi-tty
> >> comes into play here?
> >
> > The mouse_highlight structure is per-terminal, so I think this is
> > solved.
> 
> I've pushed something to master for NS.
> 
> While checking what xterm does I found this:
> 
> xterm.c:
> 20204       if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
> 20205           && (f == 0
> 20206 #if ! defined (USE_GTK)
> 20207               || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)
> 20208 #endif
> 20209               || !EQ (f->tab_bar_window, hlinfo->mouse_face_window))
> 
> Shouldn't that check that mouse_face_window is neither the tool bar
> window (if USE_GTK) nor the tab bar window? Something like (!EQ && !EQ)?

Yes, I think so.  Here's the w32 implementation, for comparison:

	  if (f && !FRAME_ICONIFIED_P (f))
	    {
	      if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
		  && !EQ (f->tab_bar_window, hlinfo->mouse_face_window)
		  && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
		{
		  clear_mouse_face (hlinfo);
		  hlinfo->mouse_face_hidden = true;
		}