GNU bug report logs -
#34213
27.0.50; Menu bar requires 2 clicks, is unresponsive, or has delays on macOS Mojave
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The mechanism used in the ns port of emacs to cancel menu tracking, and to
post a CGEvent to resume it after menus have been updated via lisp no
longer works on recent macOS versions.
The cause of this bug is due to Apple tightening security in macOS, and no
longer allowing apps to post arbitrary CGEvents to the system.
You can observe a console message on macOS Catalina when the first click
fails: "Sender is prohibited from synthesizing events".
A proposed fix is included inline below, using a newer API
'CGEventPostToPid' instead of CGEventPost. The newer API accepts a pid
specifying the recipient, and when the recipient is the same pid as the
sending process, the event gets posted successfully.
Note: the newer API is only available in macOS versions 10.11 and greater.
David
Fix more menu bar requires 2 clicks (bug#34213)
diff --git a/src/nsterm.m b/src/nsterm.m
index 3ce2233..4dbe1c2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4523,7 +4523,7 @@ in certain situations (rapid incoming events).
menu_mouse_point,
kCGMouseButtonLeft);
CGEventSetType (event, kCGEventLeftMouseDown);
- CGEventPost (kCGHIDEventTap, event);
+ CGEventPostToPid([NSProcessInfo processInfo].processIdentifier,
event);
CFRelease (event);
CFRelease (source);
[Message part 2 (text/html, inline)]
This bug report was last modified 4 years and 141 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.