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: Tue, 13 Oct 2020 18:59:01 -0700 Message-ID: <6b4037dadb0061bfc35cc45c5149c1ac@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> <8a6b6ce3f194ccf418709fe46ce0f1bb@finder.org> <834kmy2o23.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8377"; 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 Wed Oct 14 03:59:42 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 1kSW4s-00026V-Qp for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Oct 2020 03:59:42 +0200 Original-Received: from localhost ([::1]:52118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSW4r-0002Em-ST for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Oct 2020 21:59:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSW4K-0001np-Tt for emacs-devel@gnu.org; Tue, 13 Oct 2020 21:59:09 -0400 Original-Received: from greenhill.hpalace.com ([2600:3c01::f03c:91ff:fe73:2daa]:46160) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSW4J-0005TI-15; Tue, 13 Oct 2020 21:59:08 -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 F24E67EC; Wed, 14 Oct 2020 01:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=finder.org; s=2018; t=1602640743; bh=wPWQ9sQBtFI3YXra9wotZhtfZzlxo7oCWue1jSk/rHA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1+FanpxqAysuhzPBJ4BcDLHOu5/x+7CkosND2zpeaxkadRlH8qL8p6qJg3g4d7JcN Ko4D6KCwaI9g191RThyoj5xFmp2fzlFl30/bBfzkGARqcPAWwS9Te/qUZ49NYP/YhE DFRFVuCI7ho1IvzqDBJ8qQPu1w215FyGSg2RrN8KDviKCjmB5r16NF7rvE5thpVXNF flR0YPdSS7JFN7ZIsX1VEH9+uvlxX/v+Zwf8X86ASBDjxgU+pkKp/qYp1OVE8abE4k JKWTvJeKF3Vq1m7g8rpI4UKGVYXMnYLtalIgNYiCFInyPROubz7C4QYyk2y3OuM+aw Vd/LpC7CNka+g== In-Reply-To: <834kmy2o23.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:257604 Archived-At: On 2020-10-13 7:33 am, Eli Zaretskii wrote: >> Date: Mon, 12 Oct 2020 14:30:38 -0700 >> From: Jared Finder >> Cc: emacs-devel@gnu.org >> >> 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. > > Are you sure posn-window cannot return a frame? For example, on a > TTY, I get this: > > (posn-at-x-y 0 0 (selected-frame)) > => (# nil (0 . 0) 0) > > And (0,0) are coordinates in the frame's menu bar. A ha! A bug! Behavior is different depending on options selected at configure time. Behavior with ./configure --with-x=no: (posn-at-x-y 0 0 (selected-frame)) => (nil nil (0 . 0) 0) (selected-frame) => # Behavior with ./configure --with-x=yes: (posn-at-x-y 0 0 (selected-frame)) => (# nil (0 . 0) 0) (selected-frame) => # This bug has been around a while, on Debian (Emacs 26.1), emacs-no-x vs emacs-gtk shows the same difference in behavior. Do you have a preference for a fix? Some options: #1) If I was designing the API from scratch, I'd expect something like the following: A function posn-window returns a window or nil if the coordinate is outside of any window. A function posn-frame returns a frame. Always succeeds, since posn coordinates are always inside a frame. This is compatible with --with-x=no behavior. #2) An alternative would be to return "most specific information available". Something like the following: A function posn-window-or-frame, which returns a window if the coordinate is inside a window and returns a frame if the coordinate is outside a window. A deprecated alias posn-window for the function above. This is compatible with --with-x=yes behavior. I found at one other behavior difference, if you pass in out of bounds coordinates (example: 1000 0 for a TTY), --with-x=no you get the value as if you passed in 0 0, but --with-x=yes assumes the coordinate is valid. There are probably other differences. I can do a pass over this function, I'd like to know the razor to use. > Does it make sense to install this patch on its own? If so, we can > install it without waiting for the legal paperwork, the changes are > small enough. Yes, the issue existed prior to my changes when using TMM in a terminal. -- MJF