From ab62c9c615bb08bdeddafce32341738959098586 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sat, 23 Jul 2022 17:17:30 +0200 Subject: [PATCH] libobs: Trigger bindings injected by Qt directly Instead of lettings the hotkey thread handle bindings triggered by Qt, call the callback directly. By this point, Qt has resolved the modifier state (so no need for the hotkey thread to do the same), the pressed state is set as well, the branch takes care of matching the pressed keys. This also fixes the issue with the hotkey changes introduced by #3914, which only inject key events when OBS is _not_ in focus (and as such modifier states are never updated). --- libobs/obs-hotkey.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libobs/obs-hotkey.c b/libobs/obs-hotkey.c index e3d374769..0ad318436 100644 --- a/libobs/obs-hotkey.c +++ b/libobs/obs-hotkey.c @@ -1289,8 +1289,14 @@ static inline bool inject_hotkey(void *data, size_t idx, event->strict_modifiers)) { bool pressed = binding->key.key == event->hotkey.key && event->pressed; - handle_binding(binding, event->hotkey.modifiers, false, - event->strict_modifiers, &pressed); + if (binding->key.key == OBS_KEY_NONE) + pressed = true; + + if (pressed) { + binding->modifiers_match = true; + if (!binding->pressed) + press_released_binding(binding); + } } return true;