Repository navigation
libobs: Move the portal shortcut id codec into obs-nix-portal-shortcut-ids.c - #1518
Merged
zackees merged 3 commits intoOct 20, 2026
Merged
Conversation
…t-ids.c Behavior-neutral extraction before the Rust port: obs_nix_portal_shortcut_id, obs_nix_portal_shortcut_combo and obs_nix_portal_shortcut_trigger, with the modifier_names table and NUM_MODIFIERS, move verbatim from libobs/obs-nix-portal-shortcuts.c.h into libobs/obs-nix-portal-shortcut-ids.c.h. The binding collection also uses bindable(), so it moves verbatim into obs-nix-portal-shortcuts.h, still static inline, where both files see it. The declarations stay where they were. The codec gets its own unity group, libobs.nix-portal-shortcut-ids, built next to libobs.nix-portal-shortcuts under the same ENABLE_WAYLAND + GIO condition (CMake on Linux and FreeBSD, and obs-build). Its precompiled header has no <gio/gio.h>, so a C test and later the C oracle compile the codec on its own. NUM_MODIFIERS is now #undef'd at the end of the new file instead of the old one. test_portal_shortcuts compiles both files. New characterization test test_portal_shortcut_ids, with no GIO, D-Bus or libobs core: bindable() over every key, ids and triggers for plain keys and all 16 modifier sets, unbindable combinations (no key, mouse buttons, out of range) leaving the output untouched, the parser's rejects, a round trip of every bindable key, the key name callback (missing, empty, not called for unbindable combinations), and no leaked allocations. Characterized, not endorsed: modifier bits other than ctrl, alt, shift and super are dropped from ids and triggers, and the parser accepts modifiers in any order and repeated. Refs obs-rust#1517
zackees
enabled auto-merge
October 20, 2026 13:41
obs-internal.h includes caption/caption.h; add deps/libcaption to the test's include directories as the other obs-internal.h tests do.
Member
|
Coordinator fixup: Tier 2 failed with |
The previous fixup also moved the submodule pointer from 0c3b7000 to 1e313ae, which this PR does not intend. Put it back to master's commit. Refs obs-rust#1517
Collaborator
Author
Member
|
Thanks for catching that, my mistake: I committed with |
This was referenced Oct 20, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1517
What and why
Behavior-neutral extraction before the Rust port, as the testing policy asks for a partial-file port:
obs_nix_portal_shortcut_id,obs_nix_portal_shortcut_comboandobs_nix_portal_shortcut_trigger, with themodifier_namestable andNUM_MODIFIERS, move verbatim fromlibobs/obs-nix-portal-shortcuts.c.hintolibobs/obs-nix-portal-shortcut-ids.c.h. No Rust, no signature or behavior change, and no public header change.bindable(): the binding collection (collect_binding) uses it too, so it can't go into the codec file alone. It moves verbatim, stillstatic inline, intoobs-nix-portal-shortcuts.h(internal, not installed), where both files see it. The codec's declarations stay where they were.libobs.nix-portal-shortcut-ids, built next tolibobs.nix-portal-shortcutsunder the sameENABLE_WAYLAND+ GIO condition: CMake on Linux and FreeBSD, andobs-build's Linux libobs. Its precompiled headerlibobs-nix-portal-shortcut-ids.pch.hhas no<gio/gio.h>, so a C test (and later the C oracle) can compile the codec on its own. That is the only reason it isn't in the existing group.NUM_MODIFIERSis now#undef'd at the end of the new file instead of the old one (BUILD.md rule 5).test_portal_shortcutscompiles the C into itself, so it now compiles both files. The test source is unchanged.EXPORT, so they are not in the dynamic symbol table, before or after.New characterization test
test_portal_shortcut_ids(tests.d/fragment, Linux and FreeBSD, plus the Cargo C-test manifest). It needs no GIO, no D-Bus and no libobs core: with no core,obs_key_from_nameuses its table fallback. Before this, onlyshortcut_ids_round_tripinside the GIO portal test covered the codec. 15 cases:bindable()over every key:OBS_KEY_NONE, the 29 mouse buttons and out-of-range keys are not bindable, modifiers never matter, and the key right afterOBS_KEY_MOUSE29is bindable again;ctrl,alt,shift,super);OBS_KEY_names, unknown key names, anything after the key, and known but unbindable keys (OBS_KEY_NONE, mouse buttons). A failed parse leaves the output alone;CTRL,ALT,SHIFT,LOGO), the key name used as given, the callback called once with the key; no callback, no name, an empty or unset name return false and leave the output alone; the callback is not called for an unbindable combination; a name filled in before returning false is freed;bnum_allocs()is back where it started.Characterized, not endorsed:
load_modifierinobs-hotkey.c) and the frontend's key capture sets only those, so no user can reach this. I am not filing it as a bug;shift+ctrl+OBS_KEY_A,ctrl+ctrl+OBS_KEY_A). The ids it makes are canonical, so this only matters for ids from elsewhere.No defects found.
RED → GREEN
obs-nix-portal-shortcuts.c.hbefore =obs-nix-portal-shortcut-ids.c.hminus its license, include and trailing#undef, plusbindable()in the header. The test also passes against the v0.1.0-beta.20261018 release'slibobs.so.30, both the C one and theobs-studio-rust/one.ENABLE_RUST_LIBOBS=OFFandON, GIO on, full builds). Each runs the full ctest suite againstlibobsand againstlibobs-with-rust, headless (private Xvfb, private D-Bus):ENABLE_RUST_LIBOBS=OFF)ENABLE_RUST_LIBOBS=ON)Nothing was skipped.
test_portal_shortcuts(28/28,shortcut_ids_round_tripincluded),test_wayland_hotkeysandtest_wayland_multiseatpass in all four, unchanged.test_portal_shortcut_ids: 15/15 in all four, and 20 repeated runs in each mode.bindable()fail it (bounds of the mouse andNONEranges, an extra modifier in the table, unknown modifiers accepted, ids and triggers not reset, the trigger separator, an empty name accepted, the key name leaked). The survivor drops theOBS_KEY_prefix check, which is equivalent: every key name starts withOBS_KEY_, soobs_key_from_namereturnsOBS_KEY_NONEfor the same inputs../lint(ci/local_gate.py --lane lint): passed (45 s)Windows/macOS: not built there. The codec is Linux and FreeBSD only (Wayland with GIO).
Checklist
masterdocs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): not applicable