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 ci/test_hotkey_register_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_isolated_cores_compile_registration_in_the_same_translation_unit(self):
groups = list(target.get("unity_groups", {}).values())
self.assertIn(
[
"libobs/obs-hotkey-key-translation.c.h",
EXTRACTED,
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
1 change: 1 addition & 0 deletions libobs/build/libobs.core+.h.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "libobs/obs-hotkey-identity-fields.c.h"
#include "libobs/obs-hotkey-identity-setter-fields.c.h"
#include "libobs/obs-hotkey-inject-entry-fields.c.h"
#include "libobs/obs-hotkey-key-translation.c.h"
#include "libobs/obs-hotkey-object-fields.c.h"
#include "libobs/obs-hotkey-owned-translations-fields.c.h"
#include "libobs/obs-hotkey-pair-meta-setter-calls.c.h"
Expand Down
22 changes: 22 additions & 0 deletions libobs/obs-hotkey-key-translation.c.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "libobs/build/libobs.pch.h"

/* The key name store (obs->hotkeys.translations[]): obs_hotkeys_set_translations_s()
* in obs-hotkey-translations.c.h calls it for each name it sets. Declared in
* obs-internal.h; not exported. */
void obs_hotkeys_store_key_translation(obs_key_t key, const char *translation)
{
bfree(obs->hotkeys.translations[key]);
obs->hotkeys.translations[key] = NULL;

if (translation)
obs->hotkeys.translations[key] = bstrdup(translation);
}

const char *obs_get_hotkey_translation(obs_key_t key, const char *def)
{
if (key == OBS_KEY_NONE) {
return NULL;
}

return obs->hotkeys.translations[key] ? obs->hotkeys.translations[key] : def;
}
21 changes: 0 additions & 21 deletions libobs/obs-hotkey.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,27 +538,6 @@ void *obs_hotkey_thread(void *arg)
return NULL;
}

/* The key name store (obs->hotkeys.translations[]): obs_hotkeys_set_translations_s()
* in obs-hotkey-translations.c.h calls it for each name it sets. Declared in
* obs-internal.h; not exported. */
void obs_hotkeys_store_key_translation(obs_key_t key, const char *translation)
{
bfree(obs->hotkeys.translations[key]);
obs->hotkeys.translations[key] = NULL;

if (translation)
obs->hotkeys.translations[key] = bstrdup(translation);
}

const char *obs_get_hotkey_translation(obs_key_t key, const char *def)
{
if (key == OBS_KEY_NONE) {
return NULL;
}

return obs->hotkeys.translations[key] ? obs->hotkeys.translations[key] : def;
}

/* This file hashes integer keys (HASH_FUNCTION above); restore util/uthash.h's
* default for the sources a unity build compiles after it. */
#undef HASH_FUNCTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test/cmocka/test_wayland_hotkeys.c",
"libobs/obs-hotkey-binding-press.c.h",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -75,6 +76,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"test/cmocka/hotkey-background-error-link-support.c",
"libobs/obs-hotkey-background-error.c.h",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -159,6 +160,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_background_enum.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -60,6 +61,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_background_press.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -60,6 +61,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_background_trigger.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -60,6 +61,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test/cmocka/test_hotkey_binding_press_steps.c",
"libobs/obs-hotkey-binding-press.c.h",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -58,6 +59,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_getters_characterization.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -56,6 +57,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_load.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -55,6 +56,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_pair_steps.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -58,6 +59,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_press_steps.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -58,6 +59,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"libobs/obs-hotkey-binding-press.c.h",
"test/cmocka/test_hotkey_unregister_entry.c",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-background-state.c.h",
Expand Down Expand Up @@ -57,6 +58,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test/cmocka/hotkey-background-error-link-support.c",
"libobs/obs-hotkey-background-error.c.h",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -80,6 +81,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test/cmocka/test_wayland_hotkeys.c",
"libobs/obs-hotkey-binding-press.c.h",
"libobs/obs-hotkey-background-query.c.h",
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-control-fields.c.h",
"libobs/obs-hotkey-unregister.c.h",
Expand Down Expand Up @@ -69,6 +70,7 @@
"libobs/obs-hotkey-inject-entry-fields.c.h"
],
"hotkey_registration": [
"libobs/obs-hotkey-key-translation.c.h",
"libobs/obs-hotkey-register.c.h",
"libobs/obs-hotkey-background-state.c.h",
"libobs/obs-hotkey-combination-background-id.c.h",
Expand Down
Loading
Loading