Repository navigation
Description
Unit
Port the keysym tables, the keymap row rule and the focused-key rule of libobs/obs-nix-wayland.c.h to rust/obs-hotkey, as a new module nix_wayland_keys, next to nix_hotkey_state (#1516) and nix_x11_keys (#2901). On Wayland (Linux and FreeBSD), libobs uses them in obs_key_from_virtual_key / obs_key_to_virtual_key, to build its keycode and keysym maps whenever the compositor sends a keymap or the layout changes, to name the GlobalShortcuts portal's preferred triggers, and to tell the hotkey thread which keys are held while OBS has keyboard focus. These decisions move:
obs_nix_wayland_key_from_virtual_key(): the obs key for each XKB keysym,OBS_KEY_NONEotherwise.obs_nix_wayland_key_to_virtual_key(): the XKB keysym for each obs key, 0 otherwise.load_keymap_data()'s rule for one keycode: a keycode at or aboveMAX_KEYCODESis skipped; each of theMAX_SHIFT_LEVELSlevels with a keysym stores its first keysym for that level, and the obs key's keycode is stored only if none is yet (the first keycode wins).set_focused_key()'s rule: the evdev scancode plus 8, the bound, the level-0 keysym, and the obs key it is pressed or released as.
These stay in C: every xkbcommon and Wayland call (including xkb_keymap_key_get_syms_by_level, whose result C passes in), the keymap mmap and compile, the rebuild's memsets, the modifier mask, the seats and registry, every obs_nix_hotkey_state_* call, wayland_key_name, obs_nix_wayland_key_to_str and the vtable.
Phase and position
Phase 6, Linux host code; the Wayland counterpart of the X11 key map port (#2901). Tracking: #4.
Dependencies and existing tests
- No dependency to land first; nothing else is open on
obs-nix-wayland.c.hor its unity group. - Real libobs:
test_wayland_hotkeys,test_wayland_keymap,test_wayland_multiseat,test_wayland_volume_keys,test_hotkey_volume_keys. - No characterization of these functions on their own:
test_nix_wayland_keys_stepslands first in the same PR, builds the moved C file on its own (no compositor) and pins both tables, the row rule and the focused-key rule.
Notes
One PR, separate commits: the behaviour-neutral move into libobs/obs-nix-wayland-keys.c.h (hidden functions on plain values and passed arrays, no Wayland header), characterization, RED, GREEN (group libobs.ported-nix-wayland-keys in the Linux ported sources), Tier 3 (exhaustive over every obs key and every keysym either table names, generated keymaps, every scancode 0 to 300 with press and release sequences across a layout change), docs.
Bug fixed in the port (intentional difference, listed in the parity test): a key held while the keyboard layout changes stays held for hotkeys until OBS loses focus. Its press and its release are both looked up through the current layout's level-0 keysym, so after a switch (for example QWERTY to AZERTY) the release of Q goes to the obs key A, and the hotkey bound to Q reads as held until a focus leave clears every key. The port records the obs key each keycode was pressed as, and its release releases that key. Not reported by a user; only keys whose level-0 keysym differs between the two layouts are hit.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 30, 2026
Claiming: #3069
Plan, one PR with separate commits:
libobs: Movethe two keysym tables,load_keymap_data()'s level loop andset_focused_key()'s keycode rule intolibobs/obs-nix-wayland-keys.c.h, hidden functions on plain values and passed arrays, behaviour-neutral (checked with a harness that builds master's and the moved functions side by side on the same inputs, with planted mutants).test_nix_wayland_keys_steps, compiling the moved file on its own, no compositor.obs_hotkey::nix_wayland_keysagainsttodo!().libobs.ported-nix-wayland-keys, with the layout-change release fix as the one intentional difference.rust/README.md,naming.md, the crate description and module docs, aport_comparisonbench.Draft PR expected today, once the RED commit exists.
libobs: Move the Wayland keysym tables
test: Characterize the Wayland keysym tables
obs-hotkey: Add Tier 1 tests for the Wayland keys
obs-hotkey: Port the Wayland keysym tables
obs-hotkey: Check the Wayland key port against C
docs: Record the Wayland keysym tables port
rdoupe commentedon Oct 30, 2026
Fixed by #3072 (merged through the merge queue).
What landed: the Wayland keysym tables (both directions), the keymap row rule and the focused-key rule now live in the
nix_wayland_keysmodule ofrust/obs-hotkey, with Tier 1 tests, Tier 3 differential tests against the C oracle and the characterization testtest_nix_wayland_keys_steps. The one intentional difference is the bug fixed in the port: a key held while the keyboard layout changed is now released as the key it was pressed as, so a push-to-talk on Q no longer stays on after a switch to AZERTY.What is left: nothing in this unit. Every xkbcommon and Wayland call, the keymap mmap and compile, the seats and registry, the
obs_nix_hotkey_state_*calls,wayland_key_name,obs_nix_wayland_key_to_strand the vtable stay in C by design.Follow-up: the next piece of the Wayland hotkey area is the GlobalShortcuts portal client's outcome, descriptions and trigger rule (#3081), which is still open.
Tracking issue #4 has no checkbox for this unit, so there was nothing to tick.
obs-hotkey: Port the Wayland keysym tables (obs-rust#3072)