gromit-mpx icon indicating copy to clipboard operation
gromit-mpx copied to clipboard

support for extra mouse buttons

Open brccabral opened this issue 2 years ago • 2 comments

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

brccabral avatar Mar 19 '24 20:03 brccabral

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

bk138 avatar Mar 21 '24 18:03 bk138

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

brccabral avatar Mar 21 '24 19:03 brccabral