Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libobs/build/libobs.core+.h.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "libobs/obs-hotkey-register-fields.c.h"
#include "libobs/obs-hotkey-routed-callback-fields.c.h"
#include "libobs/obs-hotkey-routing-controls-fields.c.h"
#include "libobs/obs-hotkey-unregister-entry.c.h"
#include "libobs/obs-hotkey-unregister-fields.c.h"
#include "libobs/obs-hotkey.c.h"
#include "libobs/obs-module-disable-query.c.h"
Expand Down
33 changes: 33 additions & 0 deletions libobs/obs-hotkey-unregister-entry.c.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "libobs/build/libobs.pch.h"

extern void obs_hotkey_unregister_one(obs_hotkey_id id);
void obs_hotkey_unregister_pair_call(obs_hotkey_pair_id id);

/* Reuse the registry lock and existing removers; keep the public bodies verbatim. */
#define lock obs_hotkey_seam_lock
#define unlock obs_hotkey_seam_unlock
#define unregister_hotkey obs_hotkey_unregister_one
#define unregister_hotkey_pair obs_hotkey_unregister_pair_call

void obs_hotkey_unregister(obs_hotkey_id id)
{
if (!lock())
return;

unregister_hotkey(id);
unlock();
}

void obs_hotkey_pair_unregister(obs_hotkey_pair_id id)
{
if (!lock())
return;

unregister_hotkey_pair(id);
unlock();
}

#undef lock
#undef unlock
#undef unregister_hotkey
#undef unregister_hotkey_pair
17 changes: 3 additions & 14 deletions libobs/obs-hotkey.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,22 +354,11 @@ static inline void unregister_hotkey_pair(obs_hotkey_pair_id id)
bfree(pair);
}

void obs_hotkey_unregister(obs_hotkey_id id)
/* Private call seam: retain pair teardown in this translation unit. */
void obs_hotkey_unregister_pair_call(obs_hotkey_pair_id id);
void obs_hotkey_unregister_pair_call(obs_hotkey_pair_id id)
{
if (!lock())
return;

unregister_hotkey(id);
unlock();
}

void obs_hotkey_pair_unregister(obs_hotkey_pair_id id)
{
if (!lock())
return;

unregister_hotkey_pair(id);
unlock();
}

static void context_release_hotkeys(struct obs_context_data *context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn canonical_hotkey_background_press_swap_is_registered() {
"test_hotkey_load",
"test_hotkey_pair_steps",
"test_hotkey_press_steps",
"test_hotkey_unregister_entry",
"test_portal_shortcuts",
"test_wayland_hotkeys",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fn canonical_hotkey_background_trigger_swap_is_registered() {
"test_hotkey_load",
"test_hotkey_pair_steps",
"test_hotkey_press_steps",
"test_hotkey_unregister_entry",
"test_portal_shortcuts",
"test_wayland_hotkeys",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -68,6 +69,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"test/cmocka/test_wayland_hotkeys.c"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -152,6 +153,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"test/cmocka/test_portal_shortcuts.c"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -59,6 +60,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -59,6 +60,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -59,6 +60,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -57,6 +58,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"test/cmocka/test_hotkey_binding_press_steps.c"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -55,6 +56,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -54,6 +55,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -57,6 +58,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -57,6 +58,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"schema": 1,
"targets": {
"test_hotkey_unregister_entry": {
"sources": [
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_unregister_entry.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
"libobs/obs-hotkey-enum.c.h",
"libobs/obs-hotkey-save-load.c.h",
"libobs/obs-hotkey-bindings.c.h",
"libobs/obs-hotkey-translations.c.h",
"libobs/obs-hotkey-press.c.h",
"libobs/obs-hotkey-pair.c.h",
"test/cmocka/hotkey-enum-link-support.c",
"test/cmocka/hotkey-background-trigger-link-support.c",
"test/cmocka/hotkey-background-press-link-support.c"
],
"definitions": [
"obs=hotkey_test_obs",
"obs_hotkeys_retry_background=obs_hotkey_background_control_retry_request",
"obs_hotkeys_configure_background=obs_hotkey_background_control_configure_request",
"obs_hotkeys_set_background_probe=obs_hotkey_background_control_probe_request",
"obs_hotkey_combination_get_background_trigger=obs_hotkey_background_trigger_request",
"obs_hotkey_enable_background_press=obs_hotkey_background_press_request",
"pthread_mutex_lock=unregister_entry_mutex_lock",
"pthread_mutex_unlock=unregister_entry_mutex_unlock",
"obs_hotkey_unregister_one=unregister_entry_remove_one"
],
"libraries": [
"OBS::libobs",
"OBS::caption",
"OBS::native-test-cmocka",
"libobs_rust-static"
],
"unity_groups": {
"background-control": [
"libobs/obs-hotkey-background-control-fields.c.h"
],
"hotkey_identity_setters": [
"libobs/obs-hotkey-identity-setters.c.h"
],
"hotkey_inject_entry": [
"libobs/obs-hotkey-inject-entry.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"libobs/obs-hotkey-binding-press.c.h"
],
"source_1": [
"test/cmocka/test_hotkey_unregister_entry.c"
],
"source_2": [
"libobs/obs-hotkey-background-query.c.h"
],
"source_5": [
"libobs/obs-hotkey-background-enum.c.h"
],
"source_6": [
"libobs/obs-hotkey-enum.c.h"
],
"source_7": [
"libobs/obs-hotkey-save-load.c.h"
],
"source_8": [
"libobs/obs-hotkey-bindings.c.h"
],
"source_9": [
"libobs/obs-hotkey-translations.c.h"
],
"source_10": [
"libobs/obs-hotkey-press.c.h"
],
"source_11": [
"libobs/obs-hotkey-pair.c.h"
],
"hotkey_enumeration_fields": [
"test/cmocka/hotkey-enum-link-support.c"
],
"hotkey_background_trigger": [
"test/cmocka/hotkey-background-trigger-link-support.c"
],
"hotkey_background_press": [
"test/cmocka/hotkey-background-press-link-support.c"
]
},
"pch": "libobs/build/libobs.pch.h"
}
},
"tests": {
"test_hotkey_unregister_entry": {
"target": "test_hotkey_unregister_entry",
"command": [
"${target}"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
"libobs/obs-hotkey.c.h",
"libobs/obs-hotkey-unregister-entry.c.h",
"libobs/obs-hotkey-inject-entry.c.h",
"libobs/obs-hotkey-identity-setters.c.h",
"libobs/obs-hotkey-background-enum.c.h",
Expand Down Expand Up @@ -79,6 +80,9 @@
"hotkey_unregister": [
"libobs/obs-hotkey-unregister.c.h"
],
"hotkey_unregister_entry": [
"libobs/obs-hotkey-unregister-entry.c.h"
],
"source_0": [
"test/cmocka/test_portal_shortcuts.c"
],
Expand Down
Loading
Loading