| Description: |
This patch (1) documents the currently unused and undocumented <<ContextMenu>> virtual event, and (2) makes <<ContextMenu>> be generated by <Control-Button-1> in addition to <Button-2> on Aqua.
Adding the <Control-Button-1> sequence could be considered a partial fix for [1105433], although the purpose of <<ContextMenu>> only appears to be to provide a platform-independent event to know when to post a context menu, and not a general substitute for knowing when the right mouse button is pressed (or released). (See also [6ff8f7b07a], which requests platform-consistent mouse button bindings.) An alternative could be to have Control + left mouse click generate <Button-2> events directly, but while that might make some existing programs (ones that already know to bind to <Button-2> instead of <Button-3> on the Mac but lack <Control-Button-1> binding) work as Mac users expect them to, it will break any programs that have behavior for <Control-Button-1> distinct from the behavior of <Button-2>.
|
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2020-05-12 15:29:30:
It is now possible to bind to <Menu> events on macOS.
chrstphrchvz added on 2020-04-24 03:09:26:
I'm curious whether <<ContextMenu>> should also be generated by pressing the "Application"/"Menu" key—<Key-App> on Windows and <Key-Menu> on X11 (at least on recent Linux and probably BSD as well). The fact that different platforms use different keysyms might be a good reason to.
(On the Mac, if a PC keyboard is used, macOS does detect the Menu key and will send apps events for it, but I'm not aware of an app that responds to it, even a cross-platform one with context menus; someone who really wants this behavior probably has to use a utility like Karabiner-Elements to map it to a button press. The Menu key is currently unrecognized by Tk Aqua, so programs receive a ?? keysym when it is pressed. A valid keysym could be easily defined for it, and even though Windows and X11 generate different keysyms for it, the choice Aqua uses might not matter if programs should instead use <<ContextMenu>> for that reason. Though if <<ContextMenu>> is supposed to have relevant %x and %y, then generating it from a key event runs into [30ce26f48d]: key events on Aqua do not provide %x and %y. Even though, on other platforms, pressing the Menu key tends post the context menu at the insertion point or the corner of the focused window, rather than the mouse location.)
|