>From 9ec201c229fdb8f9fbed1050961730daaf9db718 Mon Sep 17 00:00:00 2001 From: Nick Helm Date: Mon, 14 Oct 2019 14:11:25 +1300 Subject: [PATCH] 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). --- src/nsterm.m | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index bbd2c84..cc21ec3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4292,14 +4292,22 @@ in certain situations (rapid incoming events). NSEvent *theEvent = [NSApp currentEvent]; struct frame *emacsframe = SELECTED_FRAME (); - [menu cancelTracking]; - menu_will_open_state = MENU_PENDING; - emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; - EV_TRAILER (theEvent); - - CGEventRef ourEvent = CGEventCreate (NULL); - menu_mouse_point = CGEventGetLocation (ourEvent); - CFRelease (ourEvent); + /* On macOS, the following can cause an event loop when the + Spotlight for Help search field is populated. Avoid this by + not postponing mouse drag and non-user-generated mouse down + events (Bug#31371). */ + if (([theEvent type] == NSEventTypeLeftMouseDown) + && [theEvent eventNumber]) + { + [menu cancelTracking]; + menu_will_open_state = MENU_PENDING; + emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; + EV_TRAILER (theEvent); + + CGEventRef ourEvent = CGEventCreate (NULL); + menu_mouse_point = CGEventGetLocation (ourEvent); + CFRelease (ourEvent); + } } else if (menu_will_open_state == MENU_OPENING) { -- 2.20.1 (Apple Git-117)