Tk Source Code

View Ticket
Login
2026-09-30
20:33 • Closed ticket [1596662f]: Menu behaviour at screen bottom plus 11 other changes artifact: 51441e0c user: nemethi
19:56
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen. check-in: 3aacabb1 user: csaba tags: core-8-6-branch
18:10
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen. check-in: 5c47ae3e user: csaba tags: core-9-0-branch
16:26
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen; [4e7fbe8b4a]: X11: menus taller than the screen cannot be scrolled. check-in: 0f866663 user: csaba tags: trunk, main
08:46 • Ticket [1596662f] Menu behaviour at screen bottom status still Open with 4 other changes artifact: a5cbdcd9 user: serhiy.storchaka
08:44 • Ticket [470331ff] Displaced Menus do not stay open. status still Open with 4 other changes artifact: 2f1dc6a4 user: serhiy.storchaka
2026-09-29
20:40
Fix [470331], [680660], [1596662fff], [f9d316a5e0]: a menu posted over its menubutton or menubar entry invoked the entry under the pointer on the release of the click which posted it. Post the menu of a menubar entry or a menubutton above it if it does not fit below, or aside of the pointer if it fits neither below nor above. Ignore the release of the click which posted a menu if the pointer is over another menu and has not moved. check-in: c8129022 user: serhiy.storchaka tags: menu-post-under-pointer
2006-11-15
05:59 • Add attachment menuhack.pl to ticket [1596662f] artifact: bec28778 user: eserte
05:59 • Ticket [1596662f] Menu behaviour at screen bottom status still Open with 4 other changes artifact: c87ad0f4 user: eserte
2006-11-14
22:59 • New ticket [1596662f]. artifact: e4bf88fd user: eserte

Ticket UUID: 1596662
Title: Menu behaviour at screen bottom
Type: Bug Version: 8.6.18, 9.0.5, 9.1b1
Submitter: eserte Created on: 2006-11-14 22:59:29
Subsystem: 10. Generic Menus Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-30 20:33:34
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-09-30 20:33:34
Description:
If a Tk toplevel is moved near the bottom of the screen and a menu item is selected from the menubar with a short mouse click, and if the menu pops up under the pointer, then a menu item is accidentaly selected. This can be easily reproduced by any Tk script using menus, e.g. the widget demonstration: open the "Menus and cascades" demonstration, move the created window near to the screen bottom, and click on any of the menus.

Other toolkits (i.e. Gtk) seem to solve this problem by popping the menu *above* the pointer in these situations.

Attached is a naive Perl/Tk hack around Tk::Menu::post to implement just this behaviour. It would be nice if tkMenuDraw.c:TkPostSubmenu had something similar.

Regards,
    Slaven
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-09-30 20:33:34:

Serhiy, many thanks! The fix is now in main, core-9-0-branch, and core-8-6-branch; see commits [0f866663], [5c47ae3e], and [3aacabb1].


serhiy.storchaka added on 2026-09-30 08:46:22:

Duplicate of [470331]. Proposed fix in branch menu-post-under-pointer: as suggested here and as other toolkits do, a menu which does not fit below the menubar is posted above it. A menu which still covers the pointer does not invoke an entry on the release of the click which posted it. See [470331] for details.


eserte added on 2006-11-15 05:59:29:

File Added - 202840: menuhack.pl

Attachments: