Repository navigation
Description
Unit
Port the Windows virtual-key table, the key name route and the Meta rule of libobs/obs-windows.c.h to rust/obs-hotkey, as a new module windows_keys, next to the X11 key map (nix_x11_keys) and the macOS key map (cocoa_keys). On Windows, libobs uses them when it fills the hotkey platform's virtual-key table, in the hotkey thread's "is this key down" poll, for each key's name in Settings > Hotkeys, and in the public obs_key_from_virtual_key / obs_key_to_virtual_key. These decisions move:
get_virtual_key()(355-952): the virtual key of each obs key (mouse 1 to 5 the button VKs, theOBS_KEY_VK_*keys their VKs, every other key 0);obs_hotkeys_platform_is_pressed()(978-986): Meta is down when either Windows key is; any other key asks its own VK;obs_key_to_str()(988-1041), the name route: none, F13 to F24 by number, Mouse 1 to 29, Pause and Meta by translation, otherwise the scan code (with the extended bit for 11 VKs) and the system name unless the key is anOBS_KEY_VK_*key or the scan code is 0;obs_key_from_virtual_key()(1043-1054): the first obs key with the VK;obs_key_to_virtual_key()(1056-1062): Meta isVK_LWIN, any other key its table entry;obs_key_combination_to_str()(1080-1097): the order Control, Meta (Windows), Alt, Shift, then the key.
These stay in C: GetAsyncKeyState, MapVirtualKey, GetKeyNameTextW, the translation lookups, every dstr_* call, add_combo_key's joins, the platform context's allocation and free, and everything else in the file (system info, symbols, crash handler, host hooks).
Phase and position
Phase 6, Windows host code; the Windows counterpart of the X11 key map (#2903) and macOS key map (#2917) ports. Tracking: #4.
Dependencies and existing tests
- No dependency to land first; no open PR touches
obs-windows.c.hor thewindows+unity group. - Real libobs: the hotkey tests do not reach these functions on Windows.
- No characterization:
test_windows_keys_stepslands first in the same PR. It builds the moved C file on its own (no Windows header: the VK values it needs are defined in its header and_Static_asserted againstwinuser.hinobs-windows.c.h), so it runs on every OS.
Notes
One PR, separate commits: the behaviour-neutral move into libobs/obs-windows-keys.c.h (hidden functions on plain values; the table stays in the platform context as today, read only where it was), characterization, RED, GREEN (group libobs.ported-windows-keys in the Windows ported sources), Tier 3 (every key from -1 to past OBS_KEY_LAST_VALUE, every VK 0 to 255, every modifier mask), docs.
Intentional difference, fixed in the port:
obs_key_to_virtual_keyon Windows returns 0 for a key outside0 .. OBS_KEY_LAST_VALUE - 1; C indexes the table with it, past its end. OBS's own callers pass keys in range; a script or plugin calling the exported function might not.obs_key_to_strand the pressed poll reach it with the same key.
Parity note (characterized, not changed): obs_key_from_virtual_key(VK_LWIN) gives OBS_KEY_VK_LWIN, while obs_key_to_virtual_key(OBS_KEY_META) gives VK_LWIN, so Meta does not round-trip.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 30, 2026
Claiming: #3076
Plan, one PR with separate commits:
libobs: Movethe virtual-key table, the first-match and Meta lookups, the pressed check's Meta rule, the key name route (with the scan code's extended bit) and the combination order intolibobs/obs-windows-keys.c.h: hidden functions on plain values, no Windows header (the VK values are defined in its header and_Static_asserted againstwinuser.hinobs-windows.c.h), behaviour-neutral (checked by building master's and the moved functions side by side on the same inputs).test_windows_keys_steps, building the moved file on its own, on every OS.obs_hotkey::windows_keysagainsttodo!()stubs.src/ffi/windows_keys.rs, grouplibobs.ported-windows-keysin the Windows ported sources, with the key range check inobs_key_to_virtual_key.I expect the draft PR today, within a few hours.
libobs: Move the Windows key map and key names
test: Characterize the Windows key map
obs-hotkey: Add Tier 1 tests for Windows keys
obs-hotkey: Port the Windows key map
obs-hotkey: Check the Windows key port against C
docs: Record the Windows key map port
libobs: Move the Windows key map and key names
test: Characterize the Windows key map
obs-hotkey: Add Tier 1 tests for Windows keys
obs-hotkey: Port the Windows key map
obs-hotkey: Check the Windows key port against C
docs: Record the Windows key map port
rdoupe commentedon Oct 30, 2026
Fixed by PR #3078 (merged through the merge queue): the Windows virtual-key table, the Meta rule, the key name route and the combination order now run from
rust/obs-hotkey(windows_keys), with the characterization, Tier 1, Tier 3 parity and mutation checks.Left:
test_windows_keys_steps_rustbuilds on Linux only; its macOS and Windows links are not worked out. That is the follow-up issue #3104. Nothing else of this unit is left.obs-hotkey: Port the Windows key map (obs-rust#3078)