Repository navigation
Let the Linux hook leave virtual mice to the compositor - #731
Open
TanjimReza wants to merge 2 commits into
Open
TanjimReza wants to merge 2 commits into
TanjimReza wants to merge 2 commits into
Conversation
The evdev backend grabs every relative pointer with BTN_LEFT, including uinput devices created by remote-desktop tools (RustDesk, Input Leap...). Their motion is swallowed while buttons still reach the compositor through the LBM virtual pointer, so remote clicks land at the local cursor. LBM_EVDEV_SKIP_VIRTUAL=1 leaves nodes under /sys/devices/virtual to the compositor. Off by default: remappers such as input-remapper re-emit the physical mouse through uinput and still need routing.
TanjimReza
force-pushed
the
fix/linux-skip-virtual-mice
branch
from
September 26, 2026 09:34
5c62661 to
e8a2540
Compare
The hot-plug scanner reopened every /dev/input node twice (mice pass, keyboards pass) every 2 s. Each evdev close waits in synchronize_rcu(), 10-30 ms on audio jack-detection nodes, and the duplicates of devices the pump already holds were dropped on the pump thread, so the pointer stuttered at every rescan. Watch /dev/input with inotify (IN_CREATE | IN_MOVED_TO, 300 ms settle) and scan only when a node appears, plus once when the scanner starts to cover the gap after the arm-time enumeration. Removals still go through the POLLHUP purge. Classify each node in a single pass. The 2 s poll stays as the fallback when inotify is unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: the evdev backend grabs every mouse-like device, including virtual ones created by remote-desktop tools (RustDesk, Input Leap, Barrier…). Their motion is swallowed while their button events still reach the compositor through LBM's virtual pointer, so remote clicks land wherever the local cursor happens to be.
Reproduced with RustDesk 1.4.9 on Ubuntu 26.04 / GNOME 50 Wayland, with two monitors at different scales (2560×1440 @ 133% + 1920×1080 @ 100%): an evdev capture showed zero events on RustDesk's device while LBM's pointer re-emitted its clicks.
Change: new opt-in env var
LBM_EVDEV_SKIP_VIRTUAL=1. When set,enumerate_mice(rust/crates/lbm-hook/src/hook/linux/evdev/devices.rs) leaves devices under/sys/devices/virtualto the compositor. Default behavior is unchanged, since remappers like input-remapper re-emit the physical mouse through uinput and still need routing.Testing:
master;cargo test -p lbm-hookpasses.lbm-hook+lbm-pattern) followingpackaging/arch/PKGBUILDand installed it on the machine above.Follow-up: happy to turn this into a toggle in Options (e.g. "Ignore virtual mice (remote desktop tools)"), passed in the ZonesLayout like
LoopX, if you'd like that. Let me know where you'd want it.