Add isolated Remote VK and XKB keyboard conversion
This commit is contained in:
1 parent
affe313b0a
commit
2d6dba20aa
7 files changed
+522
-3
No files matched your search
@@ -0,0 +1,84 @@
|
||||
# Keyboard conversion prerequisite
|
||||
|
||||
`src/keyboard.go` supplies an isolated, bidirectional conversion between XKB
|
||||
keysym names and NVDA Remote `vk_code`/`extended` identities. It does not capture,
|
||||
forward or inject keys. The source command still discards incoming keyboard
|
||||
payloads and requests no keyboard grant. No reader code changed for this
|
||||
increment.
|
||||
|
||||
## Mapping contract
|
||||
|
||||
Construct an immutable map with an explicit profile:
|
||||
|
||||
- `portable`: lowercase Latin letter key names, top-row digits, F1–F24,
|
||||
left/right Shift, Control, Alt and Super, Menu, Caps Lock, Num Lock, Scroll
|
||||
Lock, Pause, Print, Backspace, Tab, Escape, Space, Return, and keypad and
|
||||
navigation keys. `Prior`/`Next` and their keypad forms are accepted aliases.
|
||||
- `us`: the same keys plus the eleven US OEM punctuation key identities.
|
||||
This requires an explicit US-layout agreement; it is never an automatic
|
||||
fallback. OEM meanings on other layouts remain unsupported.
|
||||
|
||||
Input names must identify the unshifted key under the agreed layout, rather
|
||||
than the resulting text. `a` names the letter key; `A`, `exclam`, `ISO_Left_Tab`,
|
||||
dead keys and Unicode text are not normalized into guessed keys. A future Xorg
|
||||
owner must resolve the active layout and modifier/lock state. `portable` means
|
||||
a limited set of logical identities, not identical text on arbitrary layouts.
|
||||
|
||||
Main Return and keypad Enter use different extended flags. Navigation keys,
|
||||
Insert and Delete also retain their main/keypad distinction, including keypad
|
||||
digits versus keypad navigation under Num Lock. Left/right modifier VKs are
|
||||
emitted explicitly; right Shift is **not** an extended key. Scan codes are never
|
||||
fabricated from X keycodes or keysyms.
|
||||
|
||||
Incoming generic Control/Alt use the extended flag for side selection. Generic
|
||||
Shift requires scan `0x2a` or `0x36`; absent or unknown scan information is
|
||||
rejected. Side-specific VKs determine identity directly; other scan information
|
||||
is range-checked but does not override the identity or become an X keycode.
|
||||
Unsupported extended/VK combinations are rejected. The same conversion applies
|
||||
to both press and release, and outgoing press state survives the JSON codec.
|
||||
|
||||
AltGr (`ISO_Level3_Shift`), level-five modifiers, IME/dead keys, other OEM
|
||||
profiles, OEM102, multimedia keys and unsupported VKs remain unavailable.
|
||||
In particular, no implicit Control press is generated to emulate Windows AltGr.
|
||||
Unknown profiles, key names and wire identities return one constant error with
|
||||
no input text or partial key. The maps retain no caller input, held-key state,
|
||||
desktop handles or consent and can be read concurrently.
|
||||
|
||||
## Integration boundaries
|
||||
|
||||
This helper has no callers in the live coordinator. Before connecting it to
|
||||
keyboard services, the reader must provide exclusive capture, trusted routing,
|
||||
delivery-time lease checks, a core escape and independent injection cleanup.
|
||||
The input owner must retain the original key mapping from down through repeat
|
||||
and up. Layout/Num Lock changes while held must not remap the release. Mapping
|
||||
failure must suspend input and release only owned keys rather than dropping a
|
||||
key-up or clearing physical modifiers. Lock-state synchronization, physical
|
||||
collisions and bypass/repeat handling remain separate unfinished work.
|
||||
|
||||
Mapping a supported wire key does not establish that the destination's active
|
||||
keymap contains it. Injection must resolve destination keycodes on its Xlib
|
||||
owner, reject unavailable keys, and never rewrite the global keymap as a
|
||||
fallback. A new mapper can describe a changed layout, but this library does
|
||||
not detect changes, manage transitions or select a profile from relay data.
|
||||
|
||||
## Evidence and references
|
||||
|
||||
Fixed expectations cover both transitions for modifiers, reader modifier keys,
|
||||
keypad/navigation, lock keys and all letter/digit/function ranges. Tests also
|
||||
cover generic modifiers, explicit OEM profiles, aliases, invalid/ambiguous
|
||||
input, independent concurrent maps, and the real JSON codec and membership
|
||||
direction checks. These are synthetic protocol tests; they neither consume
|
||||
desktop input nor exercise an X server or Windows keyboard hooks.
|
||||
|
||||
The VK values and layout dependence were checked against Microsoft's
|
||||
[virtual-key reference](https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes).
|
||||
Scan codes and extended flags are distinct Windows event metadata; see
|
||||
[keyboard input](https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input)
|
||||
and [low-level events](https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-kbdllhookstruct).
|
||||
The existing reader XKB bindings and system X11 keysym definitions supplied the
|
||||
symbol names. The local NVDA reference at
|
||||
`2843e703ce19757711e976ebb6e9c5b689fc2017`,
|
||||
[`input.sendKey`](https://github.com/nvaccess/nvda/blob/2843e703ce19757711e976ebb6e9c5b689fc2017/source/_remoteClient/input.py),
|
||||
was inspected for wire-field use. No mapping table or implementation was copied
|
||||
from NVDA or Orca. No actual NVDA frame capture, physical keyboard acceptance,
|
||||
desktop recovery, audible speech or Braille acceptance is claimed.
|
||||
Reference in new issue
Block a user