From unknown Fri Jun 20 07:12:03 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#44333 <44333@debbugs.gnu.org> To: bug#44333 <44333@debbugs.gnu.org> Subject: Status: 27.1; macOS menu bar 2-clicks Reply-To: bug#44333 <44333@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:12:03 +0000 retitle 44333 27.1; macOS menu bar 2-clicks reassign 44333 emacs submitter 44333 Viktor Kharitonovich severity 44333 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 13:57:07 2020 Received: (at submit) by debbugs.gnu.org; 30 Oct 2020 17:57:07 +0000 Received: from localhost ([127.0.0.1]:59619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYYeB-0002sO-1p for submit@debbugs.gnu.org; Fri, 30 Oct 2020 13:57:07 -0400 Received: from lists.gnu.org ([209.51.188.17]:50276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYYaj-0002mr-Gs for submit@debbugs.gnu.org; Fri, 30 Oct 2020 13:53:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYYaj-0002Tm-8h for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 13:53:33 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:42225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYYah-0003FK-CM for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 13:53:32 -0400 Received: by mail-lf1-x12a.google.com with SMTP id a7so8933470lfk.9 for ; Fri, 30 Oct 2020 10:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=5ZE40VLUlI3JrtULsMJhglO7VrasuQA+tBa2ghJylBc=; b=SGCtIOfWcKHrx/y0DAffQszhn1zeNoRtuxuG9hhKlKpEPcP9aYxrWGmrZZIMRvvsFe wMcAX2iKwY/WSjO9MekSDiGxpK0MddhUVv+y6Mjrtw5upENwd89iwOpcN3BKC7WQNFp3 K0o470ITeuRJG8RzSWN0e5SOsdTVaGaDvP07uJo3hwO7Ob12X1Xar6SaTq3PvUhEpVNH laL3KR5StMXybueapUHId5hqclS+k62ZoYe2VGs35rwzkx0XH/7m1ClXwO6/n+F26U0P Hxw2iNT3y+WaAmPx/ZdqQoVhkcGuzX717dHkcoHTA2OoIipf6Vr0FZGc2/2CYXExrmQv k3xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=5ZE40VLUlI3JrtULsMJhglO7VrasuQA+tBa2ghJylBc=; b=gjUXy7EVyZMvxEcc8bVFjgwNJe1/Nwf0zLxCt8aAa+wcwglLj/on1mImUrs1WJesH0 d4n9ucXpcKfvKW4AmnEh2N/hVOz3EK6ZAOly9sBFieN4RjF3Y23V6Lng7dLVKQcLRDQX nA1z9wLsYYqIF6iUbI03l3nQ/revTjiin8g7wdTyCmX04vyK/X1bgtInh3A2k6HXnuFn bBUEDAp/bT3qgEOZCpdanBa7SULJHpH1dKv9/D9kyjmAqliUP0xrHvorN7WZFiv2usXc +x9nnTm0Qfy0O8KvmhSsGnwt1i7HrG8uw/IYW38foDCJ2GfX+XpiarBlfAhF4ikSRNgj /yxQ== X-Gm-Message-State: AOAM531nJCwEW+hkDjPnFVIgSVoePIrmYZjjHRYWBK6aJ0ClOaEm7n2Q M7pSih9mN4yjFHt3H4mBmNdkcjjv4+m3Kg== X-Google-Smtp-Source: ABdhPJy6Nxcs9Pf04h4y2840aOaCmjuklatM1JL4hgqEZ6AjmcgK0eoSW8+CniQ+ZvFs0oSsEkrRBA== X-Received: by 2002:ac2:47fc:: with SMTP id b28mr1367952lfp.454.1604080408739; Fri, 30 Oct 2020 10:53:28 -0700 (PDT) Received: from [192.168.100.6] (mm-167-39-121-178.gomel.dynamic.pppoe.byfly.by. [178.121.39.167]) by smtp.gmail.com with ESMTPSA id j12sm682859lfb.28.2020.10.30.10.53.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Oct 2020 10:53:28 -0700 (PDT) From: Viktor Kharitonovich Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: 27.1; macOS menu bar 2-clicks Message-Id: Date: Fri, 30 Oct 2020 20:53:27 +0300 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3608.120.23.2.4) Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=viktor.kharitonovich@gmail.com; helo=mail-lf1-x12a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 30 Oct 2020 13:57:06 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Hello, On macOS 10.15.7 menu bar behave like a toggle switch. First click is ignored. Then second click opens menu and everything works as expected. = But another next click on menu bar (not on an item) leads to hiding menu bar and then again two clicks are needed for open. In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 = Version 10.14.6 (Build 18G95)) of 2020-08-12 built on builder10-14.porkrind.org Windowing system distributor 'Apple', version 10.3.1894 System Description: Mac OS X 10.15.7 Recent messages: uncompressing ido.el.gz...done Searched 0/1 files Searched 1/1 files Quit Mark set current buffer is now: *unsent posting* Making completion list... [2 times] Quit funcall-interactively: Buffer is read-only: # Making completion list... Configured using: 'configure --with-ns '--enable-locallisppath=3D/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER Important settings: value of $LANG: en_BY.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: display-line-numbers-mode: t shell-dirtrack-mode: t recentf-mode: t ido-everywhere: t projectile-mode: t company-tng-mode: t global-company-mode: t company-mode: t override-global-mode: t delete-selection-mode: t show-paren-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /Users/hrls/.emacs.d/elpa/xref-1.0.3/xref hides = /Applications/Emacs.app/Contents/Resources/lisp/progmodes/xref /Users/hrls/.emacs.d/elpa/project-0.5.2/project hides = /Applications/Emacs.app/Contents/Resources/lisp/progmodes/project /Users/hrls/.emacs.d/elpa/flymake-1.0.9/flymake hides = /Applications/Emacs.app/Contents/Resources/lisp/progmodes/flymake /Users/hrls/.emacs.d/elpa/eldoc-1.11.0/eldoc hides = /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eldoc Features: (shadow sort emacsbug sendmail 5x5 mail-extr ielm cl-print debug display-line-numbers vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc vc vc-dispatcher haskell-doc inf-haskell haskell-decl-scan shell pcomplete haskell haskell-completions haskell-load haskell-commands highlight-uses-mode haskell-modules haskell-sandbox haskell-navigate-imports haskell-repl haskell-svg haskell-collapse hideshow haskell-debug haskell-interactive-mode haskell-presentation-mode haskell-compile haskell-hoogle haskell-process haskell-session haskell-mode haskell-cabal haskell-utils haskell-font-lock haskell-indentation haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports haskell-complete-module haskell-ghc-support flymake-proc flymake warnings dabbrev haskell-customize deeper-blue-theme dichromacy-theme leuven-theme light-blue-theme manoj-dark-theme misterioso-theme tango-dark-theme tango-theme tsdh-dark-theme tsdh-light-theme wheatgrass-theme whiteboard-theme tango-plus-theme recentf tree-widget flatland-theme cus-theme autoload cus-edit cus-start cus-load wid-edit lisp-mnt mm-archive message format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs text-property-search mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils misearch multi-isearch gnutls network-stream url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap epg-config finder-inf dired-aux dired-x vc-git diff-mode cargo cargo-process markdown-mode color noutline outline flycheck time-date pp jka-compr company-oddmuse company-keywords company-etags etags fileloop generator xref project company-gtags company-dabbrev-code company-dabbrev company-files company-clang company-capf company-cmake company-semantic company-template company-bbdb omnitab my-packages helpful imenu trace edebug backtrace info-look advice find-func f dash-functional help-fns radix-tree elisp-refs s dash ido hydra lv projectile grep compile comint ansi-color ibuf-ext rust-mode rx thingatpt company-tng company pcase ace-window avy ring exec-path-from-shell diminish delight cl-extra help-mode use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key easy-mmode use-package-core edmacro kmacro wm suwayyah server wombat-theme dired dired-loaddefs ibuffer ibuffer-loaddefs delsel paren info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 417887 486947) (symbols 48 34423 1) (strings 32 142378 89905) (string-bytes 1 3608995) (vectors 16 44990) (vector-slots 8 604398 45426) (floats 8 351 405) (intervals 56 2562 282) (buffers 1000 43)) From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 18:42:31 2020 Received: (at 44333) by debbugs.gnu.org; 30 Oct 2020 22:42:31 +0000 Received: from localhost ([127.0.0.1]:60083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYd6N-0003tr-35 for submit@debbugs.gnu.org; Fri, 30 Oct 2020 18:42:31 -0400 Received: from wilbur.contactoffice.com ([212.3.242.68]:37116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYd6K-0003ta-CN for 44333@debbugs.gnu.org; Fri, 30 Oct 2020 18:42:30 -0400 Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by wilbur.contactoffice.com (Postfix) with ESMTP id DFE3D234D; Fri, 30 Oct 2020 23:42:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1604097741; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; l=917; bh=7GjZd5lSc6X/VSISdH1SUvSqs/K/4fco8SMF1unFpmw=; b=XwnAo3CFArktj3Gvz5i1xHodTVJTJSSaAQfGSiHEYdF27B5A0dEZssAJaZFXE0wJ 0NEBZ3IY5Y1i83+xvUN95Ymbe2G+Wm6KTigZwXUFj2y3YtI5f9gZQBI/fCGlyoq9G55 6IwJqfNiO5p9l1SlYdV6UAtizzr0TrpuVKS8BZdgnH2OM624JHKKxxqhbuoH78KTfcK Nf/+CiYATCW/N+jRFmPFkaCkiBmSSbrS19I9jwmKy5QTf9fLG0nYOXoGHON66acl3An vUUALZt2XRL5DW4Fv+x7vRL1i4gAdO0b4IO1KUtNbHr83Qg5onN5tSlXhon67R9KKxR 22mXIrKBBQ== Received: by smtp.mailfence.com with ESMTPA ; Fri, 30 Oct 2020 23:42:18 +0100 (CET) Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 9661E20264A3E0; Fri, 30 Oct 2020 22:42:17 +0000 (GMT) Date: Fri, 30 Oct 2020 22:42:17 +0000 From: Alan Third To: Viktor Kharitonovich Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: <20201030224217.GM59267@breton.holly.idiocy.org> Mail-Followup-To: Alan Third , Viktor Kharitonovich , 44333@debbugs.gnu.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Flag: NO X-Spam-Status: No, hits=-2.9 required=4.7 symbols=ALL_TRUSTED, BAYES_00 device=10.2.0.1 X-ContactOffice-Account: com:241649512 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Fri, Oct 30, 2020 at 08:53:27PM +0300, Viktor Kharitonovich wrote: > Hello, > > On macOS 10.15.7 menu bar behave like a toggle switch. First click is > ignored. Then second click opens menu and everything works as expected. But > another next click on menu bar (not on an item) leads to hiding menu bar > and then again two clicks are needed for open. > > > In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) > of 2020-08-12 built on builder10-14.porkrind.org > Windowing system distributor 'Apple', version 10.3.1894 > System Description: Mac OS X 10.15.7 This looks like an emacsformacosx.com build. IIRC you need to add Ruby to the accessibility permissions group in the privacy settings. I'm a little hazy on what needs done here, but if someone who understands this could write it up for PROBLEMS I'd appreciate it. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 31 10:08:26 2020 Received: (at 44333) by debbugs.gnu.org; 31 Oct 2020 14:08:26 +0000 Received: from localhost ([127.0.0.1]:34152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYrYP-0006W9-UT for submit@debbugs.gnu.org; Sat, 31 Oct 2020 10:08:26 -0400 Received: from mail1478c50.megamailservers.eu ([91.136.14.78]:54544 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYrYN-0006Vs-Uk for 44333@debbugs.gnu.org; Sat, 31 Oct 2020 10:08:24 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1604153296; bh=PmsB2rXOzjK0WY6lKSNJQp0squ2CsZiY421namYvbTc=; h=From:Subject:Date:Cc:To:From; b=YGvd2pIvC997ZnzGJHZu//CMs4ndLB8QesLMxB3zAoAEpV77Dojkbaimdy0tp0AzF 8rwDYYR37LlUg+OcX87vSDpKYyYrRzFcuvfWctekp9bGBJ2wViCF6ErFuUTKu138Xt V4ntF1ZhikTc3+qkUJNw1ntLLBsuQ3VREWLiAp2Q= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 09VE8E9S004428; Sat, 31 Oct 2020 14:08:16 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-Id: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> Date: Sat, 31 Oct 2020 15:08:14 +0100 To: Alan Third , Viktor Kharitonovich X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A782F16.5F9D6FD0.00A5, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=KaGsTjQD c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=Qx4dtMXk1sAIIDMUEmQA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) > IIRC you need to add Ruby to the accessibility permissions group in > the privacy settings. What are the privacy/security implications of doing so? Since the Mac port reportedly doesn't suffer from this problem, could we = learn from it and do the same? (There should be a previous bug report.) From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 31 11:01:17 2020 Received: (at 44333) by debbugs.gnu.org; 31 Oct 2020 15:01:17 +0000 Received: from localhost ([127.0.0.1]:34276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYsNZ-0007ug-8J for submit@debbugs.gnu.org; Sat, 31 Oct 2020 11:01:17 -0400 Received: from wilbur.contactoffice.com ([212.3.242.68]:37300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYsNW-0007uS-H3 for 44333@debbugs.gnu.org; Sat, 31 Oct 2020 11:01:15 -0400 Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by wilbur.contactoffice.com (Postfix) with ESMTP id E4952248B; Sat, 31 Oct 2020 16:01:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1604156467; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; l=1022; bh=+FkxSGQ/z0FGZ2KRrv3IK4ultAWQzGW1WdSXTsFSbXU=; b=LbeE/hN1TTJvIlWGG8OS/MNaGst0NcFAZ8piO3xItpWvJvgCzurjA/IBwG4+5IOy WS8rPZ7ul/u8Nbl6Qt2iysOqi8TuPGkzHK8QEh3+vRS0mtH6H93cNHBHUSOsFGsoCLc JAGdaBZXNf0I6vwkl30rP+hKU3reMRKPJzRgDZnrocgIwWoKX8JF/1PYhN4hEqi7HDO k6N2FujJX8a8A8qHGog4wYIV3G41wJKEYT5mEs750LFapEDVIzR9TO4vfUHeElbzhsB 90isafk9zmTEbVfU5Xuy41awEQ0UH0/H0gllTofiZbpirYOPP0DfV/xTEJbxkjfEgud Biu3Jgdvgw== Received: by smtp.mailfence.com with ESMTPA ; Sat, 31 Oct 2020 16:01:02 +0100 (CET) Received: by breton.holly.idiocy.org (Postfix, from userid 501) id AE15F20264B2A2; Sat, 31 Oct 2020 15:01:01 +0000 (GMT) Date: Sat, 31 Oct 2020 15:01:01 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: <20201031150101.GN59267@breton.holly.idiocy.org> Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , Viktor Kharitonovich , 44333@debbugs.gnu.org References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> X-Spam-Flag: NO X-Spam-Status: No, hits=-2.9 required=4.7 symbols=ALL_TRUSTED, BAYES_00 device=10.2.0.20 X-ContactOffice-Account: com:241649512 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Sat, Oct 31, 2020 at 03:08:14PM +0100, Mattias Engdegård wrote: > > IIRC you need to add Ruby to the accessibility permissions group in > > the privacy settings. > > What are the privacy/security implications of doing so? I have no idea. > Since the Mac port reportedly doesn't suffer from this problem, > could we learn from it and do the same? 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. I'm not keen on doing the complete overhaul required because I'll likely introduce more bugs than I'll fix, and I'm pretty sure my next computer isn't going to be a Mac. Introducing lots of bugs then running doesn't seem like a good approach. If anyone else has a simpler solution I'd love to hear it. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 01 05:50:45 2020 Received: (at 44333) by debbugs.gnu.org; 1 Nov 2020 10:50:45 +0000 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 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 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 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_A1C175B6-9A8A-4649-A9A8-5102F2AD0DCB" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Date: Sun, 1 Nov 2020 11:50:32 +0100 In-Reply-To: <20201031150101.GN59267@breton.holly.idiocy.org> To: Alan Third References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <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-Rules: 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-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --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-- From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 01 12:28:57 2020 Received: (at 44333) by debbugs.gnu.org; 1 Nov 2020 17:28:57 +0000 Received: from localhost ([127.0.0.1]:38379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZHA1-0002m3-Il for submit@debbugs.gnu.org; Sun, 01 Nov 2020 12:28:57 -0500 Received: from wilbur.contactoffice.com ([212.3.242.68]:40206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZH9z-0002lq-QG for 44333@debbugs.gnu.org; Sun, 01 Nov 2020 12:28:56 -0500 Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id 197B2C5F; Sun, 1 Nov 2020 18:28:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1604251729; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; l=1013; bh=7+2QwOFTm1jBjIoDtIZCraJRw74/rht+ihnccgI15Yg=; b=BpF8na7fAQ5wwFO/QzZvPppVXmFP9ULpGwhxwFoRDEmXn6XAlghSZU2zOf0/FyQE Mcl1JbtNh6uy/vEVJEYsvLkvkwG14mZJsypkOrMfIZGb2gNT3HHYD31I22iSAA0uaqA jBGnprPeCxmNK3aHhWrbU9kgh+qUj7SgTPS/nGKEL6tMP5tszIJ3Kx3ZuHlX7Cw0Kjb P/4nEWxuzHCqpuRZj5UbHeOHqNIPxLt2nMmy7GzaS89DrEO3ymMjOiW0OMWA/lWubio nWcbaeGtfXJDJuV92b2qXfj/kgV1Vkxdl2hF2VUNaOAE2uelEfWxoTFXb1OElOkt1ht l4/VkZbq8w== Received: by smtp.mailfence.com with ESMTPA ; Sun, 1 Nov 2020 18:28:45 +0100 (CET) Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 9C0D420264C9AF; Sun, 1 Nov 2020 17:28:43 +0000 (GMT) Date: Sun, 1 Nov 2020 17:28:43 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: <20201101172843.GQ59267@breton.holly.idiocy.org> Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> X-Spam-Flag: NO X-Spam-Status: No, hits=-1.0 required=4.7 symbols=ALL_TRUSTED device=10.2.0.21 X-ContactOffice-Account: com:241649512 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Sun, Nov 01, 2020 at 11:50:32AM +0100, Mattias Engdegård wrote: > > 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. On the Mac port? It certainly isn't on the NS port... I don't think the Mac port even really uses the Cocoa event loop, although I could easily be wrong. > (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. We used to have a *lot* of crashes that were related to the event loop and lisp and so on, but if you're confident it isn't a problem feel free to propose a patch and we can give it a go on master. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 23 15:34:12 2020 Received: (at 44333) by debbugs.gnu.org; 23 Dec 2020 20:34:12 +0000 Received: from localhost ([127.0.0.1]:54222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksApn-0000jo-Ht for submit@debbugs.gnu.org; Wed, 23 Dec 2020 15:34:12 -0500 Received: from outbound.soverin.net ([116.202.65.218]:55231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksApk-0000jZ-MU for 44333@debbugs.gnu.org; Wed, 23 Dec 2020 15:34:10 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 586FC60157; Wed, 23 Dec 2020 20:34:02 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1608755641; bh=f7o8o75eTBsBwUKFDfB22bm9lupxGeaYc/SRmaQGpFs=; h=Date:From:To:Subject:References:In-Reply-To:From; b=L7cCfXqlkuaZG3QOBe8mKT3aD0isIibbNp7CQr9hNwQO3sdbpON914a769w2KObnY QA/sE2+aeoLrozh8tUHUQLa2wRtlFeSjvy95mGUAubRlrWw8elYEHWJPyqwJqShRcn +VH6CmUmDn5Qzi1cTD7q6setsJcijnR78RpgJMvlSxUj2ux5nbPiJ1ftz2eICB9qy1 goFTs/UZcWmd/CD4RVnks3pjreXb/FkAlQudS/WXw3i2XQlfFZouelWCCgymgDiHlL vyYV2U+19IdD3YBPa/jZx9jFyGiZ7YzzYAzZcJ1hwgTQTVG+8JpOYBv4wLlcFY9D0v WfLjZj+XN8fCQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 5B96E202917995; Wed, 23 Dec 2020 20:33:57 +0000 (GMT) Date: Wed, 23 Dec 2020 20:33:57 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="/Bw1Hg923KSM+mBz" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201101172843.GQ59267@breton.holly.idiocy.org> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --/Bw1Hg923KSM+mBz Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Nov 01, 2020 at 05:28:43PM +0000, Alan Third wrote: > On Sun, Nov 01, 2020 at 11:50:32AM +0100, Mattias Engdegård wrote: > > > 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. > > On the Mac port? It certainly isn't on the NS port... I don't think > the Mac port even really uses the Cocoa event loop, although I could > easily be wrong. > > > (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. > > We used to have a *lot* of crashes that were related to the event loop > and lisp and so on, but if you're confident it isn't a problem feel > free to propose a patch and we can give it a go on master. OK, I've had a go at this and tried removing EVERYTHING related to the delayed menu stuff and, as you say, it seems fine, but I barely ever use the menus, so I could be missing something. For the record, the menu code (or maybe it's the toolbar, but I suspect the menus) kills GNUstep builds stone dead as soon as you try typing anything. It looks from the debugger like Emacs is still running, but it just won't update the screen. Turning off the menus appears to fix it. -- Alan Third --/Bw1Hg923KSM+mBz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Remove-NS-menu-synthesized-events-bug-44333.patch" >From 0e07430da3ad68bdc375aa1ac2688c2eadbbe88f Mon Sep 17 00:00:00 2001 From: Alan Third Date: Wed, 23 Dec 2020 20:12:02 +0000 Subject: [PATCH] Remove NS menu synthesized events (bug#44333) * src/nsmenu.m (ns_update_menubar): Remove GNUstep special case that's no longer needed. (ns_activate_menubar): ([EmacsMenu trackingNotification:]): ([EmacsMenu menuWillOpen:]): ([EmacsMenu menuDidClose:]): Remove unused functions. ([EmacsMenu menuNeedsUpdate:]): Remove menu tracking code. * src/nsterm.m (ns_check_menu_open): (ns_check_pending_open_menu): (ns_create_terminal): Remove unused functions. (ns_term_init): Get rid of menu tracking. --- src/nsmenu.m | 78 --------------------------------------- src/nsterm.h | 2 - src/nsterm.m | 101 --------------------------------------------------- 3 files changed, 181 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index efad978316..d72f9c61be 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -58,10 +58,6 @@ /* Nonzero means a menu is currently active. */ static int popup_activated_flag; -/* Nonzero means we are tracking and updating menus. */ -static int trackingMenu; - - /* NOTE: toolbar implementation is at end, following complete menu implementation. */ @@ -141,10 +137,6 @@ t = -(1000*tb.time+tb.millitm); #endif -#ifdef NS_IMPL_GNUSTEP - deep_p = 1; /* until GNUstep NSMenu implements the Panther delegation model */ -#endif - if (deep_p) { /* Fully parse one or more of the submenus. */ @@ -463,17 +455,6 @@ ns_update_menubar (f, deep_p, nil); } -void -ns_activate_menubar (struct frame *f) -{ -#ifdef NS_IMPL_COCOA - ns_update_menubar (f, true, nil); - ns_check_pending_open_menu (); -#endif -} - - - /* ========================================================================== @@ -514,43 +495,6 @@ - (void)setFrame: (struct frame *)f frame = f; } -#ifdef NS_IMPL_COCOA --(void)trackingNotification:(NSNotification *)notification -{ - /* Update menu in menuNeedsUpdate only while tracking menus. */ - trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification - ? 1 : 0); - if (! trackingMenu) ns_check_menu_open (nil); -} - -- (void)menuWillOpen:(NSMenu *)menu -{ - ++trackingMenu; - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - // On 10.6 we get repeated calls, only the one for NSSystemDefined is "real". - if ( -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - NSAppKitVersionNumber < NSAppKitVersionNumber10_7 && -#endif - [[NSApp currentEvent] type] != NSEventTypeSystemDefined) - return; -#endif - - /* When dragging from one menu to another, we get willOpen followed by didClose, - i.e. trackingMenu == 3 in willOpen and then 2 after didClose. - We have updated all menus, so avoid doing it when trackingMenu == 3. */ - if (trackingMenu == 2) - ns_check_menu_open (menu); -} - -- (void)menuDidClose:(NSMenu *)menu -{ - --trackingMenu; -} - -#endif /* NS_IMPL_COCOA */ - /* Delegate method called when a submenu is being opened: run a 'deep' call to set_frame_menubar. */ - (void)menuNeedsUpdate: (NSMenu *)menu @@ -558,29 +502,7 @@ - (void)menuNeedsUpdate: (NSMenu *)menu if (!FRAME_LIVE_P (frame)) return; - /* Cocoa/Carbon will request update on every keystroke - via IsMenuKeyEvent -> CheckMenusForKeyEvent. These are not needed - since key equivalents are handled through emacs. - On Leopard, even keystroke events generate SystemDefined event. - Third-party applications that enhance mouse / trackpad - interaction, or also VNC/Remote Desktop will send events - of type AppDefined rather than SysDefined. - Menus will fail to show up if they haven't been initialized. - AppDefined events may lack timing data. - - Thus, we rely on the didBeginTrackingNotification notification - as above to indicate the need for updates. - From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the - key press case, NSMenuPropertyItemImage (e.g.) won't be set. - */ - if (trackingMenu == 0) - return; -/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */ -#ifdef 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); -#endif } diff --git a/src/nsterm.h b/src/nsterm.h index 94472ec107..0b7e27c00f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1130,8 +1130,6 @@ ns_query_color (void *col, Emacs_Color *color_def, bool setPixel); extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); extern unsigned long ns_index_color (NSColor *color, struct frame *f); extern const char *ns_get_pending_menu_title (void); -extern void ns_check_menu_open (NSMenu *menu); -extern void ns_check_pending_open_menu (void); #endif /* Implemented in nsfns, published in nsterm. */ diff --git a/src/nsterm.m b/src/nsterm.m index 2a117a0780..161677484f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -310,24 +310,6 @@ - (NSColor *)colorUsingDefaultColorSpace NULL, 0, 0 }; -#ifdef NS_IMPL_COCOA -/* - * State for pending menu activation: - * MENU_NONE Normal state - * MENU_PENDING A menu has been clicked on, but has been canceled so we can - * run lisp to update the menu. - * MENU_OPENING Menu is up to date, and the click event is redone so the menu - * will open. - */ -#define MENU_NONE 0 -#define MENU_PENDING 1 -#define MENU_OPENING 2 -static int menu_will_open_state = MENU_NONE; - -/* Saved position for menu click. */ -static CGPoint menu_mouse_point; -#endif - /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 #define NSLeftControlKeyMask (0x000001 | NSEventModifierFlagControl) @@ -4607,79 +4589,6 @@ in certain situations (rapid incoming events). } #endif -/* GNUstep does not have cancelTracking. */ -#ifdef NS_IMPL_COCOA -/* Check if menu open should be canceled or continued as normal. */ -void -ns_check_menu_open (NSMenu *menu) -{ - /* Click in menu bar? */ - NSArray *a = [[NSApp mainMenu] itemArray]; - int i; - BOOL found = NO; - - if (menu == nil) // Menu tracking ended. - { - if (menu_will_open_state == MENU_OPENING) - menu_will_open_state = MENU_NONE; - return; - } - - for (i = 0; ! found && i < [a count]; i++) - found = menu == [[a objectAtIndex:i] submenu]; - if (found) - { - if (menu_will_open_state == MENU_NONE && emacs_event) - { - NSEvent *theEvent = [NSApp currentEvent]; - struct frame *emacsframe = SELECTED_FRAME (); - - /* On macOS, the following can cause an event loop when the - Spotlight for Help search field is populated. Avoid this by - not postponing mouse drag and non-user-generated mouse down - events (Bug#31371). */ - if (([theEvent type] == NSEventTypeLeftMouseDown) - && [theEvent eventNumber]) - { - [menu cancelTracking]; - menu_will_open_state = MENU_PENDING; - emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; - EV_TRAILER (theEvent); - - CGEventRef ourEvent = CGEventCreate (NULL); - menu_mouse_point = CGEventGetLocation (ourEvent); - CFRelease (ourEvent); - } - } - else if (menu_will_open_state == MENU_OPENING) - { - menu_will_open_state = MENU_NONE; - } - } -} - -/* Redo saved menu click if state is MENU_PENDING. */ -void -ns_check_pending_open_menu () -{ - if (menu_will_open_state == MENU_PENDING) - { - CGEventSourceRef source - = CGEventSourceCreate (kCGEventSourceStateHIDSystemState); - - CGEventRef event = CGEventCreateMouseEvent (source, - kCGEventLeftMouseDown, - menu_mouse_point, - kCGMouseButtonLeft); - CGEventSetType (event, kCGEventLeftMouseDown); - CGEventPost (kCGHIDEventTap, event); - CFRelease (event); - CFRelease (source); - - menu_will_open_state = MENU_OPENING; - } -} -#endif /* NS_IMPL_COCOA */ static int ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) @@ -5416,7 +5325,6 @@ static Lisp_Object ns_new_font (struct frame *f, Lisp_Object font_object, terminal->set_new_font_hook = ns_new_font; terminal->implicit_set_name_hook = ns_implicitly_set_name; terminal->menu_show_hook = ns_menu_show; - terminal->activate_menubar_hook = ns_activate_menubar; terminal->popup_dialog_hook = ns_popup_dialog; terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar; @@ -5661,15 +5569,6 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. [NSApp setServicesMenu: svcsMenu]; /* Needed at least on Cocoa, to get dock menu to show windows */ [NSApp setWindowsMenu: [[NSMenu alloc] init]]; - - [[NSNotificationCenter defaultCenter] - addObserver: mainMenu - selector: @selector (trackingNotification:) - name: NSMenuDidBeginTrackingNotification object: mainMenu]; - [[NSNotificationCenter defaultCenter] - addObserver: mainMenu - selector: @selector (trackingNotification:) - name: NSMenuDidEndTrackingNotification object: mainMenu]; } #endif /* macOS menu setup */ -- 2.29.2 --/Bw1Hg923KSM+mBz-- From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 25 11:06:23 2020 Received: (at 44333) by debbugs.gnu.org; 25 Dec 2020 16:06:23 +0000 Received: from localhost ([127.0.0.1]:58072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kspbi-0007mf-Ps for submit@debbugs.gnu.org; Fri, 25 Dec 2020 11:06:23 -0500 Received: from mail177c50.megamailservers.eu ([91.136.10.187]:57952 helo=mail51c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kspbg-0007mU-9a for 44333@debbugs.gnu.org; Fri, 25 Dec 2020 11:06:21 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1608912378; bh=OcD8D4qfD2SKnfbwVUWZGk6teYhIwg6TLMc1j1iMmj0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=R3wSyTdhOhAGsBFbN7JZkWnw5UWa21Uhw5LL3JBs6eOiKJ4Ld3oRKktU8HSskf2J/ 6g2zRlxUCsgVGb7DJaFlS7aRZ9MAxFiOfFI4RZansaohYOJBax7XMPvt8IODyaLwJ3 66e/4Sm2u6jCumC/zwy8xIK3XievKwDB58d06a18= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail51c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BPG6G9V001121; Fri, 25 Dec 2020 16:06:17 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Fri, 25 Dec 2020 17:06:15 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> To: Alan Third X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F19.5FE60DFA.002D, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=KvgzJleN c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=zw1i4F1qJtcnNk9eB90A:9 a=CjuIK1q_8ugA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 23 dec. 2020 kl. 21.33 skrev Alan Third : > OK, I've had a go at this and tried removing EVERYTHING related to the > delayed menu stuff and, as you say, it seems fine, but I barely ever > use the menus, so I could be missing something. Thank you, I tried exactly the same thing. While it works, there are = annoying delays in dropping down the menus -- sometimes they come down = immediately, but more often than not I get a delay of 100-300 ms. Do you = experience them too? In any case, it's a lot better than the previous double-clutch menus. I = rarely use the menus either but partly because they were so annoying; I = find them useful for discovering functionality and keys in packages. = Getting rid of the delays would be nice, though. > For the record, the menu code (or maybe it's the toolbar, but I > suspect the menus) kills GNUstep builds stone dead as soon as you try > typing anything. It looks from the debugger like Emacs is still > running, but it just won't update the screen. Turning off the menus > appears to fix it. Maybe we could make the change conditional on GNUstep? From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 25 12:27:02 2020 Received: (at 44333) by debbugs.gnu.org; 25 Dec 2020 17:27:02 +0000 Received: from localhost ([127.0.0.1]:58117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksqrm-0003Mb-7r for submit@debbugs.gnu.org; Fri, 25 Dec 2020 12:27:02 -0500 Received: from outbound.soverin.net ([116.202.65.218]:34585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksqrj-0003MG-GN for 44333@debbugs.gnu.org; Fri, 25 Dec 2020 12:27:00 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 79A20600E9; Fri, 25 Dec 2020 17:26:53 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1608917212; bh=E4+A23wZDmpLvkeq/46BA8EPvvKktZ+FzGH+iFUjSss=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L+vslsD3O4Gmh6RM+3aomujG/9V/waNnYIuqWRF/tjBoHEJMQ4Tx0Vfc5ketmk7Qc +v59EEoyw0pZCsClk2YXz1Wf1OVpTy/kIimLvdL8WF2mhy42HZv9ByNu39CO7e98Bv pzj+FQAB+V9XbwcmRqmXSwkttdmMqvNPw4jXNRLfDyduySCOfi/+ZRqk6/kU0SC81L ShGMeNgEENTxjk0nh/YPwLhK+XpegxhPGWd1NKSzI068WZ0FyH173jLUUhLfdowD2V XLmVdbBiBT9hNmc45ab65vKg1PT2nhEP8ap3N/8Xykpl+QhU6XVi3erObfskVNn0Vc iiOxTyIynizBA== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 8ABD7202927D12; Fri, 25 Dec 2020 17:26:49 +0000 (GMT) Date: Fri, 25 Dec 2020 17:26:49 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Fri, Dec 25, 2020 at 05:06:15PM +0100, Mattias Engdegård wrote: > 23 dec. 2020 kl. 21.33 skrev Alan Third : > > > OK, I've had a go at this and tried removing EVERYTHING related to the > > delayed menu stuff and, as you say, it seems fine, but I barely ever > > use the menus, so I could be missing something. > > Thank you, I tried exactly the same thing. While it works, there are > annoying delays in dropping down the menus -- sometimes they come > down immediately, but more often than not I get a delay of 100-300 > ms. Do you experience them too? > > In any case, it's a lot better than the previous double-clutch > menus. I rarely use the menus either but partly because they were so > annoying; I find them useful for discovering functionality and keys > in packages. Getting rid of the delays would be nice, though. I don't see how the delays can be new as the menus would have to be recalculated under the old code anyway... It is quite noticeable, though... I notice this in the Apple docs[1]: If populating the menu will take a long time, implement numberOfItemsInMenu: and menu:updateItem:atIndex:shouldCancel: instead. I wonder if that's possible for us. ns_update_menubar is a big, complicated function that I've not been over in depth to work out what it's doing, so I don't know if it would be practical to break it up like I suspect using those two methods would require. > > For the record, the menu code (or maybe it's the toolbar, but I > > suspect the menus) kills GNUstep builds stone dead as soon as you try > > typing anything. It looks from the debugger like Emacs is still > > running, but it just won't update the screen. Turning off the menus > > appears to fix it. > > Maybe we could make the change conditional on GNUstep? Sorry, I was unclear. This is an older problem. I'm not sure when it was introduced. [1] https://developer.apple.com/documentation/appkit/nsmenudelegate/1518235-menuneedsupdate?language=objc -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 25 14:20:41 2020 Received: (at 44333) by debbugs.gnu.org; 25 Dec 2020 19:20:41 +0000 Received: from localhost ([127.0.0.1]:58148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kssdk-0005yM-QQ for submit@debbugs.gnu.org; Fri, 25 Dec 2020 14:20:41 -0500 Received: from outbound.soverin.net ([116.202.65.218]:59281) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kssdg-0005y5-NX for 44333@debbugs.gnu.org; Fri, 25 Dec 2020 14:20:39 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id D47C5600E9; Fri, 25 Dec 2020 19:20:29 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1608924028; bh=dLK2ijF55FGJxg4KORQOfBWoBt2UhSs4Zr2W//gUgXk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=pqoQhl45rr5ijnZoAMmRl8cNvp8arCX7v75oehPc71XilrnRVlbZ3bpTIQQveu/Ea tEIBfxlcN1z4V9Gj9XBAOcsfd9z+IXUNA15/pCV/bgOtKQSytU3eL/XnIVct2qs2V6 47JU/UCOszjNN/ZQJtZustCMzo5Cv2DB28r7lB2FDDeCsOCm0kf8o9qsL9ITnr+oPh KB2J//G0ABcbLw4uDwvkOWkPp9ngrdXBZ860TSdwPwT973tVuuNxj4PkBDAsggcWbd Ic/jfpVpydjBmI6y4TjGMij6Xf5FRD36Ku9bfrOqAPm26B2AEXQEn/HqLVxnqOEcCx nQZ0+CV7SCkSQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id ED4AC20292B579; Fri, 25 Dec 2020 19:20:23 +0000 (GMT) Date: Fri, 25 Dec 2020 19:20:23 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Fri, Dec 25, 2020 at 05:26:49PM +0000, Alan Third wrote: > ns_update_menubar is a big, complicated function that I've not been > over in depth to work out what it's doing, so I don't know if it > would be practical to break it up like I suspect using those two > methods would require. I've had a look through it, and I've noticed that most of the work appears to be building a tree of widget_value structs. A quick look at xmenu.c and w32menu.c leaves me with the impression that they have almost identical code for that part, but for some reason the NS port is different (and is full of "FIXME: this is broken" comments). So I suppose the first thing to do should be to align the NS code with the other terminals, and see if that improves things. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 25 17:29:03 2020 Received: (at 44333) by debbugs.gnu.org; 25 Dec 2020 22:29:03 +0000 Received: from localhost ([127.0.0.1]:58400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksva2-0004Pa-Ot for submit@debbugs.gnu.org; Fri, 25 Dec 2020 17:29:02 -0500 Received: from mail211c50.megamailservers.eu ([91.136.10.221]:60384 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksva0-0004P6-VK for 44333@debbugs.gnu.org; Fri, 25 Dec 2020 17:29:01 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1608935339; bh=CV5yF5bI/BjcI87ev9U619Gsw/BNYnbvtCAa4MJ5XyA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=EEs5XhFtQWOXHpcALKGKM1Pg4OJ5IeImzFZ+QaJ92SZjzis04otFQJ5gL2CSoZPBq ++jN32HyrUIb2T9dExAM13tHvd4HglEw5jTwWXfUhJjldZa0ytRhh/sFhTsJk09jqW q5tuIPxdHifPbqYoxIRBELHssei6795t3u6HoI0E= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BPMSuse004622; Fri, 25 Dec 2020 22:28:58 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Fri, 25 Dec 2020 23:28:56 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> To: Alan Third X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1E.5FE667AB.000E, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=AfXP4EfG c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=LNTZolJXhuqFKbQtaz8A:9 a=CjuIK1q_8ugA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 25 dec. 2020 kl. 20.20 skrev Alan Third : >=20 > On Fri, Dec 25, 2020 at 05:26:49PM +0000, Alan Third wrote: >> ns_update_menubar is a big, complicated function that I've not been >> over in depth to work out what it's doing, so I don't know if it >> would be practical to break it up like I suspect using those two >> methods would require. >=20 > I've had a look through it, and I've noticed that most of the work > appears to be building a tree of widget_value structs. A quick look at > xmenu.c and w32menu.c leaves me with the impression that they have > almost identical code for that part, but for some reason the NS port > is different (and is full of "FIXME: this is broken" comments). >=20 > So I suppose the first thing to do should be to align the NS code with > the other terminals, and see if that improves things. Probably. When the code suffers from one of its slow spells, the time is = apparently spent in the calls to parse_single_submenu, and from there... = single_keymap_panes, I think. Didn't dig deeper after that. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 26 12:08:19 2020 Received: (at 44333) by debbugs.gnu.org; 26 Dec 2020 17:08:19 +0000 Received: from localhost ([127.0.0.1]:59835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktD3B-0007wa-T6 for submit@debbugs.gnu.org; Sat, 26 Dec 2020 12:08:19 -0500 Received: from outbound.soverin.net ([116.202.65.218]:34467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktD34-0007wE-AI for 44333@debbugs.gnu.org; Sat, 26 Dec 2020 12:08:16 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id B1DC4600E9; Sat, 26 Dec 2020 17:08:03 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609002482; bh=12F0FRimldt+XEcdhgYQoaGnnsFmUWQoHIpPHrIEJdY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dh/WbG19IT2Ko2TCM+MydMzDrL/jsq2qarytdjult6lJafPZ0ViPaqdpv4tSTdVUR CxEZMAXKTEGBlIngo3LpCIHqyxuIMfhuLAMInDY0Rfx/5hfd6XuOk8Jh1380Wq4f0I qP7S5SjvvEOcRKfoJbUhl98NTi3GvWzBUHRMoEl/Y0lySv8xbZ6syeeqMjoE7dp23a aq6gPu1M+/h/ARvyDUEUoh3bTgmoOxbUJfMJLXAM2ii2Nr4uyxX0aeffox7kcrLtl0 5HpNLbhvi9e+2LVJIr3emN9JJuM+G5rI2dfSkE8wkmnLpSLlSYKaFgaBruwlPqkLu0 9FotguyveKCdg== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id BA58C20292F017; Sat, 26 Dec 2020 17:07:58 +0000 (GMT) Date: Sat, 26 Dec 2020 17:07:58 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boZ9RPumkWPrn11Y" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --boZ9RPumkWPrn11Y Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Dec 25, 2020 at 11:28:56PM +0100, Mattias Engdegård wrote: > 25 dec. 2020 kl. 20.20 skrev Alan Third : > > > > On Fri, Dec 25, 2020 at 05:26:49PM +0000, Alan Third wrote: > >> ns_update_menubar is a big, complicated function that I've not been > >> over in depth to work out what it's doing, so I don't know if it > >> would be practical to break it up like I suspect using those two > >> methods would require. > > > > I've had a look through it, and I've noticed that most of the work > > appears to be building a tree of widget_value structs. A quick look at > > xmenu.c and w32menu.c leaves me with the impression that they have > > almost identical code for that part, but for some reason the NS port > > is different (and is full of "FIXME: this is broken" comments). > > > > So I suppose the first thing to do should be to align the NS code with > > the other terminals, and see if that improves things. > > Probably. When the code suffers from one of its slow spells, the > time is apparently spent in the calls to parse_single_submenu, and > from there... single_keymap_panes, I think. Didn't dig deeper after > that. Does the attached seem any better? It appears to me like the first click on a menu is slightly faster (but that may be my imagination), and subsequent menus are instant. -- Alan Third --boZ9RPumkWPrn11Y Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Remove-NS-menu-synthesized-events-bug-44333.patch" >From 887a5ac84ca5c86fef5762cbc48abbfee291b751 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Wed, 23 Dec 2020 20:12:02 +0000 Subject: [PATCH v2] Remove NS menu synthesized events (bug#44333) * src/nsmenu.m (ns_update_menubar): Copy the parsing code from xmenu.c and rework the NS specific code around it. (ns_activate_menubar): ([EmacsMenu trackingNotification:]): ([EmacsMenu menuWillOpen:]): ([EmacsMenu menuDidClose:]): Remove unused functions. ([EmacsMenu menuNeedsUpdate:]): Remove menu tracking code and add code to check whether an update is required. (syms_of_nsmenu): Remove tracking code. * src/nsterm.m (ns_check_menu_open): (ns_check_pending_open_menu): (ns_create_terminal): Remove unused functions. (ns_term_init): Get rid of menu tracking. --- src/nsmenu.m | 377 ++++++++++++++++----------------------------------- src/nsterm.h | 2 - src/nsterm.m | 101 -------------- 3 files changed, 115 insertions(+), 365 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index efad978316..b5d0821323 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -58,9 +58,7 @@ /* Nonzero means a menu is currently active. */ static int popup_activated_flag; -/* Nonzero means we are tracking and updating menus. */ -static int trackingMenu; - +static BOOL needs_deep_update = YES; /* NOTE: toolbar implementation is at end, following complete menu implementation. */ @@ -98,16 +96,18 @@ 3) deep_p, submenu = non-nil: Update contents of a single submenu. -------------------------------------------------------------------------- */ static void -ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) +ns_update_menubar (struct frame *f, bool deep_p) { NSAutoreleasePool *pool; - id menu = [NSApp mainMenu]; - static EmacsMenu *last_submenu = nil; BOOL needsSet = NO; - bool owfi; + id menu = [NSApp mainMenu]; + Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; int i; + int *submenu_start, *submenu_end; + bool *submenu_top_level_items; + int *submenu_n_panes; #if NSMENUPROFILE struct timeb tb; @@ -141,115 +141,94 @@ t = -(1000*tb.time+tb.millitm); #endif -#ifdef NS_IMPL_GNUSTEP - deep_p = 1; /* until GNUstep NSMenu implements the Panther delegation model */ -#endif - if (deep_p) { - /* Fully parse one or more of the submenus. */ - int n = 0; - int *submenu_start, *submenu_end; - bool *submenu_top_level_items; - int *submenu_n_panes; + /* Make a widget-value tree representing the entire menu trees. */ + struct buffer *prev = current_buffer; Lisp_Object buffer; ptrdiff_t specpdl_count = SPECPDL_INDEX (); int previous_menu_items_used = f->menu_bar_items_used; Lisp_Object *previous_items = alloca (previous_menu_items_used * sizeof *previous_items); + int subitems; - /* lisp preliminaries */ buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; specbind (Qinhibit_quit, Qt); + /* Don't let the debugger step into this code + because it is not reentrant. */ specbind (Qdebug_on_next_call, Qnil); + record_unwind_save_match_data (); if (NILP (Voverriding_local_map_menu_flag)) { specbind (Qoverriding_terminal_local_map, Qnil); specbind (Qoverriding_local_map, Qnil); } - set_buffer_internal_1 (XBUFFER (buffer)); - /* TODO: for some reason this is not needed in other terms, - but some menu updates call Info-extract-pointer which causes - abort-on-error if waiting-for-input. Needs further investigation. */ - owfi = waiting_for_input; - waiting_for_input = 0; + set_buffer_internal_1 (XBUFFER (buffer)); - /* lucid hook and possible reset */ + /* Run the Lucid hook. */ safe_run_hooks (Qactivate_menubar_hook); + + /* If it has changed current-menubar from previous value, + really recompute the menubar from the value. */ if (! NILP (Vlucid_menu_bar_dirty_flag)) call0 (Qrecompute_lucid_menubar); safe_run_hooks (Qmenu_bar_update_hook); fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); - /* Now ready to go */ items = FRAME_MENU_BAR_ITEMS (f); - /* Save the frame's previous menu bar contents data */ + /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - memcpy (previous_items, aref_addr (f->menu_bar_vector, 0), - previous_menu_items_used * sizeof (Lisp_Object)); + memcpy (previous_items, xvector_contents (f->menu_bar_vector), + previous_menu_items_used * word_size); - /* parse stage 1: extract from lisp */ + /* Fill in menu_items with the current menu bar contents. + This can evaluate Lisp code. */ save_menu_items (); menu_items = f->menu_bar_vector; menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; - submenu_start = alloca (ASIZE (items) * sizeof *submenu_start); - submenu_end = alloca (ASIZE (items) * sizeof *submenu_end); - submenu_n_panes = alloca (ASIZE (items) * sizeof *submenu_n_panes); - submenu_top_level_items = alloca (ASIZE (items) + subitems = ASIZE (items) / 4; + submenu_start = alloca ((subitems + 1) * sizeof *submenu_start); + submenu_end = alloca (subitems * sizeof *submenu_end); + submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes); + submenu_top_level_items = alloca (subitems * sizeof *submenu_top_level_items); init_menu_items (); - for (i = 0; i < ASIZE (items); i += 4) + for (i = 0; i < subitems; i++) { Lisp_Object key, string, maps; - key = AREF (items, i); - string = AREF (items, i + 1); - maps = AREF (items, i + 2); + key = AREF (items, 4 * i); + string = AREF (items, 4 * i + 1); + maps = AREF (items, 4 * i + 2); if (NILP (string)) break; - /* FIXME: we'd like to only parse the needed submenu, but this - was causing crashes in the _common parsing code: need to make - sure proper initialization done. */ - /* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) - continue; */ - submenu_start[i] = menu_items_used; menu_items_n_panes = 0; - submenu_top_level_items[i] = parse_single_submenu (key, string, maps); + submenu_top_level_items[i] + = parse_single_submenu (key, string, maps); submenu_n_panes[i] = menu_items_n_panes; + submenu_end[i] = menu_items_used; - n++; } + submenu_start[i] = -1; finish_menu_items (); - waiting_for_input = owfi; - - if (submenu && n == 0) - { - /* should have found a menu for this one but didn't */ - fprintf (stderr, "ERROR: did not find lisp menu for submenu '%s'.\n", - [[submenu title] UTF8String]); - discard_menu_items (); - unbind_to (specpdl_count, Qnil); - unblock_input (); - return; - } + /* Convert menu_items into widget_value trees + to display the menu. This cannot evaluate Lisp code. */ - /* parse stage 2: insert into lucid 'widget_value' structures - [comments in other terms say not to evaluate lisp code here] */ wv = make_widget_value ("menubar", NULL, true, Qnil); wv->button_type = BUTTON_TYPE_NONE; first_wv = wv; - for (i = 0; i < 4*n; i += 4) + for (i = 0; submenu_start[i] >= 0; i++) { menu_items_n_panes = submenu_n_panes[i]; wv = digest_single_submenu (submenu_start[i], submenu_end[i], @@ -259,158 +238,115 @@ else first_wv->contents = wv; /* Don't set wv->name here; GC during the loop might relocate it. */ - wv->enabled = 1; + wv->enabled = true; wv->button_type = BUTTON_TYPE_NONE; prev_wv = wv; } set_buffer_internal_1 (prev); - /* Compare the new menu items with previous, and leave off if no change. */ - /* FIXME: following other terms here, but seems like this should be - done before parse stage 2 above, since its results aren't used. */ - if (previous_menu_items_used - && (!submenu || (submenu && submenu == last_submenu)) - && menu_items_used == previous_menu_items_used) - { - for (i = 0; i < previous_menu_items_used; i++) - /* FIXME: this ALWAYS fails on Buffers menu items.. something - about their strings causes them to change every time, so we - double-check failures. */ - if (!EQ (previous_items[i], AREF (menu_items, i))) - if (!(STRINGP (previous_items[i]) - && STRINGP (AREF (menu_items, i)) - && !strcmp (SSDATA (previous_items[i]), - SSDATA (AREF (menu_items, i))))) - break; - if (i == previous_menu_items_used) - { - /* No change. */ + /* If there has been no change in the Lisp-level contents + of the menu bar, skip redisplaying it. Just exit. */ -#if NSMENUPROFILE - ftime (&tb); - t += 1000*tb.time+tb.millitm; - fprintf (stderr, "NO CHANGE! CUTTING OUT after %ld msec.\n", t); -#endif + /* Compare the new menu items with the ones computed last time. */ + for (i = 0; i < previous_menu_items_used; i++) + if (menu_items_used == i + || (!EQ (previous_items[i], AREF (menu_items, i)))) + break; + if (i == menu_items_used && i == previous_menu_items_used && i != 0) + { + /* The menu items have not changed. Don't bother updating + the menus in any form, since it would be a no-op. */ + free_menubar_widget_value_tree (first_wv); + discard_menu_items (); + unbind_to (specpdl_count, Qnil); + return; + } - free_menubar_widget_value_tree (first_wv); - discard_menu_items (); - unbind_to (specpdl_count, Qnil); - unblock_input (); - return; - } - } /* The menu items are different, so store them in the frame. */ - /* FIXME: this is not correct for single-submenu case. */ fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; - /* Calls restore_menu_items, etc., as they were outside. */ + /* This undoes save_menu_items. */ unbind_to (specpdl_count, Qnil); - /* Parse stage 2a: now GC cannot happen during the lifetime of the - widget_value, so it's safe to store data from a Lisp_String. */ + /* Now GC cannot happen during the lifetime of the widget_value, + so it's safe to store data from a Lisp_String. */ wv = first_wv->contents; for (i = 0; i < ASIZE (items); i += 4) { Lisp_Object string; string = AREF (items, i + 1); if (NILP (string)) - break; - - wv->name = SSDATA (string); + break; + wv->name = SSDATA (string); update_submenu_strings (wv->contents); - wv = wv->next; + wv = wv->next; } - /* Now, update the NS menu; if we have a submenu, use that, otherwise - create a new menu for each sub and fill it. */ - if (submenu) - { - const char *submenuTitle = [[submenu title] UTF8String]; - for (wv = first_wv->contents; wv; wv = wv->next) - { - if (!strcmp (submenuTitle, wv->name)) - { - [submenu fillWithWidgetValue: wv->contents]; - last_submenu = submenu; - break; - } - } - } - else - { - [menu fillWithWidgetValue: first_wv->contents frame: f]; - } - } else { - static int n_previous_strings = 0; - static char previous_strings[100][10]; - static struct frame *last_f = NULL; - int n; - Lisp_Object string; + /* Make a widget-value tree containing + just the top level menu bar strings. */ wv = make_widget_value ("menubar", NULL, true, Qnil); wv->button_type = BUTTON_TYPE_NONE; first_wv = wv; - /* Make widget-value tree with just the top level menu bar strings. */ items = FRAME_MENU_BAR_ITEMS (f); - if (NILP (items)) - { - free_menubar_widget_value_tree (first_wv); - unblock_input (); - return; - } - - - /* Check if no change: this mechanism is a bit rough, but ready. */ - n = ASIZE (items) / 4; - if (f == last_f && n_previous_strings == n) - { - for (i = 0; ibutton_type = BUTTON_TYPE_NONE; + /* This prevents lwlib from assuming this + menu item is really supposed to be empty. */ + /* The intptr_t cast avoids a warning. + This value just has to be different from small integers. */ wv->call_data = (void *) (intptr_t) (-1); + if (prev_wv) + prev_wv->next = wv; + else + first_wv->contents = wv; + prev_wv = wv; + } + + /* Forget what we thought we knew about what is in the + detailed contents of the menu bar menus. + Changing the top level always destroys the contents. */ + f->menu_bar_items_used = 0; + } + + /* Now, update the NS menu. */ + if (deep_p) + { + /* This path is typically used when a menu has been clicked. I + think Apple expect us to only update that one menu, however + to update one we need to do the hard work of parsing the + whole tree, so we may as well update them all. */ + int i = 1; + + for (wv = first_wv->contents; wv; wv = wv->next) + { + /* The contents of wv should match the top level menu. */ + EmacsMenu *submenu = (EmacsMenu*)[[menu itemAtIndex:i++] submenu]; + + [submenu fillWithWidgetValue: wv->contents frame: f]; + } + needs_deep_update = NO; + } + else + { + [menu clear]; + for (wv = first_wv->contents; wv; wv = wv->next) + { #ifdef NS_IMPL_COCOA /* We'll update the real copy under app menu when time comes. */ if (!strcmp ("Services", wv->name)) @@ -420,25 +356,17 @@ } else #endif - [menu addSubmenuWithTitle: wv->name forFrame: f]; + [menu addSubmenuWithTitle: wv->name forFrame: f]; + } - if (prev_wv) - prev_wv->next = wv; - else - first_wv->contents = wv; - prev_wv = wv; - } + /* We've cleared out the contents of the menus, so the next time + one is clicked on we'll need to run a deep update. */ + needs_deep_update = YES; + } - last_f = f; - if (n < 100) - n_previous_strings = n; - else - n_previous_strings = 0; - } free_menubar_widget_value_tree (first_wv); - #if NSMENUPROFILE ftime (&tb); t += 1000*tb.time+tb.millitm; @@ -460,21 +388,10 @@ void set_frame_menubar (struct frame *f, bool first_time, bool deep_p) { - ns_update_menubar (f, deep_p, nil); -} - -void -ns_activate_menubar (struct frame *f) -{ -#ifdef NS_IMPL_COCOA - ns_update_menubar (f, true, nil); - ns_check_pending_open_menu (); -#endif + ns_update_menubar (f, deep_p); } - - /* ========================================================================== Menu: class implementation @@ -514,43 +431,6 @@ - (void)setFrame: (struct frame *)f frame = f; } -#ifdef NS_IMPL_COCOA --(void)trackingNotification:(NSNotification *)notification -{ - /* Update menu in menuNeedsUpdate only while tracking menus. */ - trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification - ? 1 : 0); - if (! trackingMenu) ns_check_menu_open (nil); -} - -- (void)menuWillOpen:(NSMenu *)menu -{ - ++trackingMenu; - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - // On 10.6 we get repeated calls, only the one for NSSystemDefined is "real". - if ( -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - NSAppKitVersionNumber < NSAppKitVersionNumber10_7 && -#endif - [[NSApp currentEvent] type] != NSEventTypeSystemDefined) - return; -#endif - - /* When dragging from one menu to another, we get willOpen followed by didClose, - i.e. trackingMenu == 3 in willOpen and then 2 after didClose. - We have updated all menus, so avoid doing it when trackingMenu == 3. */ - if (trackingMenu == 2) - ns_check_menu_open (menu); -} - -- (void)menuDidClose:(NSMenu *)menu -{ - --trackingMenu; -} - -#endif /* NS_IMPL_COCOA */ - /* Delegate method called when a submenu is being opened: run a 'deep' call to set_frame_menubar. */ - (void)menuNeedsUpdate: (NSMenu *)menu @@ -558,29 +438,8 @@ - (void)menuNeedsUpdate: (NSMenu *)menu if (!FRAME_LIVE_P (frame)) return; - /* Cocoa/Carbon will request update on every keystroke - via IsMenuKeyEvent -> CheckMenusForKeyEvent. These are not needed - since key equivalents are handled through emacs. - On Leopard, even keystroke events generate SystemDefined event. - Third-party applications that enhance mouse / trackpad - interaction, or also VNC/Remote Desktop will send events - of type AppDefined rather than SysDefined. - Menus will fail to show up if they haven't been initialized. - AppDefined events may lack timing data. - - Thus, we rely on the didBeginTrackingNotification notification - as above to indicate the need for updates. - From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the - key press case, NSMenuPropertyItemImage (e.g.) won't be set. - */ - if (trackingMenu == 0) - return; -/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */ -#ifdef 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); -#endif + if (needs_deep_update) + ns_update_menubar (frame, true); } @@ -1881,12 +1740,6 @@ - (Lisp_Object)runDialogAt: (NSPoint)p void syms_of_nsmenu (void) { -#ifndef NS_IMPL_COCOA - /* Don't know how to keep track of this in Next/Open/GNUstep. Always - update menus there. */ - trackingMenu = 1; - PDUMPER_REMEMBER_SCALAR (trackingMenu); -#endif defsubr (&Sns_reset_menu); defsubr (&Smenu_or_popup_active_p); diff --git a/src/nsterm.h b/src/nsterm.h index 94472ec107..0b7e27c00f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1130,8 +1130,6 @@ ns_query_color (void *col, Emacs_Color *color_def, bool setPixel); extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); extern unsigned long ns_index_color (NSColor *color, struct frame *f); extern const char *ns_get_pending_menu_title (void); -extern void ns_check_menu_open (NSMenu *menu); -extern void ns_check_pending_open_menu (void); #endif /* Implemented in nsfns, published in nsterm. */ diff --git a/src/nsterm.m b/src/nsterm.m index 2a117a0780..161677484f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -310,24 +310,6 @@ - (NSColor *)colorUsingDefaultColorSpace NULL, 0, 0 }; -#ifdef NS_IMPL_COCOA -/* - * State for pending menu activation: - * MENU_NONE Normal state - * MENU_PENDING A menu has been clicked on, but has been canceled so we can - * run lisp to update the menu. - * MENU_OPENING Menu is up to date, and the click event is redone so the menu - * will open. - */ -#define MENU_NONE 0 -#define MENU_PENDING 1 -#define MENU_OPENING 2 -static int menu_will_open_state = MENU_NONE; - -/* Saved position for menu click. */ -static CGPoint menu_mouse_point; -#endif - /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 #define NSLeftControlKeyMask (0x000001 | NSEventModifierFlagControl) @@ -4607,79 +4589,6 @@ in certain situations (rapid incoming events). } #endif -/* GNUstep does not have cancelTracking. */ -#ifdef NS_IMPL_COCOA -/* Check if menu open should be canceled or continued as normal. */ -void -ns_check_menu_open (NSMenu *menu) -{ - /* Click in menu bar? */ - NSArray *a = [[NSApp mainMenu] itemArray]; - int i; - BOOL found = NO; - - if (menu == nil) // Menu tracking ended. - { - if (menu_will_open_state == MENU_OPENING) - menu_will_open_state = MENU_NONE; - return; - } - - for (i = 0; ! found && i < [a count]; i++) - found = menu == [[a objectAtIndex:i] submenu]; - if (found) - { - if (menu_will_open_state == MENU_NONE && emacs_event) - { - NSEvent *theEvent = [NSApp currentEvent]; - struct frame *emacsframe = SELECTED_FRAME (); - - /* On macOS, the following can cause an event loop when the - Spotlight for Help search field is populated. Avoid this by - not postponing mouse drag and non-user-generated mouse down - events (Bug#31371). */ - if (([theEvent type] == NSEventTypeLeftMouseDown) - && [theEvent eventNumber]) - { - [menu cancelTracking]; - menu_will_open_state = MENU_PENDING; - emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; - EV_TRAILER (theEvent); - - CGEventRef ourEvent = CGEventCreate (NULL); - menu_mouse_point = CGEventGetLocation (ourEvent); - CFRelease (ourEvent); - } - } - else if (menu_will_open_state == MENU_OPENING) - { - menu_will_open_state = MENU_NONE; - } - } -} - -/* Redo saved menu click if state is MENU_PENDING. */ -void -ns_check_pending_open_menu () -{ - if (menu_will_open_state == MENU_PENDING) - { - CGEventSourceRef source - = CGEventSourceCreate (kCGEventSourceStateHIDSystemState); - - CGEventRef event = CGEventCreateMouseEvent (source, - kCGEventLeftMouseDown, - menu_mouse_point, - kCGMouseButtonLeft); - CGEventSetType (event, kCGEventLeftMouseDown); - CGEventPost (kCGHIDEventTap, event); - CFRelease (event); - CFRelease (source); - - menu_will_open_state = MENU_OPENING; - } -} -#endif /* NS_IMPL_COCOA */ static int ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) @@ -5416,7 +5325,6 @@ static Lisp_Object ns_new_font (struct frame *f, Lisp_Object font_object, terminal->set_new_font_hook = ns_new_font; terminal->implicit_set_name_hook = ns_implicitly_set_name; terminal->menu_show_hook = ns_menu_show; - terminal->activate_menubar_hook = ns_activate_menubar; terminal->popup_dialog_hook = ns_popup_dialog; terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar; @@ -5661,15 +5569,6 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. [NSApp setServicesMenu: svcsMenu]; /* Needed at least on Cocoa, to get dock menu to show windows */ [NSApp setWindowsMenu: [[NSMenu alloc] init]]; - - [[NSNotificationCenter defaultCenter] - addObserver: mainMenu - selector: @selector (trackingNotification:) - name: NSMenuDidBeginTrackingNotification object: mainMenu]; - [[NSNotificationCenter defaultCenter] - addObserver: mainMenu - selector: @selector (trackingNotification:) - name: NSMenuDidEndTrackingNotification object: mainMenu]; } #endif /* macOS menu setup */ -- 2.29.2 --boZ9RPumkWPrn11Y-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 26 12:42:25 2020 Received: (at 44333) by debbugs.gnu.org; 26 Dec 2020 17:42:25 +0000 Received: from localhost ([127.0.0.1]:59864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktDaD-0001pW-EY for submit@debbugs.gnu.org; Sat, 26 Dec 2020 12:42:25 -0500 Received: from mail174c50.megamailservers.eu ([91.136.10.184]:55680 helo=mail36c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktDaB-0001pM-0a for 44333@debbugs.gnu.org; Sat, 26 Dec 2020 12:42:24 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609004541; bh=n7yOnjKy0gid9pvv1vhanM7Arz6zQVdqgNuAEEa/eVo=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=EpheHnJG+nAYnZjrWH2vhmcE+15K+njDwW5Ne6u/CGdHuR68ZWufLFsd22AZUgAXO LgVOM6sEOCc1sq4+iIY3AVDkO3oMR7Bz/y6bziTkAzDVI76+vglvso0emfQ6sXZKVl 6HupL8yIPTttfMvgOcLpsIu3jfsLf2TuAIK8icKI= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail36c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BQHgIN2024348; Sat, 26 Dec 2020 17:42:20 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Sat, 26 Dec 2020 18:42:18 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <44D6C180-9C74-4B2D-BCB8-683FC4A84091@acm.org> References: <2B2932BB-DFD0-409C-9351-FACEC46927BB@acm.org> <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> To: Alan Third X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F20.5FE775FD.0007, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=OrUxNB3t c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=7pZbIodyEB3gQYv9lFcA:9 a=CjuIK1q_8ugA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 26 dec. 2020 kl. 18.07 skrev Alan Third : > Does the attached seem any better? It appears to me like the first > click on a menu is slightly faster (but that may be my imagination), > and subsequent menus are instant. Not bad at all! Slow spells all gone as far as I can tell. Ship it! Next up, import the hacks from the Mac port that right-justifies = keyboard shortcuts in the menus? From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 26 16:52:26 2020 Received: (at 44333) by debbugs.gnu.org; 26 Dec 2020 21:52:26 +0000 Received: from localhost ([127.0.0.1]:60019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktHUA-00059O-3X for submit@debbugs.gnu.org; Sat, 26 Dec 2020 16:52:26 -0500 Received: from outbound.soverin.net ([116.202.65.218]:48543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktHU7-000599-Vo for 44333@debbugs.gnu.org; Sat, 26 Dec 2020 16:52:24 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id ADFDF600E9; Sat, 26 Dec 2020 21:52:16 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609019535; bh=vsd1V0AqpyGvAU4F+Dy576DcaXwDALYjGlL8ngEEMwA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NcxqNsUJPMl1rUW/QuCGmYy7KC/RoVRWteN10cdaF1k6YGxCP0Cht/mFWHuU3wHWx +gC4ZRL0ymReSx+RWHQJKda625Yd8rkfs2WLujh8TtSHcHvnLKogAG7722tr4V8uAL tSowm/9Zqo9z9D3XTg/vLV9c0GjxcqZ9NEB3ieiBBwcBDlGLvkxcU2H4SAZRoG+ccY j/8fRlt0vD0a33j+bO9QBpQ4ySDkUcGhcDyDk10AJNcpYS+hT1YHRLlDSeohpKfQKP gZ/0hN7pU0x17o3KN9XZhJ9at2etm+fwXcR77I5VWleKcw7Ko60DoAW0mYHhLkK0Pn hsIrV4ntQ+VrQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id E67502029301DE; Sat, 26 Dec 2020 21:52:10 +0000 (GMT) Date: Sat, 26 Dec 2020 21:52:10 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333@debbugs.gnu.org, Viktor Kharitonovich References: <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> <44D6C180-9C74-4B2D-BCB8-683FC4A84091@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <44D6C180-9C74-4B2D-BCB8-683FC4A84091@acm.org> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Sat, Dec 26, 2020 at 06:42:18PM +0100, Mattias Engdegård wrote: > 26 dec. 2020 kl. 18.07 skrev Alan Third : > > > Does the attached seem any better? It appears to me like the first > > click on a menu is slightly faster (but that may be my imagination), > > and subsequent menus are instant. > > Not bad at all! Slow spells all gone as far as I can tell. Ship it! Cool. I might do some further tidying up. I'll see how I feel. > Next up, import the hacks from the Mac port that right-justifies > keyboard shortcuts in the menus? It doesn't actually right align them, but they're certainly neater. It's actually almost possible to copy the Mac port code in verbatim, the NS port's code is based on it after all, but I feel it may be neater to use a custom view for the NSMenuItems. That would give us complete control over the layout. Of course, someone would have to actually do that work... -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 27 11:57:14 2020 Received: (at 44333-done) by debbugs.gnu.org; 27 Dec 2020 16:57:14 +0000 Received: from localhost ([127.0.0.1]:33363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktZM2-00065h-12 for submit@debbugs.gnu.org; Sun, 27 Dec 2020 11:57:14 -0500 Received: from outbound.soverin.net ([116.202.65.218]:58161) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktZLz-00065R-Ck for 44333-done@debbugs.gnu.org; Sun, 27 Dec 2020 11:57:12 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 045DA6008F; Sun, 27 Dec 2020 16:57:05 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609088224; bh=bFKeJthkj63u+8+AoFnSdzFlB1l04yOj82uvdRYEOW8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=rh/VvZ2+gDKl9Q96uVZbWECJWxGssIV9fTpOsfnKJgIaEL0+7wb8eQkWwzl3d1z7l cBiuryJnrqmi2b1VInYXfnMS974wR3NAEDpkjG1Y5cSDW11dZ3kyX6oOQce3muAFyW fKtJs4GY8uqXEf/oplYoo5nG71CfPyb7aePDWaiVlfX9OZ+csbDegAMuiP9FZTbBuU Cdoj1C6C9NmMza2FuWIaANe3H3vC64qLKPHnj2enRU1iAlk/uAnFNRu+K/yQ0lIX8T U/cEEACvo/FNbnAdSKmwI+HnuYL278+U+0xa3FYHMa8IfkZe6JWthu8Iw1tWlYY2m0 gKlZVlmnQbxig== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 1FF6D2029360C1; Sun, 27 Dec 2020 16:56:59 +0000 (GMT) Date: Sun, 27 Dec 2020 16:56:59 +0000 From: Alan Third To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333-done@debbugs.gnu.org, Viktor Kharitonovich Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Message-ID: Mail-Followup-To: Alan Third , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , 44333-done@debbugs.gnu.org, Viktor Kharitonovich References: <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> <44D6C180-9C74-4B2D-BCB8-683FC4A84091@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44333-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Sat, Dec 26, 2020 at 09:52:10PM +0000, Alan Third wrote: > On Sat, Dec 26, 2020 at 06:42:18PM +0100, Mattias Engdegård wrote: > > 26 dec. 2020 kl. 18.07 skrev Alan Third : > > > > > Does the attached seem any better? It appears to me like the first > > > click on a menu is slightly faster (but that may be my imagination), > > > and subsequent menus are instant. > > > > Not bad at all! Slow spells all gone as far as I can tell. Ship it! > > Cool. I might do some further tidying up. I'll see how I feel. I've pushed a modified version of this code to master. It doesn't work on GNUstep, but GNUstep menus have been broken for a while anyway, and I don't know what's wrong with them. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 27 12:14:38 2020 Received: (at 44333) by debbugs.gnu.org; 27 Dec 2020 17:14:38 +0000 Received: from localhost ([127.0.0.1]:33384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktZcr-0006WW-Fs for submit@debbugs.gnu.org; Sun, 27 Dec 2020 12:14:38 -0500 Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:37732 helo=mail265c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktZcp-0006WH-E6 for 44333@debbugs.gnu.org; Sun, 27 Dec 2020 12:14:36 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609089268; bh=sE3fObDJTYjob8VGjPgLqK/qPjoORp3dzWQieL/4N4g=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=CHm0wKn88IGfvv0lskvVnWjbgjqgtizhCFAaKwAncTbLNT2ELOOkejUaQirXTTqdU 2buIwnNP3q149ObLLA/vFluC0K5JcCn2WyTaIlQSRq9PSAyIR+x4k40QXXzyGOnx9E mVtTtrK7og1euOJnArWxNku7kEl6FDSi6cvcxq+w= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BRHEQEP029417; Sun, 27 Dec 2020 17:14:27 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_93100978-9868-4C2F-AACB-81DD67F47D30" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#44333: 27.1; macOS menu bar 2-clicks Date: Sun, 27 Dec 2020 18:14:25 +0100 In-Reply-To: To: Alan Third References: <20201031150101.GN59267@breton.holly.idiocy.org> <6F053CD0-A164-490F-9D15-225D8782C633@acm.org> <20201101172843.GQ59267@breton.holly.idiocy.org> <40B4784A-74FF-4021-B51C-2E80801483BE@acm.org> <44D6C180-9C74-4B2D-BCB8-683FC4A84091@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F19.5FE8C0F4.0023, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=QoAgIm6d c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=anMcQ69C1EZOHEeKvVoA:9 a=QEXdDO2ut3YA:10 a=tpF0QAhZnqjl15_envsA:9 a=De_Ol2h6w80A:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 26 dec. 2020 kl. 22.52 skrev Alan Third : > It's actually almost possible to copy the Mac port code in verbatim, > the NS port's code is based on it after all, but I feel it may be > neater to use a custom view for the NSMenuItems. That would [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 44333 Cc: 44333@debbugs.gnu.org, Viktor Kharitonovich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_93100978-9868-4C2F-AACB-81DD67F47D30 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 26 dec. 2020 kl. 22.52 skrev Alan Third : > It's actually almost possible to copy the Mac port code in verbatim, > the NS port's code is based on it after all, but I feel it may be > neater to use a custom view for the NSMenuItems. That would give us > complete control over the layout. We should, but because I was lazy and impatient, I wrote the attached = (terrible) hack just to see what right-justification would look like. The right margin is slightly ragged because I'm using plain spaces to = offset the key binding from the menu text, but I still think it's better = than what we have now. I tried using U+2009 THIN SPACE and even U+200A = HAIR SPACE instead but somehow the result became worse; no doubt a silly = mistake somewhere. I also removed the special hack for s- bindings because it broke the = nice alignment. If we want, we could translate modifiers into the = standard symbols (=E2=8C=98, =E2=8C=83, =E2=87=A7 and =E2=8C=A5) = depending on these are assigned, or just keep using the Emacs notation. = We could also translate into =E2=86=92 and so on. --Apple-Mail=_93100978-9868-4C2F-AACB-81DD67F47D30 Content-Disposition: attachment; filename=right-justify-keys.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="right-justify-keys.diff" Content-Transfer-Encoding: 7bit diff --git a/src/nsmenu.m b/src/nsmenu.m index b5d0821323..f985234643 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -498,9 +498,16 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr keyEq = [self parseKeyEquiv: wv->key]; #ifdef NS_IMPL_COCOA /* macOS mangles modifier strings longer than one character. */ - if (keyEquivModMask == 0) + if (1 || keyEquivModMask == 0) { - title = [title stringByAppendingFormat: @" (%@)", keyEq]; + if (wv->key) + { + const char *k = wv->key; + while (*k == ' ') k++; + title = [title stringByAppendingString: + [NSString stringWithUTF8String: k]]; + } + //title = [title stringByAppendingString: keyEq]; item = [self addItemWithTitle: (NSString *)title action: @selector (menuDown:) keyEquivalent: @""]; @@ -514,7 +521,7 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr #ifdef NS_IMPL_COCOA } #endif - [item setKeyEquivalentModifierMask: keyEquivModMask]; + //[item setKeyEquivalentModifierMask: keyEquivModMask]; [item setEnabled: wv->enabled]; @@ -556,14 +563,67 @@ - (void)fillWithWidgetValue: (void *)wvptr - (void)fillWithWidgetValue: (void *)wvptr { - widget_value *wv = (widget_value *)wvptr; + widget_value *first_wv = (widget_value *)wvptr; + NSFont *menuFont = [NSFont menuFontOfSize:0]; + NSDictionary *attributes = + [NSDictionary dictionaryWithObject:menuFont forKey:NSFontAttributeName]; + const char space_str[] = " "; + int space_bytes = sizeof space_str - 1; + NSSize spaceSize = [[NSString stringWithUTF8String: space_str] + sizeWithAttributes:attributes]; + CGFloat spaceWidth = spaceSize.width; + CGFloat maxNameWidth = 0; + CGFloat maxKeyWidth = 0; + + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) + if (!menu_separator_name_p (wv->name)) + { + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + maxNameWidth = MAX(maxNameWidth, nameWidth); + if (wv->key) + { + const char *k = wv->key; + while (*k == ' ') k++; + NSString *key = [NSString stringWithUTF8String: k]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + maxKeyWidth = MAX(maxKeyWidth, keyWidth); + } + } /* clear existing contents */ [self removeAllItems]; /* add new contents */ - for (; wv != NULL; wv = wv->next) + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) { + if (wv->key && !menu_separator_name_p (wv->name)) + { + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + const char *k = wv->key; + while (*k == ' ') k++; + NSString *key = [NSString stringWithUTF8String: k]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + CGFloat padWidth = (maxNameWidth - nameWidth) + + (maxKeyWidth - keyWidth); + int name_len = strlen (wv->name); + int extra_spaces = 7; + int pad_len = lround(padWidth / spaceWidth + extra_spaces); + Lisp_Object s = make_uninit_string (name_len + pad_len * space_bytes); + memcpy (SSDATA (s), wv->name, name_len); + if (space_bytes == 1) + memset (SDATA (s) + name_len, space_str[0], pad_len); + else + for (int i = 0; i < pad_len; i++) + memcpy (SDATA (s) + name_len + i * space_bytes, space_str, + space_bytes); + wv->name = SSDATA (s); + } NSMenuItem *item = [self addItemWithWidgetValue: wv]; if (wv->contents) --Apple-Mail=_93100978-9868-4C2F-AACB-81DD67F47D30-- From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 28 09:06:24 2020 Received: (at control) by debbugs.gnu.org; 28 Dec 2020 14:06:24 +0000 Received: from localhost ([127.0.0.1]:34661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttAG-0005sr-9p for submit@debbugs.gnu.org; Mon, 28 Dec 2020 09:06:24 -0500 Received: from mail1442c50.megamailservers.eu ([91.136.14.42]:48494 helo=mail264c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttAD-0005sc-Jk for control@debbugs.gnu.org; Mon, 28 Dec 2020 09:06:22 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609164375; bh=XCin06XDyrmpHl+snVqwa0MerfT9XPs0ULwel6J8SR8=; h=From:Subject:Date:To:From; b=knPoNq2dTNLqvfvZLdwIQCGBPdmZO92OQw+tP6NC7b7cA2kZTH3pjJVn0/WI7b8L+ Th9fqX3ZGaLYdRuox8CmtQNnDRfvqNzjoQ2mD0xsyn4eIWPj+xla0rTJvYvuqRMJmL J/3BDa3FarXp9iVK8ypuKjDCmGSK5KKEg0ifUkro= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail264c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BSE6DY3003119 for ; Mon, 28 Dec 2020 14:06:14 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Message-Id: <45D94A83-7C57-4351-A929-4D20EECAF823@acm.org> Date: Mon, 28 Dec 2020 15:06:12 +0100 To: control@debbugs.gnu.org X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1C.5FE9E657.000E, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=bPlo382Z c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=ABZmHiKDvtnWcPEwfZ8A:9 a=CjuIK1q_8ugA:10 a=xo5jKAKm-U-Zyk2_beg_:22 X-Origin-Country: SE X-Spam-Score: 3.4 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 44333 32864 34213 stop Content analysis details: (3.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 BLANK_SUBJECT Subject is present but empty 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 44333 32864 34213 stop Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 BLANK_SUBJECT Subject is present but empty -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager forcemerge 44333 32864 34213 stop From unknown Fri Jun 20 07:12:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 26 Jan 2021 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator