all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 32864@debbugs.gnu.org
Cc: alan@idiocy.org, omari@smileystation.com, artemiog@mac.com,
	Robert Pluim <rpluim@gmail.com>,
	simon@simonscientific.com
Subject: bug#32864: 26.1; menus  don't work correctly in Mac OS Mojave
Date: Mon, 3 Jun 2019 19:25:27 +0200	[thread overview]
Message-ID: <D0EB3A93-A4C2-400B-A01B-8A240AA1ABF7@acm.org> (raw)
In-Reply-To: <E3B9991D-F932-475A-AB80-BF2C3FCFA677@acm.org>

Bug explained:

When the user clicks on the menu bar, Emacs receives a menuWillOpen: message, and immediately cancels the menu by sending cancelTracking. It then returns from the event loop to rebuild the menu, but first synthesises a mouse click on the menu bar in the hope that this will make the menu actually open.

In MacOS Mojave, synthetic mouse events are blocked for security reasons, so this no longer works; the synthetic click is discarded and the menu doesn't open. When the user clicks on the menu bar a second time, Emacs believes it's the synthetic click that was acted upon and happily allows the menu to open.

So why does Emacs do this to begin with? Because the menu contents are generated dynamically from elisp code each time. The standard way to do this in Cocoa is to implement menuNeedsUpdate:, but this requires running arbitrary elisp code inside the event loop, which is undesirable for some reason.

The workarounds mentioned involved adding Emacs to some sort of whitelist for legacy applications, but this cannot be a solution. The synthetic mouse click hack must go away.

Could someone explain why, exactly, elisp code cannot be run inside the event loop? An alternative would be to run elisp code in a different thread, and let menuNeedsUpdate: block until the menu has been updated. I'm not sure what the difference would be.






  reply	other threads:[~2019-06-03 17:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28 17:40 bug#32864: 26.1; menus don't work correctly in Mac OS Mojave Artemio González López
2018-09-28 19:40 ` Alan Third
     [not found]   ` <831B596E-F525-41BF-913D-4A976BABBBB0@mac.com>
2018-09-28 19:49     ` Alan Third
2018-10-01 13:12       ` Artemio González López
2018-10-04 18:35         ` Alan Third
2018-11-17 17:15 ` bug#32864: Run from Terminal Omari Norman
2018-11-17 17:19   ` Omari Norman
2019-02-08  8:15 ` bug#32864: 26.1; menus don't work correctly in Mac OS Mojave simonjgeorge
2019-02-11 22:21   ` Alan Third
2019-02-12 10:00     ` Robert Pluim
2019-05-28 18:31 ` Mattias Engdegård
2019-06-03 17:25   ` Mattias Engdegård [this message]
2019-06-03 18:20     ` Eli Zaretskii
2019-06-03 18:52       ` Mattias Engdegård
2019-06-04 16:44     ` Alan Third
2019-06-04 16:53       ` npostavs
2019-06-04 21:08       ` Mattias Engdegård
2019-06-05 21:27         ` Alan Third
2019-06-20  5:44 ` Tak Kunihiro
2020-01-10 12:01   ` pierrea
2020-05-01 16:30 ` bug#32864: menus don't work in Mac OS: see similar issue 24472 and workaround there Marc Herbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D0EB3A93-A4C2-400B-A01B-8A240AA1ABF7@acm.org \
    --to=mattiase@acm.org \
    --cc=32864@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=artemiog@mac.com \
    --cc=omari@smileystation.com \
    --cc=rpluim@gmail.com \
    --cc=simon@simonscientific.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.