-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ability to use Mouse 4 and Mouse 5 as hotkeys #20811
Conversation
Changelog entry: Added ability to use Mouse 4 and Mouse 5 as hotkeys |
Interesting, wouldn't it make sense to add more mouse buttons? Surely we shouldn't be limiting ourselves to just 2 |
Mouse1(left), Mouse2 (middle), Mouse3 (right) are somewhat special in the code, and it's probably not necessary to mes with them. This PR handles Mouse4 and Mouse5 (which previously were ignored.) I don't think there are any other mouse buttons that SDL2 can return: https://wiki.libsdl.org/SDL2/SDL_MouseButtonEvent |
Just fixed a minor bug. Now, mouse4 and mouse5 are theoretically handled exactly the same way as any other keyboard input events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some style issues, commented them below. To test style locally you can run the make check
command.
Also could you please rebase on upstream/bleed? We don't do merge commits
9ff97ce
to
91439a7
Compare
Thank you for the feedback. I believe I have just fixed these problems (merge commit + linting issues.) |
I tested this in Linux, SDL does return mouse buttons up to 8 (tested using a device with buttons up to 10, it looks like the limitation is X rather than SDL though). |
So, you saying it should also handle mouse 6-8? I could implement that. |
Seems like our SDL wrapper just exposes X1 and X2, so I would limit it to that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't test the two new buttons but the related code changes lgtm.
I looked a bit more into it. |
Could you squash the commits? |
91439a7
to
ddf515b
Compare
Commits are now squashed |
This pull request adds the ability to use mouse 4 and mouse 5 as hotkeys.
Certain models of high-end gaming mice can map the side buttons to keyboard inputs which can be used as hotkeys (e.g., "#" or "%"), so this change makes the game more fair to players that use standard mice.
The reason why mouse4 and mouse5 were previously not usable as hotkeys is because a one-to-one hotkey to keycode mapping was enforced by the input handling code. This was an artificial restriction; there is no technical reason why the internal enum
OpenRA.Keycode
has to correspond bijectively to SDL keycodes.Thank you and please let me know if you need any additional information