-
Notifications
You must be signed in to change notification settings - Fork 868
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
Cross platfrom mouse button translation #1785
Comments
It would probably be uncontroversial to include the |
Yeah, I also think that we can include those, I just know that there are mices with something like numpad right on them, though, I have no clue how they are identified. |
The only mice that I know of with such features are "gaming" mice. Presumably, they don't directly expose these extra buttons as generic mouse buttons, but instead have some software component (like Razer Synapse) translate them into whatever is configured by the user. It could also be the case that the mouse presents itself to the operating system as both a mouse and a keyboard. In particular, the "Razer Naga Trinity" and "Razer Naga Chroma" seem to match what you've described. |
I've certainly seen this behaviour (also for keyboards). The most "standard" buttons a mouse might have would be left/right/middle, scroll up/down/left/right, and two left and two right side buttons. However I don't think there's an OS standard beyond Back/Forward. |
There are admittedly two other "buttons" which seem to be semi-standard: tilting the scroll wheel left and right, but these "buttons" seem to either emulate a horizontal scroll wheel or the "forward" and "back" buttons, depending on the exact model of mouse. EDIT: Upon reading @dhardy's comment above, I've now realized that this comment was entirely redundant. Oops. |
@kchibisov Which platform differences are you aware of? I know for example that the "backward" button in X11 is 8, so there seems to be quite a lot of distance between RMB and that. I'm also not sure if this is consistent across mice? But I'd hope so at least. |
On Wayland those are 0x113 and 0x114, since Wayland just forwards kernel buttons. On X11 they are indeed 8 and 9. Web right now uses some other stuff, and macOS, I bet, do something else as well. |
Seems like the only option would be to have actual constants/enum values for all the buttons and painfully mapping every single one of them. |
I wasn't actually actively looking out for this, but I stumbled onto this while dealing with
I was admittedly a little surprised to see these "mouse wheel" buttons, which look like they correspond to moving the mouse wheel one by one "ratchet". I think this behaviour may also be available/implementable in some form on Windows, as I recall reading that some people would re-bind the jump key in Counter Strike to the mouse wheel in order to bhop (bunny hop) (see "mwheeldown" and "mwheelup" on the Valve Developer Community (wiki). |
Right now winit only provides translation for
Left
,Right
, andMiddle,
mouse buttons and everything else is viaOther
, however each platform defines their own value for other for the same buttons, it'll be nice to agree and extendMouseButton
enum to include extra mouse buttons as well.The text was updated successfully, but these errors were encountered: