Repository navigation
Description
Scout D / rank 9: C-only prerequisite for the remaining Phase 6 hotkey event-injection entry point, later targeting obs-hotkey. Snapshot: master a62bfe717d5d9610a5136ca211273e66a1ae1f84 (2026-11-19 UTC).
Context and scope
Exported entry points: obs_hotkey_inject_event. Live C definitions: libobs/obs-hotkey.c.h:490-502; public declarations remain in the unchanged libobs headers.
Move only these public bodies verbatim to proposed libobs/obs-hotkey-inject-entry.c.h, within the existing libobs/build/libobs.core+.h.c PCH family. Preserve signatures, behavior, field-read/callback/lock order and all private dependency semantics. This prerequisite contains no Rust; a separate whole-file Rust-swap issue/PR follows after it lands.
Rust-side confirmation: Exact-name Rust hits are documentation/comments around obs-hotkey::press, binding_press and pair. rust/obs-hotkey/src/ffi/press.rs:171-189 exports obs_hotkey_binding_inject, one binding only; lines 1-24 explicitly leave the public event wrapper, registry walk and mutex in C. The merged state-machine PR also explicitly retained obs_hotkey_inject_event.
Characterization and build brief
Preserve no-core lock failure as a silent no-op. With a core, hold the hotkey mutex, construct one event containing the exact key/modifier bits, pressed argument and one captured strict_modifiers value, enumerate bindings in current array order via inject_hotkey, then unlock. The same captured strict flag applies throughout the dispatch; pass false events through rather than discarding them at the wrapper. Pin zero/multiple bindings, exact pointer/value forwarding and lock/read/enumerate/unlock ordering. Reuse the already Rust-backed per-binding state machine: repeated press, ordinary release behavior, strict modifiers, modifier-only and empty-binding oddities stay as characterized. Do not redesign binding enumeration or callback-driven mutation behavior.
Existing coverage to preserve: test/cmocka/test_hotkey_press_state.c:823-954 pins injection, strict/background behavior, modifier-only and empty-binding cases; test/cmocka/test_hotkey_load.c and test_hotkey_unregister.c contain callers. Reuse unchanged tests and add only a GPU/desktop-free wrapper recorder for no-core, argument capture and lock/order gaps.
Dependencies and sequencing: No functional prerequisite. Reuse obs_hotkey_seam_lock/unlock and obs_hotkey_seam_enum_bindings with scoped aliases as appropriate. Preserve the event struct/inject_hotkey dependency through an exact same-group declaration or minimal private seam; keep C-owned binding storage. The later swap ports public dispatch orchestration around the existing Rust per-binding engine, not another copy of that engine.
Acceptance criteria
- Reuse applicable existing C characterization unchanged. Add a new focused test only for missing coverage, proving baseline behavior against original C first. Record RED for the missing extraction seam/new focused contract before GREEN; when assertions already cover the entire contract, use an extraction/build contract instead of redundant behavioral tests.
- Land a separate behavior-neutral C-only extraction commit/PR before the Rust swap. No public-header/signature edits, no existing C-test edits, no WebSocket plugin modifications and no new workflow files. Scope unity-local aliases and undefine them at file end; keep sorted source membership and native metadata consistent.
- Run focused unchanged/new C tests against both libobs-c-reference and hybrid libobs; retain identical public symbol sets and validate affected native-build registrations. Run repository lint once. Preserve fixture host conditions and check Windows MSVC fixture linkage as applicable (no max_align_t or invalid enum sentinels). New threading fixtures use synchronization and the policy's 100-repeat determinism check, not sleeps.
- Later swap: Tier 1 mirrors every unchanged C assertion in safe Rust, with a committed failing stub before GREEN. Tier 2 retains the unchanged C tests, real-header size/alignment/all-field-offset checks for any exposed layout, and symbol parity. Tier 3 compares the thin ABI shim and safe core against the original extracted C oracle, with bounded edge/random cases and a demonstrated mutation failure. Respect existing documented oracle exclusions; introduce no behavior changes here.
- Add Rust cases only to the existing Core state category (
soldr cargo test -p obs-data --test obs-tests-core), with the existing owningobs-hotkeysuite modules, never another Rust test executable. Link every real private adapter into affected standalone Rust-static consumers; never use aborting link stubs. Reject NULL owner tokens before field accessors where the original contract permits NULL. Rust through soldr, Python through uv; publication through ./push. - Tier 4: run the existing black-box TriggerHotkeyByKeySequence cases in test/websocket-tier4/run_tier4.py against the unchanged C++ obs-websocket plugin loaded by both builds, preserving the existing request/result and injected-event behavior. Do not port or modify the plugin.
Append points / lane HI / core: libobs/build/libobs.core+.h.c, libobs/build/modules.d/core.json and applicable existing source inventories. Proposed new coverage only: test/cmocka/test_hotkey_inject_entry.c, its tests.d fragment and sorted test graph registration when needed. Later Rust append points: rust/obs-hotkey/src/lib.rs, src/ffi/mod.rs, existing category suite modules, per-unit export/source/oracle fragments and real-adapter link support. Every selected Scout D unit shares this physical core unity group: run at most one at a time and rebase between sibling landings.
Decisions
P2 / port / size:S / ready: one small deterministic extraction/characterization prerequisite, with no functional prerequisite on another unmerged conversion. The later Rust implementation and behavior fixes are separate work. Names above are proposed and may follow equivalent current conventions. All selected bodies live outside core-source, graphics and core-output unity groups; leave those busy groups and source/canvas/scene-item, graphics-backend and output/encoder instance implementations untouched. Refresh Ready/comments/open PRs before claiming. This issue is unclaimed; the scout posted no Claiming comment.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 19, 2026
Claiming: pool worker in obs-studio5 is adding the prerequisite characterization and behavior-neutral C extraction of obs_hotkey_inject_event only. I will preserve existing tests and headers, validate both library paths, and check shared unity/test-graph PR collisions before publication.
zackees commentedon Nov 19, 2026
Landed on master in #5193 (1bad013): the hotkey event-injection entry point is characterized and extracted. The Rust swap is #5192.