unofficial mirror of emacs-devel@gnu.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: Fri, 02 Oct 2020 17:16:55 -0700	[thread overview]
Message-ID: <b2d196e856d798766ac11e0d8c83f931@finder.org> (raw)
In-Reply-To: <83r1qhf5ii.fsf@gnu.org>

On 2020-10-02 12:31 am, Eli Zaretskii wrote:
>> Date: Thu, 01 Oct 2020 23:16:49 -0700
>> From: Jared Finder via "Emacs development discussions." 
>> <emacs-devel@gnu.org>
>> 
>> Right now in Emacs on a TTY, clicking on the menu bar with the mouse 
>> pops up menu navigation through
>> tmm.el.  I think it would make more sense for mouse clicks to pop up 
>> visual menus via
>> menu-bar-open-mouse by default.
> 
> Which mouse support do you have on that TTY?  Is it GPM or is it
> something else?
> 
> If Emacs opens tmm-menubar when you click on the menu bar, it means
> Emacs doesn't understand that a mouse click on the menu bar was
> received.  Can you tell why this happens in your case?

This is for xterm-mouse support. From what I can tell, <menu-bar> 
<mouse-1> is always bound to tmm-menubar. The following holds on Mac, 
Windows, and Linux, and appears to be independent of if you start with 
or without --no-window-system:

ELISP> (lookup-key global-map (kbd "<menu-bar> <mouse-1>"))
tmm-menubar-mouse

>> But I get why that's not the current default. These visual menus 
>> currently behave very poorly with a mouse
>> on a Linux TTY: Clicking <mouse-1> anywhere selects the currently 
>> selected item, not the item you clicked
>> on.
> 
> What do you mean by "currently selected item"?

Perhaps "currently focused menu item" is the correct term? I'm referring 
to the highlighted menu item that you can change with arrow keys.

>> I have a prototype fix for this that I've been working on. If you 
>> think it makes sense, I can finish it up. I've
>> attached the changes in case you want to take a look.
> 
> I don't understand why you need all this.  TTY menus work perfectly on
> MS-Windows console: the place where you click on the menu bar
> determines the menu that is dropped down.  For example, if you click
> on Options, you get the Options menu.
> 
> It is supposed to work the same on Linux terminals with a mouse: when
> you click the mouse on the menu bar, the function x_popup_menu_1 is
> supposed to be called with the argument POSITION that specifies the
> coordinates of the click, and then tty_menu_show, called by
> x_popup_menu_1, uses those coordinates to decide which menu to drop
> down.  Which of these doesn't work for you, and why?

This addition is for TTY menus triggered via xterm-mouse-mode. If this 
makes sense to add as a feature, I can finish up my patches.

I see the following things that need to change:

1. Add a new command that calls menu-bar-open with the right value for 
initial-x. (this is the patch 001 in the root of the thread)

2. In read_menu_input in term.c, additional logic needs to be added to 
handle xterm mouse clicks since the focused menu item will not be 
necessarily the one clicked on. Also, a user may click outside of the 
popped up menu, which they would expect to dismiss the menu. (this is 
patch 002 in the root of the thread, not yet complete)

3. The new command should replace the current binding of <menu-bar> 
<mouse-1>. (no patch yet, I wanted to see if you had any backward compat 
concens)

   -- MJF



  reply	other threads:[~2020-10-03  0:16 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. [this message]
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.
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=b2d196e856d798766ac11e0d8c83f931@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).