-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Allow event "consumption" on Linux via evdev #150
Comments
I am going to need a lot more detail about how this would work. A proof-of-concept would be ideal. If it is possible I don't mind adding it to 1.3 which is currently in progress and overhauls a lot of the Linux code. |
Thanks for the quick reply! |
Apologies, I thought I responded to this weeks ago but just noticed I never submitted my response. I've read though the readme and it looks like it is interacting with /dev/input which would require additional permissions and why this library doesn't currently use /dev/input. I'll leave this open for a while and revisit the idea of /dev/input in the future. |
This might also be needed for support of Wayland. Unless Wayland on Linux is not a goal of this project? |
I'm also interested in Wayland and |
After a lot of thought, |
Consider this as a bit of a self-plug. I've personally used |
I was just looking at libevdev which looks like its going to deal with most of the heavy lifting. The biggest problem I am aware of is that the mouse coordinates are all relative which is both good and bad. I would need to figure out a way to get those relative coordinates mapped on to the desktop environment. |
Could that not be performed with a display-server-specific function call for X11 and Wayland? Correct me if I'm wrong 💯 |
Do any of you know how to consume events with libevdev? I am working on setting up epoll and event hooking but I have no idea how to prevent event propagation. |
The way that I have done it was by calling |
@szymonj99 thanks for the info, the only example I've found is this where it kind of proxies what is read to something created with |
When I was working with libevdev, I've never tried running the program multiple times, but I assume it would not be optimal 😆 How the events would get passed along I'm not too sure, but if the libevdev device is grabbed, then I would assume that only the first process that grabs the device would see the events, and they wouldn't be passed further. This would mirror the normal behaviour when a libevdev process grabs the device, and the display server etc. does not see the events. |
Good news and bad news. I've got it things more or less working with libevdev. The bad news is that It is pretty easy to override the permissions with a
After running If we stick with evdev we would likely need to use one of these udev rules to make permissions more permissive. This isn't the end of the world, but it is definitely inconvenient. I would also need to verify that this solution works on at least a few other distributions. I don't use systemd so there maybe other issues. Other options. There is libinput which sits a bit further up the stack and does not require any special permissions or udev rules. I believe there are some x11 compatibility here so this makes it an appealing choices when trying to support both environments. Con is that you couldn't use it outside of the window environment like x11 or wayland which was a feature ask at some point. Thoughts? |
On other platforms, it's possible to consume an event by setting reserved to 1.
Under Linux, this could be done by "grabbing" the device(s) when using evdev.
And then forward events to a new virtual device if reserved is 0.
This solution would work for X11 and Wayland.
What do you think?
BTW: this is how evsieve works
The text was updated successfully, but these errors were encountered: