Repository navigation
Description
Unit
Port the X11 keysym table and the mouse button answers of libobs/obs-nix-x11.c.h to rust/obs-hotkey, as a new module nix_x11_input, next to nix_x11_keys (#2901) and nix_hotkey_state. On X11 (Linux and FreeBSD), libobs uses them to fill the base keysym table at hotkey init (which nix_x11_keys then searches) and to answer the hotkey thread's "is this mouse button down" poll. These decisions move:
get_keysym(): the X keysym of each obs key (XK_*,XF86XK_*,SunXK_*, andn << 16for Mouse 1 to 5); 0 for a key it doesn't name.fill_base_keysyms()keeps its loop and asks for each key.- The XInput answer of
mouse_button_pressed(): each obs mouse key's slot in the three per-button arrays (Mouse 1 is slot 0, Mouse 2 slot 2, Mouse 3 slot 1, Mouse 4 to 29 slots 7 to 32), pressed in this drain or held from before. - The commit loop after it: each updated slot's held state takes this drain's pressed state.
- The answer without XInput: the pointer mask's button bit for Mouse 1 to 3.
These stay in C: the raw event drain (xcb_poll_for_event, the event reads and their stores, each free), the two memsets, xcb_query_pointer with its reply, error and frees, every blog, key_pressed(), fill_keycodes(), the key names and the vtable.
Phase and position
Phase 6, Linux host code; the X11 hotkey logic left in C after the key map lookups (#2901). Tracking: #4.
Dependencies and existing tests
- No dependency to land first; nothing open in the
nix+unity group. - Real libobs:
test_x11_hotkey_layout,test_x11_volume_keys,test_x11_keymap(the base keysym table throughobs_key_to_virtual_keyand the key map),test_hotkey_volume_keys. - No characterization of the moved functions on their own:
test_nix_x11_input_stepslands first in the same PR, builds the moved C file on its own (no X header) and runs on every OS.
Notes
One PR, separate commits: the behaviour-neutral move into libobs/obs-nix-x11-input.c.h (hidden functions on plain values, no xcb or Xlib header; the keysyms as their values, checked against the X headers by the move check), characterization, RED, GREEN (group libobs.ported-nix-x11-input in the Linux ported sources), Tier 3 (exhaustive over every key for the keysym and the answer, every pressed, update and held state of the arrays, every 16-bit pointer mask), docs.
Parity note, pinned and kept: Mouse 29 reads slot 32, which no raw event fills, so it never reads as pressed with XInput.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 30, 2026
Claiming: #3054
Plan, one PR with separate commits:
libobs: Movethe keysym table, the XInput mouse answer, its commit loop and the pointer-mask answer intolibobs/obs-nix-x11-input.c.h, hidden functions on plain values with no X header, behaviour-neutral (checked by building master's and the moved functions side by side on the same inputs, every key and array state).test_nix_x11_input_steps, building the moved file on its own, on every OS.obs_hotkey::nix_x11_inputagainsttodo!()stubs.src/ffi/nix_x11_input.rs, grouplibobs.ported-nix-x11-input.rust/README.md,naming.md, the crate description andlib.rs.Draft PR once the RED commit exists, today.
libobs: Move X11 keysyms and mouse button answers
test: Characterize X11 keysyms and mouse answers
obs-hotkey: Add Tier 1 tests for X11 input port
obs-hotkey: Port X11 keysyms and mouse answers
obs-hotkey: Check the X11 input port against the C
docs: Record the X11 keysym and mouse answer port
rdoupe commentedon Oct 30, 2026
Fixed by #3060 (merged through the merge queue as 3edcda4). The X11 keysym table (
get_keysym), the XInput mouse slot map with its answer and commit, and the QueryPointer mask answer now live inrust/obs-hotkeyasnix_x11_input; libobs calls them through hidden functions inlibobs/obs-nix-x11-input.c.h. Tier 1 (21 cases), the unchanged C tests under Xvfb, and Tier 3 parity against the C (7 cases, 18 mutants all killed) pass. No intentional difference in behaviour; two keysym collisions and Mouse 29 reading slot 32 are characterized and kept.Left, by design: the raw event drain, the memsets, the QueryPointer request with its reply and frees, every log,
key_pressed(),fill_keycodes(), the key names and the vtable stay in C. There is no follow-up issue for them. The unit has no checkbox on the tracking issue (#4), so none was ticked.obs-hotkey: Port X11 keysyms and mouse answers (obs-rust#3060)