raboof / notion

Tiling tabbed window manager
https://notionwm.net/
GNU Lesser General Public License v2.1
271 stars 64 forks source link

Mouse buttons only working up to #7 #265

Open ballerburg9005 opened 4 years ago

ballerburg9005 commented 4 years ago

In most gaming mice there are almost a dozen buttons. I got an old Razer Deathadder and it's "prev" and "next" buttons are identified by xev as button 8 and 9. Button 6 and 7 are unused for some reason.

When I try to put Button8 in cfg_bindings.lua, I get the error: Unknown button "Button8".

raboof commented 4 years ago

Indeed the list at https://github.com/raboof/notion/blob/master/ioncore/conf-bindings.c#L55 seems to go up to 7. Apparently the value associated with it is interpreted as 'ksb' - though I don't know off the top of my head if/why '8' would be the correct ksb for Button8. Could you try out extending that list with a Button8 and seeing if that indeed works? If so, could you PR?

ballerburg9005 commented 4 years ago

It appears that key codes in X11 start at 8 and Valkonen did not keep pointer codes and key codes separate. He made one integer table for both.

Would it be acceptable if I fixed this by just shifting pointer codes up +100000?

raboof commented 4 years ago

It appears that key codes in X11 start at 8

Where did you find that? The first one I see in X11/keysymdef.h is 0x0020

ballerburg9005 commented 4 years ago

In xmodmap -pk you should see that key codes (not keysyms) start at 8 (8 = no value, 9 = Escape).

xmodmap -pp shows pointer codes.

Also my Deathadder mouse is the left-handed version and it has left and right buttons reversed by hardware, which I have to reverse with xmodmap ... so it should be kept in mind that some people might have switched Button8 with Button12 and so forth.

So what do you say?; just make it a huge int and use like the last 1000 for buttons?

raboof commented 4 years ago

xmodmap -pk you should see that key codes (not keysyms) start at 8

nice tool, thx

It appears that key codes in X11 start at 8 and Valkonen did not keep pointer codes and key codes separate

If I'm reading https://github.com/raboof/notion/blob/master/ioncore/conf-bindings.c#L177 correctly, it seems bindings for keypresses and bindings for buttons are separate (distinguishable by act), and for keypresses ksb holds the keysym and kcb the key code, but for buttons both ksb and kcb hold the value from the button_map table. Perhaps those are pointer codes after all? Or we could adapt them accordingly?

wilhelmy commented 4 years ago

So what do you say?; just make it a huge int and use like the last 1000 for buttons?

I'd say helping hands are welcome (provided that the code is readable). I don't have such a fancy mouse to test with (and I doubt anyone else here does) so if you get it working please make a PR, someone will review it and if there are no objections it will be merged. That's usually how it goes, anyway.