Skip to content

Commit 6daa80d

Browse files
Nick Helmskangas
authored andcommitted
Fix unresponsive Help menu in macOS
* src/nsterm.m (ns_check_menu_open): Don't postpone mouse drag and non-user-generated mouse down events (Bug#31371).
1 parent 273604d commit 6daa80d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/nsterm.m

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,14 +4401,22 @@ in certain situations (rapid incoming events).
44014401
NSEvent *theEvent = [NSApp currentEvent];
44024402
struct frame *emacsframe = SELECTED_FRAME ();
44034403

4404-
[menu cancelTracking];
4405-
menu_will_open_state = MENU_PENDING;
4406-
emacs_event->kind = MENU_BAR_ACTIVATE_EVENT;
4407-
EV_TRAILER (theEvent);
4408-
4409-
CGEventRef ourEvent = CGEventCreate (NULL);
4410-
menu_mouse_point = CGEventGetLocation (ourEvent);
4411-
CFRelease (ourEvent);
4404+
/* On macOS, the following can cause an event loop when the
4405+
Spotlight for Help search field is populated. Avoid this by
4406+
not postponing mouse drag and non-user-generated mouse down
4407+
events (Bug#31371). */
4408+
if (([theEvent type] == NSEventTypeLeftMouseDown)
4409+
&& [theEvent eventNumber])
4410+
{
4411+
[menu cancelTracking];
4412+
menu_will_open_state = MENU_PENDING;
4413+
emacs_event->kind = MENU_BAR_ACTIVATE_EVENT;
4414+
EV_TRAILER (theEvent);
4415+
4416+
CGEventRef ourEvent = CGEventCreate (NULL);
4417+
menu_mouse_point = CGEventGetLocation (ourEvent);
4418+
CFRelease (ourEvent);
4419+
}
44124420
}
44134421
else if (menu_will_open_state == MENU_OPENING)
44144422
{

0 commit comments

Comments
 (0)