all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jared Finder via "Emacs development discussions." <emacs-devel@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Making TTY menus more visual
Date: Tue, 13 Oct 2020 18:59:01 -0700	[thread overview]
Message-ID: <6b4037dadb0061bfc35cc45c5149c1ac@finder.org> (raw)
In-Reply-To: <834kmy2o23.fsf@gnu.org>

On 2020-10-13 7:33 am, Eli Zaretskii wrote:
>> Date: Mon, 12 Oct 2020 14:30:38 -0700
>> From: Jared Finder <jared@finder.org>
>> 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))
>    => (#<frame F1 069b0190> 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)
=> #<frame F1 0x55be32685d38>

Behavior with ./configure --with-x=yes:
(posn-at-x-y 0 0 (selected-frame))
=> (#<frame F1 0x561fedbc6b98> nil (0 . 0) 0)
(selected-frame)
=> #<frame F1 0x561fedbc6b98>

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



  reply	other threads:[~2020-10-14  1:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  6:16 Making TTY menus more visual Jared Finder via Emacs development discussions.
2020-10-02  7:31 ` Eli Zaretskii
2020-10-03  0:16   ` Jared Finder via Emacs development discussions.
2020-10-03  8:50     ` Eli Zaretskii
2020-10-03 19:26       ` Jared Finder via Emacs development discussions.
2020-10-03 22:28         ` Jared Finder via Emacs development discussions.
2020-10-03 23:25           ` Jared Finder via Emacs development discussions.
2020-10-04  6:43           ` Eli Zaretskii
2020-10-04  9:04             ` Eli Zaretskii
2020-10-05  5:36               ` Jared Finder via Emacs development discussions.
2020-10-05  6:45                 ` Eli Zaretskii
2020-10-08  6:39                   ` Jared Finder via Emacs development discussions.
2020-10-08  8:15                     ` Eli Zaretskii
2020-10-09  5:17                       ` Jared Finder via Emacs development discussions.
2020-10-09 15:02                         ` Eli Zaretskii
2020-10-10  5:20                           ` Jared Finder via Emacs development discussions.
2020-10-10  7:28                             ` Eli Zaretskii
2020-10-12  3:25                               ` Jared Finder via Emacs development discussions.
2020-10-12 14:45                                 ` Eli Zaretskii
2020-10-12 21:30                                   ` Jared Finder via Emacs development discussions.
2020-10-13 14:33                                     ` Eli Zaretskii
2020-10-14  1:59                                       ` Jared Finder via Emacs development discussions. [this message]
2020-10-15 13:34                                         ` Eli Zaretskii
2020-10-16  6:51                                           ` Eli Zaretskii
2020-10-16 16:18                                             ` Jared Finder via Emacs development discussions.
2020-10-24 10:31                                     ` Eli Zaretskii
2020-10-25  0:27                                       ` Jared Finder via Emacs development discussions.
2020-10-31  8:05                                         ` Eli Zaretskii
2020-10-24 10:25                               ` Eli Zaretskii
2020-10-04  6:22         ` Eli Zaretskii
2020-10-04  6:24         ` Eli Zaretskii
2020-10-04 22:15           ` Jared Finder via Emacs development discussions.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b4037dadb0061bfc35cc45c5149c1ac@finder.org \
    --to=emacs-devel@gnu.org \
    --cc=eliz@gnu.org \
    --cc=jared@finder.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.