You are not logged in.
Hey,
I'm working on DWM again and wanted to add some command using mouse Button6 and Button7. I found out Xlib's headers (not sure which at the moment) have no support for mouse buttons higher than Button5. You have to manually define them like so:
#ifndef Button6
#define Button6 6
#endif
#ifndef Button7
#define Button7 7
#endif
I'm curious as to why these aren't "supported" through the official header files, as they do work?
Last edited by Unia (2013-11-03 12:19:32)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
You don't need to define them at all. Just use the number. I've never used those button definitions - don't they strike you as a little silly: putting "Button1" instead of just "1"*. And how many buttons do you think should have such silly definitions in the header files? One could argue that 3 are the only really globally used buttons. 5 buttons are common, 7 slightly less so, but mice can have a ridiculous number of buttons.
(*) I'd actually argue that the following code makes more sense as it adds just as much value but saves characters:
#ifndef 7
#define 7 7
#endif
Of course the compiler doesn't allow this one.
Last edited by Trilby (2013-11-03 12:13:01)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
True, but then why are button one to five defined?
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
No idea. I'd not necessarily advocate for things like "#define ButtonLeft 1" but at least that would serve a purpose. The Button# defintiions are just silly. The x server can handle button numbers up to (at least) 12.
Last edited by Trilby (2013-11-03 12:16:49)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Conclusion: X is silly Oke, we're done here! I'll mark this as solved.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline