moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.77k stars 245 forks source link

Suppression on Linux causes slower response from callbacks #464

Open Thorntonac opened 2 years ago

Thorntonac commented 2 years ago

In the program I am writing I need to suppress mouse events and still act on the callbacks. This works fine on all MacOS, and Windows, via the darwin_intercept and win32_event_filter. However when Linux is suppressed there is lag between an event and the callback. I'm looking through the source code but I cant figure out what might be causing this. Tested on Debian and Raspian.

moses-palmer commented 2 years ago

Thank you for your report.

I am afraid that I do not have any definitive solutions for your issue; my observation is that the behaviour under Xorg is rather erratic and depends quite a lot on the underlying X implementation, especially when it comes to event suppression.

My advice it to reconsider using event suppression: does your use case really require it? There may very well be unspotted bugs lurking, as I myself use Wayland and thus use this library under Xwayland.