Jelajahi Sumber

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).
PatTheMav 3 tahun lalu
induk
melakukan
fa50f64c3c
1 mengubah file dengan 8 tambahan dan 2 penghapusan
  1. 8 2
      libobs/obs-hotkey.c

+ 8 - 2
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;