From: "Mattias Engdegård" <mattiase@acm.org>
To: Alan Third <alan@idiocy.org>
Cc: 44333@debbugs.gnu.org,
Viktor Kharitonovich <viktor.kharitonovich@gmail.com>
Subject: bug#44333: 27.1; macOS menu bar 2-clicks
Date: Sun, 1 Nov 2020 11:50:32 +0100 [thread overview]
Message-ID: <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> (raw)
In-Reply-To: <20201031150101.GN59267@breton.holly.idiocy.org>
[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]
31 okt. 2020 kl. 16.01 skrev Alan Third <alan@idiocy.org>:
> IIRC the problem is due to the reposting of the menu click event so
> the menu can be populated when lisp is running. The Mac port doesn't
> have this problem most probably because it's a completely different
> architecture but it has the GUI and lisp parts split into two separate
> threads which is one way I can see of fixing this.
Last time I looked it seemed that the Mac port actually did synthesise events but used some other means (Carbon?), but I may be wrong.
> If anyone else has a simpler solution I'd love to hear it.
Maybe we are overthinking it. I don't think the Cocoa event loop really is running in a different thread. Anecdotal evidence (printf!) indicates that it isn't.
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32864#38 has a previous investigation into the matter.)
I just did the simplest thing possible and it works (with a slight latency at times, but perhaps tolerable). I'd like to know what's wrong with running Lisp in the event loop. It does appear safe to me.
[-- Attachment #2: macos-1-click-menu-bar.diff --]
[-- Type: application/octet-stream, Size: 1595 bytes --]
diff --git a/src/nsmenu.m b/src/nsmenu.m
index a286a80da1..4a99df31fb 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -466,7 +466,7 @@
void
ns_activate_menubar (struct frame *f)
{
-#ifdef NS_IMPL_COCOA
+#if 0 && defined NS_IMPL_COCOA
ns_update_menubar (f, true, nil);
ns_check_pending_open_menu ();
#endif
@@ -514,7 +514,7 @@ - (void)setFrame: (struct frame *)f
frame = f;
}
-#ifdef NS_IMPL_COCOA
+#if 0 && defined NS_IMPL_COCOA
-(void)trackingNotification:(NSNotification *)notification
{
/* Update menu in menuNeedsUpdate only while tracking menus. */
@@ -573,10 +573,12 @@ - (void)menuNeedsUpdate: (NSMenu *)menu
From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the
key press case, NSMenuPropertyItemImage (e.g.) won't be set.
*/
+#if 0
if (trackingMenu == 0)
return;
+#endif
/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */
-#ifdef NS_IMPL_GNUSTEP
+#if 1 || defined NS_IMPL_GNUSTEP
/* Don't know how to do this for anything other than Mac OS X 10.5 and later.
This is wrong, as it might run Lisp code in the event loop. */
ns_update_menubar (frame, true, self);
diff --git a/src/nsterm.m b/src/nsterm.m
index fa38350a2f..8f5658640f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4607,7 +4607,7 @@ in certain situations (rapid incoming events).
#endif
/* GNUstep does not have cancelTracking. */
-#ifdef NS_IMPL_COCOA
+#if 0 && defined NS_IMPL_COCOA
/* Check if menu open should be canceled or continued as normal. */
void
ns_check_menu_open (NSMenu *menu)
next prev parent reply other threads:[~2020-11-01 10:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 17:53 bug#44333: 27.1; macOS menu bar 2-clicks Viktor Kharitonovich
2020-10-30 22:42 ` Alan Third
2020-10-31 14:08 ` Mattias Engdegård
2020-10-31 15:01 ` Alan Third
2020-11-01 10:50 ` Mattias Engdegård [this message]
2020-11-01 17:28 ` Alan Third
2020-12-23 20:33 ` Alan Third
2020-12-25 16:06 ` Mattias Engdegård
2020-12-25 17:26 ` Alan Third
2020-12-25 19:20 ` Alan Third
2020-12-25 22:28 ` Mattias Engdegård
2020-12-26 17:07 ` Alan Third
2020-12-26 17:42 ` Mattias Engdegård
2020-12-26 21:52 ` Alan Third
2020-12-27 16:56 ` Alan Third
2020-12-27 17:14 ` Mattias Engdegård
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6F053CD0-A164-490F-9D15-225D8782C633@acm.org \
--to=mattiase@acm.org \
--cc=44333@debbugs.gnu.org \
--cc=alan@idiocy.org \
--cc=viktor.kharitonovich@gmail.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).