TIP 360: Modernize X11 Menus

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Author:		Pat Thoyts <[email protected]>
Type:		Project
State:		Final
Vote:		Done
Created:	24-Dec-2009
Tcl-Version:	8.6
Keywords:	Tk, X11, menu
Tk-Ticket:	2920409


This TIP proposes to modernize the functionality of the Tk menus on X11 to bring Tk up to date with reference to other toolkits on this platform.


Motif is dead and buried but Tk menus are still aping the Motif feel for menu handling on X11. Specifically all cascade menu items must be actively clicked to open the submenu. Other current toolkits work more like the Windows menus where once one of the menubar items has been clicked to activate its dropdown then subsequent mouse motion is sufficient to open any cascade menu on the menubar or from any of its dropdown menus.

Tk provides magic handling for any menubar item whose name ends in .help. Specifically such a menu gets pinned to the extreme right of the menubar. This is sufficiently unusual that users often miss the help menu completely if they are used to Windows or GNOME applications. This is a hangover from 1990 and needs to go.


The menu bindings will be modified to provide a concept of an activated menubar. Once any of the menubar cascade entries has been activated then the current active item will follow the mouse motion and explicit clicks will not be required to activate cascade entries. A small delay will be included when posting a cascade entry except when posting from the menubar. The activation is cancelled on hitting escape, selecting a menu entry or clicking outside the menu.

If the new 'focus-follows-mouse' style behaviour is undesirable it can be disabled using the Tk options database. The Menu option clickToFocus may be set true to restore the original menu behaviour. This can be set using the Tk option command, the X resource database, or by calling tk::classic::restore menu.

The special handling of .help menu entries in the menubar will be removed unless restored using the resource option *Menu.useMotifHelp. This can be set using the Tk option command, the X resource database or by calling the tk::classic::restore command which will set the option along with some others.

Reference Implementation

Patches posted as Tk patch item #2920409 https://sourceforge.net/support/tracker.php?aid=2920409 .


This document has been placed in the public domain.