Route quarantined Remote capture and balance bypass modifiers
Add RemoteCaptureRouter for normalized controller capture. Ordinary keys and Cthulhu/NVDA modifier chords are forwarded; only a required core escape chord and local chords derived from resolved bindings stay local. A local chord first releases forwarded modifiers remotely; a later forwarded key presses still-held ones again. Releases of local or withdrawn keys are consumed, and retirement reports physically held keys whose releases the native owner must swallow. No production caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b3aa80138
commit
c1333c2fdb
3 files changed
+594
No files matched your search
@@ -136,6 +136,38 @@ existing internal-UI, learn-mode and injected-approval tests, passed with this
|
||||
test added. The `xset` change must follow the
|
||||
listener's connection because Xvfb resets defaults when its last client exits.
|
||||
|
||||
## Capture routing and bypass balancing (2026-11-06)
|
||||
|
||||
`internal/input/remote_capture.go` adds a quarantined `RemoteCaptureRouter`
|
||||
that consumes normalized transitions for one controller capture lifetime.
|
||||
Ordinary keys and Cthulhu/NVDA modifier chords are forwarded. Only a required
|
||||
core escape chord (a non-modifier key; proposed F11) and supplied local chords
|
||||
stay local. Callers derive local chords from `ResolveCommandBindings` filtered
|
||||
to Remote's commands, so user-assigned shortcuts are honored instead of a
|
||||
hard-coded bypass list; the escape always wins over a local binding. Chords use
|
||||
the same group-zero, level-zero keysym and modifier bits as the command owner.
|
||||
|
||||
Modifiers are forwarded when pressed because they cannot be classified yet.
|
||||
When a later key completes a local chord, every forwarded modifier is released
|
||||
remotely first (newest first) and marked withdrawn, so no prefix remains held
|
||||
on the remote. A forwarded key pressed while withdrawn modifiers are still held
|
||||
presses them again before itself, so the remote sees the physical chord.
|
||||
Repeats and releases of local and withdrawn keys are consumed. Releases for
|
||||
keys held before capture are ignored. Orphan repeats, double downs, invalid
|
||||
codes and more than 32 held keys stop routing. `Retire` returns remote releases
|
||||
for forwarded keys in reverse order plus a `Swallow` list of every physically
|
||||
held key: the local application never received those presses, so the native
|
||||
owner must consume their releases before ungrabbing.
|
||||
|
||||
Limitation: a withdrawn prefix reaches the remote as a tap of those modifiers.
|
||||
On Windows a lone Alt tap can activate an application menu bar, and NVDA treats
|
||||
modifier taps specially; this needs live testing and may need a neutral key
|
||||
between press and release. The router has no production caller, performs no
|
||||
I/O and grants no consent or provenance. Nine unit tests cover forwarding,
|
||||
withdrawal and re-press, consumed releases, escape priority, retirement,
|
||||
inconsistent input, invalid chords, resolved Tentacle bindings and composition
|
||||
with the repeat normalizer.
|
||||
|
||||
Still pending: Remote capture within the command owner; local escape and
|
||||
balanced bypass chords; remapping, learn/UI/lock/handoff arbitration; production
|
||||
helper parent-death and blocked-pipe tests; held-key collisions with actual
|
||||
|
||||
Reference in new issue
Block a user