From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Making TTY menus more visual Date: Mon, 12 Oct 2020 14:30:38 -0700 Message-ID: <8a6b6ce3f194ccf418709fe46ce0f1bb@finder.org> References: <087df85a965fac6555a755c1bbebf1ea@finder.org> <83r1qhf5ii.fsf@gnu.org> <83wo07g0bf.fsf@gnu.org> <85afa5c0a0a789c6047e92f6ecfa9fcc@finder.org> <72bbff31bcf46be917c9e8d8236cad75@finder.org> <838scmfq4f.fsf@gnu.org> <83y2kme50p.fsf@gnu.org> <033517da1ce6762b3d3c656dad4d8f98@finder.org> <835z7pdvcp.fsf@gnu.org> <0168b49ea0f2b5533f6e20c6ad73eb0c@finder.org> <835z7l876k.fsf@gnu.org> <54d686f28c49c0b86c4a52ba48cf2486@finder.org> <83sgan5to0.fsf@gnu.org> <78d53fb994e86bb2d8c7fd313cdfa8a2@finder.org> <83blha5yla.fsf@gnu.org> <184d04bc36d1a7204238d8508ec48531@finder.org> <83362j4i58.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_7190057fe71746a0c7d7823e45d5bf76" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26492"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.3.15 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 12 23:32:12 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kS5QR-0006js-Vr for ged-emacs-devel@m.gmane-mx.org; Mon, 12 Oct 2020 23:32:12 +0200 Original-Received: from localhost ([::1]:55796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS5QQ-00060W-V9 for ged-emacs-devel@m.gmane-mx.org; Mon, 12 Oct 2020 17:32:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS5P2-0005LD-N9 for emacs-devel@gnu.org; Mon, 12 Oct 2020 17:30:44 -0400 Original-Received: from greenhill.hpalace.com ([2600:3c01::f03c:91ff:fe73:2daa]:45238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS5P0-0001MY-LU; Mon, 12 Oct 2020 17:30:44 -0400 Original-Received: from mail.finder.org (greenhill.hpalace.com [IPv6:2600:3c01::f03c:91ff:fe73:2daa]) by greenhill.hpalace.com (Postfix) with ESMTPSA id 6C984B73; Mon, 12 Oct 2020 21:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=finder.org; s=2018; t=1602538240; bh=1sw9lxkjyS4ogAD+BCEPuxZpA0bbGGJXzQGXIXTamx0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rP8MKJRG53JgkAYXSGKalRMDFYPlFTwSGE2/sf94hhD/QMylzZZD6SbGSCOxWPKVO EyKn2hUo4q9zjbAZqGuUYgDQ5DV37F2bvrSU0FR8IC+KwZ5NndritjDQslOXgrk2uL 9tPbhznuU0PmXIMvUjukSr81NJgpEUjtxdWNHm5+goWIGthdPjtoAznCHl3F8caH+w hp6+3Wqj4b/sYfXbvPQHbZpH4rTRuBq5CbeTidF6Plcld4yRiZQ0PaIR2Wxv0dhHwo isf8IvEsBaURoLz04l5j8T4rhZnAP1CrCmL8IBsa2CwJCH9J9oZFiRbf5iNdTkj9ux ZrywWFRg/Fv3g== In-Reply-To: <83362j4i58.fsf@gnu.org> X-Sender: jared@finder.org Received-SPF: pass client-ip=2600:3c01::f03c:91ff:fe73:2daa; envelope-from=jared@finder.org; helo=greenhill.hpalace.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257500 Archived-At: --=_7190057fe71746a0c7d7823e45d5bf76 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2020-10-12 7:45 am, Eli Zaretskii wrote: >> Date: Sun, 11 Oct 2020 20:25:13 -0700 >> From: Jared Finder >> Cc: emacs-devel@gnu.org >> >> -(defun menu-bar-open-mouse (event) >> +(defun menu-bar-open-mouse (position) >> "Open the menu bar for the menu item clicked on by the mouse. >> -EVENT should be a mouse down or click event. >> +POSITION should be a list of the form returned by `mouse-position'. >> >> Also see `menu-bar-open', which this calls. >> This command is to be used when you click the mouse in the menubar." >> - (interactive "e") >> - (let* ((x-position (car (posn-x-y (event-start event)))) >> + (interactive (list (mouse-position))) >> + (let* ((x-position (cadr position)) > > I'd prefer not to lose the "e" interactive spec and the form of the > argument here. If the problem is the conversion of window-relative to > frame-relative coordinates, that is easy, and the ELisp manual has an > example of how to do that in the node "Accessing Mouse". > > Or is there some problem to use this here? Thanks, I investigated further and I have an improved patch attached. In addition to keeping the same interactive spec, it also is logically independent of my changes to enable xterm-mouse based menu interaction. I also attached repro.el, which I used to help understand the behavior of xterm-mouse. The manual is not clear of the format of a posn for clicks outside a window, such as on the menu bar or tab bar. From the behavior I see, posn-window will return nil and posn-x-y will return (x . y) in frame coordinates. I rely on that in this patch. If this is accurate, I can update the manual. -- MJF --=_7190057fe71746a0c7d7823e45d5bf76 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Fixing-bug-where-the-wrong-menu-would-be-triggered-b.patch Content-Disposition: attachment; filename=0001-Fixing-bug-where-the-wrong-menu-would-be-triggered-b.patch; size=2406 RnJvbSBjMGVkNDFlNzQyZmU2NTU3M2ExNGVhYTAyZWJiYTk2ODdiOGNmYzViIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKYXJlZCBGaW5kZXIgPGphcmVkQGZpbmRlci5vcmc+CkRhdGU6 IFN1biwgMTEgT2N0IDIwMjAgMjA6MTY6MDAgLTA3MDAKU3ViamVjdDogW1BBVENIXSBGaXhpbmcg YnVnIHdoZXJlIHRoZSB3cm9uZyBtZW51IHdvdWxkIGJlIHRyaWdnZXJlZCBieSBtb3VzZS4KCkZv ciBsYXlvdXRzIHN1Y2ggYXMgdGhlIGZvbGxvd2luZywgY2xpY2tpbmcgdGhlICJsIiBpbiBUb29s cyB3aXRoIHRoZQpyaWdodCB3aW5kb3cgZm9jdXNlZCB3b3VsZCB0cmlnZ2VyIHRoZSBGaWxlIG1l bnUsIG5vdCB0aGUgVG9vbHMgbWVudS4KVGhpcyBpcyBiZWNhdXNlIHRoZSBldmVudCB3b3VsZCBo YXZlIHdpbmRvdyBjb29yZGluYXRlICgxIC4gMCkuClNpbWlsYXJseSwgY2xpY2tpbmcgdGhlICJw IiBpbiBIZWxwIHdvdWxkIHRyaWdnZXIgdGhlIEVkaXQgbWVudS4KCkV4YW1wbGUgRW1hY3MgZnJh bWU6CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t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CiBUaGlzIGNvbW1hbmQgaXMgdG8gYmUgdXNlZCB3aGVuIHlvdSBjbGljayB0aGUgbW91 c2UgaW4gdGhlIG1lbnViYXIuIgogICAoaW50ZXJhY3RpdmUgImUiKQorICA7OyBUaGlzIG9ubHkg c2hvdWxkIGJlIGJvdW5kIHRvIGNsaWNrcyBvbiB0aGUgbWVudS1iYXIsIG91dHNpZGUgb2YKKyAg OzsgYW55IHdpbmRvdy4KKyAgKGxldCAoKHdpbmRvdyAocG9zbi13aW5kb3cgKGV2ZW50LXN0YXJ0 IGV2ZW50KSkpKQorICAgICh3aGVuIHdpbmRvdworICAgICAgKGVycm9yICJFdmVudCBpcyBpbnNp ZGUgd2luZG93ICVzIiB3aW5kb3cpKSkKKwogICAobGV0KiAoKHgtcG9zaXRpb24gKGNhciAocG9z bi14LXkgKGV2ZW50LXN0YXJ0IGV2ZW50KSkpKQogICAgICAgICAgKG1lbnUtYmFyLWl0ZW0tY29u cyAobWVudS1iYXItaXRlbS1hdC14IHgtcG9zaXRpb24pKSkKICAgICAobWVudS1iYXItb3BlbiBu aWwKZGlmZiAtLWdpdCBhL2xpc3AveHQtbW91c2UuZWwgYi9saXNwL3h0LW1vdXNlLmVsCmluZGV4 IGU4MzgyMTk5NjAuLmJlMjYxY2ViYWIgMTAwNjQ0Ci0tLSBhL2xpc3AveHQtbW91c2UuZWwKKysr IGIvbGlzcC94dC1tb3VzZS5lbApAQCAtMjY3LDcgKzI2Nyw3IEBAIHh0ZXJtLW1vdXNlLWV2ZW50 CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGVx IHkgMSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0YWIt YmFyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZW51LWJhcikp Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIChudGhjZHIgMiAocG9zbi1hdC14LXkgeCB5 KSkpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG50aGNkciAyIChwb3NuLWF0LXgt eSB4IHkgKHNlbGVjdGVkLWZyYW1lKSkpKSkpCiAgICAgICAgICAgICAgKGV2ZW50IChsaXN0IHR5 cGUgcG9zbikpKQogICAgICAgICAoc2V0Y2FyIChudGhjZHIgMyBwb3NuKSB0aW1lc3RhbXApCiAK LS0gCjIuMjAuMQoK --=_7190057fe71746a0c7d7823e45d5bf76 Content-Transfer-Encoding: base64 Content-Type: text/x-lisp; name=repro.el Content-Disposition: attachment; filename=repro.el; size=1380 OzsgVGhpcyBmaWxlIGV4aXN0cyB0byBoZWxwIHVuZGVyc3RhbmQgeHRlcm0tbW91c2UncyBidWcu IEl0IGlzICpub3QqCjs7IGRlcGVuZGVudCBvbiB4dGVybS1tb3VzZS1tb2RlIGJlaW5nIGVuYWJs ZWQuCjs7Cjs7IFRyeSBydW5uaW5nICh0ZXN0LXh0ZXJtLWNvb3JkLXgpIGJvdGggd2l0aCBhbmQg d2l0aG91dCB0aGUgdGV4dAo7OyBtYXJrZWQgIkZyb20gcGF0Y2g6IiBlbmFibGVkLgoKKGRlZnVu IHRlc3QteHRlcm0tY29vcmQteCAoKQogIChsZXQgKGwwIDsgbWVudSBiYXIKCWwxIDsgZmlyc3Qg cm93CgkpCiAgICAoZG90aW1lcyAoeCAoZnJhbWUtd2lkdGgpKQogICAgICAocHVzaCAocG9zbi14 LXkgKHh0ZXJtLWNvb3Jkcy10by1wb3NuIHggMCkpIGwwKQogICAgICAocHVzaCAocG9zbi14LXkg KHh0ZXJtLWNvb3Jkcy10by1wb3NuIHggMSkpIGwxKSkKICAgIChsaXN0IChtYXBjYXIgJ2NhciAo bnJldmVyc2UgbDApKQoJICAobWFwY2FyICdjYXIgKG5yZXZlcnNlIGwxKSkpKSkKCihkZWZ1biB0 ZXN0LXh0ZXJtLWNvb3JkLXcgKCkKICAobGV0IChsMCA7IG1lbnUgYmFyCglsMSA7IGZpcnN0IHJv dwoJKQogICAgKGRvdGltZXMgKHggKGZyYW1lLXdpZHRoKSkKICAgICAgKHB1c2ggKHBvc24td2lu ZG93ICh4dGVybS1jb29yZHMtdG8tcG9zbiB4IDApKSBsMCkKICAgICAgKHB1c2ggKHBvc24td2lu ZG93ICh4dGVybS1jb29yZHMtdG8tcG9zbiB4IDEpKSBsMSkpCiAgICAobGlzdCAobnJldmVyc2Ug bDApIChucmV2ZXJzZSBsMSkpKSkKCSAgICAKCihkZWZ1biB4dGVybS1jb29yZHMtdG8tcG9zbiAo eCB5KQogICJwb3NuIGNyZWF0aW9uIHBhcnRzIG9mIGB4dGVybS1tb3VzZS1ldmVudCcuIgogIChs ZXQqICgodyAod2luZG93LWF0IHggeSkpCgkgKGx0cmIgKHdpbmRvdy1lZGdlcyB3KSkKCSAobGVm dCAobnRoIDAgbHRyYikpCgkgKHRvcCAobnRoIDEgbHRyYikpCgkgKHBvc24gKGlmIHcKCQkgICAo cG9zbi1hdC14LXkgKC0geCBsZWZ0KSAoLSB5IHRvcCkgdyB0KQogICAgICAgICAgICAgICAgIChh cHBlbmQgKGxpc3QgbmlsIChpZiAoYW5kIHRhYi1iYXItbW9kZQoJCQkJCSAgICAob3IgKG5vdCBt ZW51LWJhci1tb2RlKQoJCQkJCQk7OyBUaGUgdGFiLWJhciBpcyBvbiB0aGUKCQkJCQkJOzsgc2Vj b25kIHJvdyBiZWxvdyBtZW51LWJhcgoJCQkJCQkoZXEgeSAxKSkpCgkJCQkgICAgICAgJ3RhYi1i YXIKCQkJCSAgICAgJ21lbnUtYmFyKSkKCQkJIChudGhjZHIgMiAocG9zbi1hdC14LXkgeCB5IDtG cm9tIHBhdGNoOiAoc2VsZWN0ZWQtZnJhbWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICkpKSkpKQogICAgKHNldGNhciAobnRoY2RyIDMgcG9zbikgLTEp CiAgICBwb3NuKSkK --=_7190057fe71746a0c7d7823e45d5bf76--