aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsterm.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index afe7069aaed..9d5082b71df 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4401,14 +4401,22 @@ ns_check_menu_open (NSMenu *menu)
4401 NSEvent *theEvent = [NSApp currentEvent]; 4401 NSEvent *theEvent = [NSApp currentEvent];
4402 struct frame *emacsframe = SELECTED_FRAME (); 4402 struct frame *emacsframe = SELECTED_FRAME ();
4403 4403
4404 [menu cancelTracking]; 4404 /* On macOS, the following can cause an event loop when the
4405 menu_will_open_state = MENU_PENDING; 4405 Spotlight for Help search field is populated. Avoid this by
4406 emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; 4406 not postponing mouse drag and non-user-generated mouse down
4407 EV_TRAILER (theEvent); 4407 events (Bug#31371). */
4408 4408 if (([theEvent type] == NSEventTypeLeftMouseDown)
4409 CGEventRef ourEvent = CGEventCreate (NULL); 4409 && [theEvent eventNumber])
4410 menu_mouse_point = CGEventGetLocation (ourEvent); 4410 {
4411 CFRelease (ourEvent); 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 }
4412 } 4420 }
4413 else if (menu_will_open_state == MENU_OPENING) 4421 else if (menu_will_open_state == MENU_OPENING)
4414 { 4422 {