Skip to content

obs-hotkey: swap injected-event dispatch to Rust (Refs #5192) - #5206

Merged
zackees merged 5 commits into
masterfrom
port/5192-hotkey-inject-entry
Nov 19, 2026
Merged

zackees merged 5 commits into
masterfrom
port/5192-hotkey-inject-entry

Conversation

@zackees

@zackees zackees commented Nov 19, 2026

Copy link
Copy Markdown
Member

Injected key events now enter the safe obs-hotkey core through the preserved public C ABI. The wrapper acquires the existing recursive hotkey lock, captures strict modifiers once, forwards the exact combination and pressed value through the existing C-owned binding walk, then unlocks. False events continue to reach the existing per-binding engine.

The owner-relative strict-field adapter has no global or runtime-symbol dependencies. Rust checks a missing owner before reading it and reuses the established pointer-returning seam lock. The extracted original C remains the reference/oracle. The unchanged #5193 recorder links to the Rust static entry and real adapters; current whole-hotkey registrations and independent inventories use the replacement. The rebase onto #5197 preserves its unregistration extraction and includes its new fixture.

RED 481bd1f committed three safe recorder mirrors against stubs; all three failed at the expected todo panic. GREEN cf223ab implements the swap, real-header combination size/alignment/all-field-offset checks, and original-C differential coverage of ABI dispatch and safe-core state, including live strict-setting changes and binding-header mutation. Inverting the captured pressed value made the differential fail; the original core was restored.

Final validation passed: complete client Clippy/Dylint on all six targets, repository checks, 9,135 host tests (six additional skips), workspace doctests, 920 tests with default features disabled, and GNU Windows test links. This includes all 315 native_build tests. The one ./lint invocation caught a noncanonical CMake guard; it was fixed, its focused check passed, and the final complete client lint/check lanes passed.

Linux built all 63 configured cmocka Rust targets. All 12 focused fixtures passed against both libraries; the recorder passed three repeats per mode. Both libraries expose the same 1,769 symbols. The unchanged public-library press-state (18 cases) and unregister (two cases) tests passed in both modes, with loader paths verified. Refreshed Windows MSVC and Darwin arm64 checks each linked hybrid libobs, all 54 configured cmocka Rust fixtures, and the unchanged injection recorder.

Test cost: 25 reduced-parity debug runs of the five new tests; longest 0.03 seconds, peak RSS 22,164 KiB, no own threads. One read-only reviewer found no issues.

Tier 4 TriggerHotkeyByKeySequence against both current library builds remains unverified locally because this slot has no matching built application/plugin pair. Native macOS and Windows runtime validation remains with the selected hosted tiers.

Refs #5192

…t check

Ci-Attestation: {"at":1795070465,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":326,"stamp":"be0fbea134e27fdd7f78c630b4cc2023","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070465,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":326,"stamp":"cd3a9c0c80b94fa8a151a505bc053c68","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070465,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":326,"stamp":"006ddfade016e7f67696107deafbfba1","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070465,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":326,"stamp":"c1f3f3972475780846f328fc3ead3ed7","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070137,"gate":"general/all/client-lint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"d01734917a4f3323f342ad2d53063edc","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070465,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":326,"stamp":"5334f2517a5ba7c842424fccdba289eb","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"8f0a4c70477ed85398fa1a403235e212","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"25079745ba21ebff0c40a6a54eaa0d78","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"74831e1fd41f5aa875a5f95c64389ce0","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"404f5aed3ae4b7917db35af0f4e8a513","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"5963f53db0c0ff9c8f241620ecd55773","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"e47c69ffcd2b562a847bf2775af33737","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"87ef933f7ea830ae5ca9f56570e7831e","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"5def4ed023e9bcf85a7028877123d67b","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"e627a9aaeba8aa6748da4b51487ea197","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070138,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"8c608a8f39468b5f9c0af7e6a78c5cf8","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070137,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"5bb57a3927102a08e515d5887bfe0823","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795070137,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"09f634091529be2f7d2ca87ca7b7bc89c426a3ce707aff26839a7fb678cd486b","lane":"client-lint","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":494,"stamp":"ab9b7f7f7f292979b8b4340e5451c502","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}
Ci-Attestation: {"at":1795071321,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"4109d729d914799f353ea5233cc29129405872672af5db16e4d6592bbf228f52","lane":"client-test-x86_64-unknown-linux-gnu","parents":["4cba0ad332efdc9c4044e8672de14f6f301e0600"],"secs":855,"stamp":"dd07a830a0df54590ba07562cc83d244","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"ade80e1f3a65df57526ecf23bfd5b0ab51709f0b","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-hotkey-inject-entry+.h.c","libobs/build/ported-source-sets/hotkey-inject-entry.json","libobs/cmake/rust-exports.d/obs-hotkey-inject_entry.txt","libobs/cmake/rust-hidden.d/obs-hotkey-inject_entry.txt","libobs/obs-hotkey-inject-entry-fields.c.h","rust/README.md","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_inject_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_unregister_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-c-oracle/oracle/hotkey_inject_entry.c","rust/obs-c-oracle/oracle/hotkey_inject_entry_fields.c","rust/obs-hotkey/src/ffi/inject_entry.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/inject_entry.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/tests/hotkey/inject_entry.rs","rust/obs-hotkey/tests/hotkey/inject_entry_parity.rs","rust/obs-hotkey/tests/hotkey/main.rs","test/cmocka/build/test-graph.json","test/cmocka/hotkey-inject-entry-link-support.c","test/cmocka/tests.d/hotkey_inject_entry_link_support.cmake"],"head":"9330863918d599365dd0fe525bde146c8efc863d","tools":{"orchestrator-python":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.1.3 ]","schema-dependencies":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"0570c85aba91a644c9f9be9e7176243a7283931a32e316c016802b71a4096dce","tree":"4895a221ecec8a2e9727e79b49f5d1e669a4c377"}}
@zackees zackees added the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees enabled auto-merge November 19, 2026 07:14
@zackees zackees removed the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 9d7600e Nov 19, 2026
41 checks passed
@zackees
zackees deleted the port/5192-hotkey-inject-entry branch November 19, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant