fix(input): preserve keyboard modifiers while preventing forged lock keys (#34)

This commit is contained in:
喵喵机 authored and GitHub committed 2026-11-09 23:25:07 +08:00
1 parent 62cf979dd6
commit 6d0e733cd7
31 files changed
+569 -40

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ adapts stable Windows APIs at runtime; the Rust host owns policy, desktop
integration, and process lifetime.
```text
UU Remote / Wine
UU Remote / Wine (LD_PRELOAD: compat/libuur-lock-mods.so)
└─ PE ABI adapter (SendInput, GDI/DXGI capture entry points)
└─ authenticated loopback protocol + private frame transport
└─ Rust session supervisor
+2 -1
View File
@@ -79,7 +79,7 @@ sudo apk add ~/packages/*/x86_64/uur-*.apk
Gentoo, Funtoo, Void Linux, Slackware, Solus, Clear Linux, ALT Linux, Exherbo,
Mageia, OpenMandriva, PCLinuxOS, Venom Linux, and other FHS/glibc systems can
install the portable release archive or build from source. Their native recipe
can call `packaging/stage.sh` after the three standard builds; the staged tree
can call `packaging/stage.sh` after the standard builds (`hook`, `capture`, `compat`); the staged tree
is shared with pacman, deb, rpm, APK, and the portable archive.
GNU Guix can wrap the same source build and staged tree. Flatpak and Snap need
@@ -91,6 +91,7 @@ manifests granting Wine execution, session D-Bus, PipeWire, and input access.
cargo build --release --locked
./hook/build.sh
./capture/build.sh
./compat/build.sh
./scripts/install-user.sh
```
+1 -1
View File
@@ -6,7 +6,7 @@
| Receive remote video | available | Official UU UI under Wine |
| Share X11 desktop | available | Wine X11 capture |
| Share Wayland desktop | available | ScreenCast/PipeWire or explicitly enabled native screencopy → GDI adapter |
| Mouse and keyboard | implemented | RemoteDesktop portal → uinput → XTest capability order |
| Mouse and keyboard | implemented | RemoteDesktop portal → uinput → XTest capability order; process-local NumLock/ScrollLock workaround for ordinary controller keys; keypad/case behavior remains native |
| X11 multi-monitor | Wine integration | Native Wine/XRandR display topology |
| Wayland monitor/window selection | available | Persistent portal source selection |
| Wayland virtual source | available when advertised | `uur display source virtual` → ScreenCast Virtual source |
+26
View File
@@ -100,6 +100,7 @@ Alternatively, build and install for one user:
cargo build --release --locked
./hook/build.sh
./capture/build.sh
./compat/build.sh
./scripts/install-user.sh
```
@@ -132,6 +133,31 @@ Openbox, Fluxbox, IceWM, dwm, qtile, herbstluftwm, spectrwm, and FVWM.
Wine captures the X11 desktop directly and uur injects input with XTest. A
ScreenCast portal is not required for this path.
#### Lock modifier bits in the client's key events
Wine can inject a NumLock correction pair on each ordinary key when the
official client's low-level hook blocks lock-key synchronization. This affects
controller-side typing before uur's remote-input bridge receives any records.
The process-local `libuur-lock-mods.so` workaround discovers exclusive NumLock
and ScrollLock modifiers from each X11 display's actual keymap. With
`strip_lock_mods = "auto"` (the default), it filters those bits on ordinary key
events. Numeric masks further restrict the discovered set; `"0"` disables it.
It preserves Super, Ctrl, Alt, AltGr, Shift and CapsLock rather than assuming
that Mod2 and Mod4 are both locks, and refreshes its mapping after layout
changes. No X server, compositor or user lock setting is changed.
Keypad events keep their original state so NumLock-on digits do not become
navigation keys. CapsLock also keeps its case semantics. These events retain
Wine's native reconciliation behavior and can still trigger lock-key
corrections. Use `WINEDEBUG=+key,+keyboard uur run` and the
private session log to distinguish real key conversions from correction
pairs. `uur doctor` reports the local lock state and configured workaround.
After acquiring the session lock, a shim-enabled run restarts only the managed
Wine prefix so its service manager and service-spawned clients receive the
same compatibility environment. Other Wine prefixes remain running.
### Wayland session with ScreenCast and RemoteDesktop portals
Requirements: a working session D-Bus, PipeWire, the xdg-desktop-portal