Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] middle and right mouse buttons swapped #31

Closed
chrstphrchvz opened this issue Apr 30, 2018 · 2 comments
Closed

[macOS] middle and right mouse buttons swapped #31

chrstphrchvz opened this issue Apr 30, 2018 · 2 comments

Comments

@chrstphrchvz
Copy link
Contributor

Related to #24.

The numbering of middle and right mouse buttons depends on platform: Mac aqua (and classic as well—is this still supported?) designate the right mouse button as button 2 and the middle button as button 3, which is the opposite of what X11 on Mac, Linux/other Unixes, and Windows use. It appears to be 'intentional' that Tcl/Tk passes this mapping through to programs rather than attempting any automatic renumbering.

So at the moment, any events that normally happen with a right click are bound to the middle mouse button, which might not even be available depending on the mouse or trackpad. Nor is there a built-in keyboard modifier to emulate it (as there is for right click: control + left click).

Some Tk widgets have right-click events that are hardcoded to a specific button number, e.g. Text.

The quick workaround I have would be to check if windowingsystem is 'aqua' and bind button events appropriately. I'm willing to provide fixes like this for any cases I come across, but I'd like to discuss whether there's a more desirable/universal way of dealing with this.

I found this issue while using Tcl::pTk, but it 'inherited' the behavior from Perl/Tk code it borrows. So any effort for solving this from Perl/Tk I'll consider passing along to Tcl::pTk and vice versa; see this issue I filed for some thoughts I had on more elaborate workarounds.

@chrstphrchvz
Copy link
Contributor Author

Another idea would be to define events that automatically correspond to buttons 2 and 3 depending on windowingsystem. Naïve names for these would be events named ButtonPress-Right, ButtonRelease-Right, etc. (although those are right-hand biased); and similarly for -Middle events; and maybe for completeness -Left events could also be defined for button 1. I don't know if this is a good idea, especially unless somehow Tcl/Tk were to consider the same approach.

@chrstphrchvz
Copy link
Contributor Author

I might submit changes made by Tcl::pTk to Perl/Tk code it borrowed relevant to this issue for consistency, but I don’t think there is any point leaving this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant