|
From: | Jared Finder |
Subject: | Re: Making TTY menus more visual |
Date: | Fri, 02 Oct 2020 17:16:55 -0700 |
User-agent: | Roundcube Webmail/1.3.15 |
On 2020-10-02 12:31 am, Eli Zaretskii wrote:
Date: Thu, 01 Oct 2020 23:16:49 -0700From: 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 viamenu-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 clickedon.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'veattached 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
[Prev in Thread] | Current Thread | [Next in Thread] |