3 ms·
X11 works.. when noone actually uses X11, but actually some wrapper API that was made alongside the development of X11, or suffered through effectively replayin
by dzaima 3y ago
X11 works.. when noone actually uses X11, but actually some wrapper API that was made alongside the development of X11, or suffered through effectively replaying history. Some fun things I recall encountering while trying to use it:
Want to detect a left click? Sure! How about the back/forward buttons on the mouse? nope, not in the API; well, if you try pressing them you'll see them going to mouse button constants 8 & 9, but I didn't find that in any documentation.
Want to get scrolling events? There are mouse press things for that (even left/right!). Want to also handle touchpads which may have fractional scrolls? Well, there is some confusing "valuator" stuff, and you can take a delta between two valuator event floats.. but after using it for a while, you'll notice that the app will like randomly scroll by large distances. Turns out... that valuator value is a globally accumulated value, so you have to hack in a thing to "reset" the "calibration" of that any time the mouse exits a window (try it -
move mouse out & in a window, scroll one tick, repeat - you'll never scroll anywhere).
For text input, you can thankfully call a thing that'll do XCompose & most key handling for you, but to handle xmodmap I believe you have to write the mapping functionality yourself; didn't bother. Then there's some stuff about how in some context a window was not focusable through some specific method for some undetermined amount of time after being made visible, but there might be some reason for that (never bothered to figure it out).
Now, I don't know if wayland does any better on any of this, but I sure hope it does, as it does seem to at least make an attempt at being usable. Maybe wayland will go the same route, with a middle-man library that handles all the DE-specific stuff. There's already some of that for window decorations.
- yjftsjthsd-h 3y ago> Want to detect a left click? Sure! How about the back/forward buttons on the mouse? nope, not in the API; well, they are on some mouse press constants 8 & 9 if you dig around enough. Yes? They're just more buttons; how would you expect them to work?
- dzaima 3y agoI'd expect them to be documented somewhere, so that I could be sure that they're not gonna be swapped or map to some other buttons (and not have to find out about it through trial/error or blogs/reading GTK's source). edit: edited my original post to be more clear
- tedunangst 3y agoHow in the world is X supposed to know what USB event your mouse sends when you click the button on the side? Did you ask the mouse manufacturer for documentation?
- dzaima 3y agoI don't know where that information comes from (I'd assume the kernel? wayland[0] refers to the kernel[1]), but surely if I, and every GUI app that wants to use the mouse, is supposed to know it, X definitely could too. If I recall correctly, the left/middle/right button values were documented (to 1/2/3, which doesn't match the linux header ones), so surely more could. [0]: https://wayland.app/protocols/wayland#wl_pointer:event:button https://wayland.app/protocols/wayland#wl_pointer:event:butto... [1]: https://github.com/torvalds/linux/blob/4a0fc73da97efd23a383ca839e6fe86410268f6b/include/uapi/linux/input-event-codes.h#L355-L363 https://github.com/torvalds/linux/blob/4a0fc73da97efd23a383c...
- PH95VuimJjqBqy 3y agoI'm not sure I understand the complaint. Anytime I've ever had to map extra mouse buttons I've always had to do a discovery step to figure out what "button number" any specific mouse button mapped to.
- dzaima 3y agoIs that for back/forward, or extra buttons on top of those? Back/forward have pretty standard meanings & usages so I'd expect them to work out of the box (and they have for me). Can't comment much on other extra buttons though, quite possible those don't really have a good way of being handled.
- PH95VuimJjqBqy 3y agoI've never seen forward/back buttons that didn't involve the driver making interpretations.