From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#44333: 27.1; macOS menu bar 2-clicks Date: Sun, 1 Nov 2020 11:50:32 +0100 Message-ID: <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_A1C175B6-9A8A-4649-A9A8-5102F2AD0DCB" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10837"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 01 11:51:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZAx4-0002bC-DA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 11:51:10 +0100 Original-Received: from localhost ([::1]:57922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZAx2-0003DQ-Uc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 05:51:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZAww-0003DE-84 for bug-gnu-emacs@gnu.org; Sun, 01 Nov 2020 05:51:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZAwv-00059u-Tr for bug-gnu-emacs@gnu.org; Sun, 01 Nov 2020 05:51:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kZAwv-0006iz-SH for bug-gnu-emacs@gnu.org; Sun, 01 Nov 2020 05:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Nov 2020 10:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44333 X-GNU-PR-Package: emacs Original-Received: via spool by 44333-submit@debbugs.gnu.org id=B44333.160422784525823 (code B ref 44333); Sun, 01 Nov 2020 10:51:01 +0000 Original-Received: (at 44333) by debbugs.gnu.org; 1 Nov 2020 10:50:45 +0000 Original-Received: from localhost ([127.0.0.1]:35728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZAwf-0006iR-66 for submit@debbugs.gnu.org; Sun, 01 Nov 2020 05:50:45 -0500 Original-Received: from mail1433c50.megamailservers.eu ([91.136.14.33]:40000 helo=mail263c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZAwc-0006iA-Oi for 44333@debbugs.gnu.org; Sun, 01 Nov 2020 05:50:43 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1604227835; bh=cLTLW49FDkHWeF53ZfRitHApu7yZ+DHQ4fl0v+Zl0wc=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=lgM43G3DexpE0AFdaU6QkLvDyBgCF3J/xb9toQVpVGoN9NV/1Nksuo2mp4ViPEAA8 zDQAgDXjFKGSU0NWVOwYm1bs6p4/DBineh6lWLlzMRAD2ce/5J+pzFeV0ofPNSeoCg VuLSwYQzYBUOqrMHADRYZbqfe4BwnOSngYf2lpMM= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0A1AoWSS026653; Sun, 1 Nov 2020 10:50:34 +0000 In-Reply-To: <20201031150101.GN59267@breton.holly.idiocy.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A782F18.5F9E92FB.0027, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=e6d4tph/ c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=mDV3o1hIAAAA:8 a=Owcshi6Di2Mf1xs0YAYA:9 a=CjuIK1q_8ugA:10 a=tjz2tdEJ13UsWxffbz0A:9 a=De_Ol2h6w80A:10 a=lS9wXHQM5UdnNJ4u63Ry:22 a=_FVE-zBwftR9WsbkzFJk:22 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192338 Archived-At: --Apple-Mail=_A1C175B6-9A8A-4649-A9A8-5102F2AD0DCB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 31 okt. 2020 kl. 16.01 skrev Alan Third : > 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=3D32864#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. --Apple-Mail=_A1C175B6-9A8A-4649-A9A8-5102F2AD0DCB Content-Disposition: attachment; filename=macos-1-click-menu-bar.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="macos-1-click-menu-bar.diff" Content-Transfer-Encoding: 7bit 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) --Apple-Mail=_A1C175B6-9A8A-4649-A9A8-5102F2AD0DCB--