bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable nil) tab-bar item crases Emacs
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Date: Tue, 28 Jul 2026 20:10:00 +0100 > From: Alan Third <[email protected]> > Cc: Al Haji-Ali <[email protected]>, [email protected] > > On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote: > > > From: Al Haji-Ali <[email protected]> > > > Date: Tue, 28 Jul 2026 16:25:33 +0100 > > > > > > > > No, they both assign 'kind' unconditionally. They then assign the > > 'arg' member only if tab_bar_arg is non-nil. > > > > > Possible minimal fix: make handle_tab_bar_click's disabled-item > > > branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching > > > the "click missed" case, which nsterm.m (and presumably the other > > > ports) already handle correctly as a harmless plain click. I haven't > > > verified this doesn't have side effects for other callers of > > > handle_tab_bar_click across the X11/w32 ports. > > > > I prefer that nsterm.m is changed to do the same we do in xterm.c and > > w32term.c. There's no need to change xdisp.c, which is a back-end > > independent part of the display engine. > > > > Alan, WDYT? > > You mean something like this? Yes. > modified src/nsterm.m > @@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent > Lisp_Object tab_bar_arg = Qnil; > bool tab_bar_p = false; > > + emacs_event->kind = MOUSE_CLICK_EVENT; > + > if (WINDOWP (emacsframe->tab_bar_window) > && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window))) > { > @@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent > EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent)); > } > > - if (!(tab_bar_p && NILP (tab_bar_arg))) > - emacs_event->kind = MOUSE_CLICK_EVENT; > - emacs_event->arg = tab_bar_arg; > + if (tab_bar_p && NILP (tab_bar_arg)) > + emacs_event->kind = NO_EVENT; > + > + if (!NILP (tab_bar_arg)) > + emacs_event->arg = tab_bar_arg; > + > emacs_event->code = EV_BUTTON (theEvent); > emacs_event->modifiers = EV_MODIFIERS (theEvent) > | EV_UDMODIFIERS (theEvent); > > It looks functionally identical to me, but I don't really understand > what's going on here... Does it fix the problem?