Skip to content

Conversation

@brccabral
Copy link

Hi,
My mouse has buttons 8 and 9 and I was able to make them work.
Let me know if you have any questions.
Cheers,
Bruno

@bk138
Copy link
Owner

bk138 commented Mar 21, 2024

Hi Bruno,
Thanks for the contribution! Can you please give an outline of the approach taken and how it works?

@brccabral
Copy link
Author

Hi @bk138 ,
I updated the way the tools lookup deal with the buttons mask in key2string().
The buttons mask was only 1-5, 0b 0001 1111, and as it is one byte it could be converted to gchar straight away.
To have buttons up to 10 we need two bytes, 0b 0000 0011 1111 1111, so, in the lookup I added one extra gchar to deal with two bytes, one for 1-8, the new one for 9-16.
The 10 limit happens in the parse_name and in the on_buttonpress callback, but looking at it now we could have up to 16 buttons no problem (I don't have a way to test it, but it should work). As said, I tested buttons 8 and 9.
I think it is standard that buttons 4-5 are mouse wheel scroll up and down, but I didn't test it.

To add even more buttons, just update the parse_name and the lookup key2string.

Let me know if you have more questions.
Bruno

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

Successfully merging this pull request may close these issues.

2 participants