X11 background input cannot reach GTK/Qt/Chromium: port the XI2 MPX + uinput path (deferred)
Summary
On X11, OmO's background (focus-preserving) input uses XSendEvent. GTK, Qt, LibreOffice VCL and Chromium/Electron drop synthetic events, so background input cannot reach them; OmO refuses with BackgroundUnavailable and points to delivery:"foreground" or AX actions. Both reference implementations (oh-my-pi and trycua/cua) instead deliver real, non-synthetic background input through an XInput2 MPX second master pointer/keyboard backed by uinput slaves. This issue tracks porting that path. It was deliberately deferred during the computer-use ship-readiness pass; the decision was approved.
Why deferred (not in the current release)
- It cannot be verified on any surface the project tests today: CI and the local container plan use Xvfb, which both references hard-exclude (no uinput hot-plug).
- The failure modes are session-level crashes (KDE Plasma X11 on uinput hot-plug; mutter 42 and LibreOffice VCL on master add/remove churn), so the gating must be ported exactly and proven on real Xorg.
- Default-install reach is limited: without a udev rule,
/dev/uinputis usually not writable by the desktop user, so the path reports unavailable and behaviour stays as it is today.
Expected (ideal state)
On a real Xorg session with a writable /dev/uinput, XI >= 2.2 and a compatible window manager, delivery:"background" clicks, drags, scrolls and keystrokes reach GTK/Qt/VCL/Chromium windows without moving the user's pointer or keyboard focus. Everywhere else the capability probe reports MPX unavailable and today's refusal is unchanged.
Design (both references converge on this)
- New module
crates/senpi-desktop-backend-x11/src/mpx/:probe.rs(refuse on KDE Plasma X11, non-writable/dev/uinput, Xvfb/Xvnc/Xtigervnc server, TigerVNC vendor, XI < 2.2),uinput.rs,master.rs(owner-named masters, add/find/attach, orphan reaping at start-up),pointer.rs,keyboard.rs(lazy keyboard slave),confirm.rs(raw XI2 confirmation of each press/release). - One master pair for the whole desktop session with an idle TTL (cua: 30 min); never add/remove per action.
- Core events disabled on the new master so core-protocol window managers do not treat it as a user activation; the virtual cursor parked in a corner between actions.
- Per action: warp, re-check the target is under the point, press/release, confirm through raw XI2 events; keyboard refuses while a same-pid popup may hold a grab, and a focus snapshot verifies the user's focus was untouched.
- Core-only clients (xterm, Tk, Motif) keep
XSendEvent.
Reference evidence (file:line in both repos, with trade-offs) is in the design research written for the ship-readiness pass; the relevant anchors are oh-my-pi linux/x11/mpx.rs, linux/x11/input.rs:939-968 (probe) and cua input/mod.rs:465-705.
Acceptance criteria
- A real-Xorg + uinput test lane (not Xvfb) exists and runs the new scenarios; Xvfb CI keeps asserting the probe reports unavailable and the refusal is unchanged.
- Background click/type/scroll into a GTK3 and a Qt window change the target while the user's pointer position and focused window are unchanged (measured).
- No orphaned master or second cursor survives engine exit or a crash (start-up reaping proven).
- KDE Plasma X11, Xvnc/Xtigervnc and non-writable uinput environments never create a master (probe tests).
Related
- #9074 (X11 AT-SPI owner resolution), #8974 (X11 gap closure), the synthetic-drop detection follow-up filed alongside this issue.
Source: code-yeongyu/oh-my-openagent