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: Fri, 02 Oct 2020 17:16:55 -0700 Message-ID: References: <087df85a965fac6555a755c1bbebf1ea@finder.org> <83r1qhf5ii.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="10236"; 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 Sat Oct 03 03:34:50 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 1kOWRm-0002Yn-Fg for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Oct 2020 03:34:50 +0200 Original-Received: from localhost ([::1]:51434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOWRl-0007jO-Iq for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Oct 2020 21:34:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOVER-00088U-CG for emacs-devel@gnu.org; Fri, 02 Oct 2020 20:16:59 -0400 Original-Received: from greenhill.hpalace.com ([2600:3c01::f03c:91ff:fe73:2daa]:53562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOVEP-0004XG-J8; Fri, 02 Oct 2020 20:16:59 -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 54F8FA36; Sat, 3 Oct 2020 00:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=finder.org; s=2018; t=1601684215; bh=AqR+tI+sOwNgHaoJeHBMxQG/lXsFQOzBbRqqqYn2KZI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NVaw1sxmPtMTYTIWddWlW+Xc8mVtGxSVbJLqT3q0WjdUvxjOPje4JRG68B41/y1el +QIp62zn/QLHvNENbMH97FA1AA09v1EmPO5Ce8BCSiidCj8G4N+hu4kjopiQiGqXox a9nvQmeOZtj2b7SwQ0IYdWZtNYNCqOwtL83hsqK/4J2zGls25BRvVBV1FQIvgep5bE wJcVDskM5ORU1HUNbBEoQUTU1/X7haB5zqj4YR8AaTEToI9bUXiqgqooc0USfBpZKW vHSafomU4XCCWbniAUYfe1nQsRls/9i/0OZxdLkRu+SuNvTqqr8FZsW1msCZ4Pkk6y EP61GEBsD/XJQ== In-Reply-To: <83r1qhf5ii.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-Mailman-Approved-At: Fri, 02 Oct 2020 21:33:43 -0400 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:256981 Archived-At: 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." >> >> >> 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, 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 " ")) 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 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 . (no patch yet, I wanted to see if you had any backward compat concens) -- MJF