mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-02 09:33:33 +00:00
libobs: Fix issue 4408 (hotkey logic)
If obs_core_hotkeys.strict_modifiers is true (new default), hotkey is triggered only if current key modifiers exactly match the hotkey definition. If false, legacy behavior is selected.
This commit is contained in:
parent
1705edf8f9
commit
bb6787968c
|
@ -1194,9 +1194,10 @@ static inline bool modifiers_match(obs_hotkey_binding_t *binding,
|
|||
uint32_t modifiers_, bool strict_modifiers)
|
||||
{
|
||||
uint32_t modifiers = binding->key.modifiers;
|
||||
return !modifiers ||
|
||||
(!strict_modifiers && (modifiers & modifiers_) == modifiers) ||
|
||||
(strict_modifiers && modifiers == modifiers_);
|
||||
if (!strict_modifiers)
|
||||
return (modifiers & modifiers_) == modifiers;
|
||||
else
|
||||
return modifiers == modifiers_;
|
||||
}
|
||||
|
||||
static inline bool is_pressed(obs_key_t key)
|
||||
|
@ -1243,7 +1244,7 @@ static inline void handle_binding(obs_hotkey_binding_t *binding,
|
|||
modifiers_match(binding, modifiers, strict_modifiers);
|
||||
bool modifiers_only = binding->key.key == OBS_KEY_NONE;
|
||||
|
||||
if (!binding->key.modifiers)
|
||||
if (!strict_modifiers && !binding->key.modifiers)
|
||||
binding->modifiers_match = true;
|
||||
|
||||
if (modifiers_only)
|
||||
|
|
|
@ -990,6 +990,7 @@ static inline bool obs_init_hotkeys(void)
|
|||
NULL))
|
||||
goto fail;
|
||||
|
||||
hotkeys->strict_modifiers = true;
|
||||
hotkeys->hotkey_thread_initialized = true;
|
||||
|
||||
success = true;
|
||||
|
|
Loading…
Reference in a new issue