Browse Source

libobs: Don't use was_down for hotkey detection

From MSDN: "The behavior of the least significant bit of the return value
is retained strictly for compatibility with 16-bit Windows applications
(which are non-preemptive) and should not be relied upon."

This caused problems with hotkeys firing if the user pressed a hotkey key
in another application, followed by the modifier keys at any other time.
OBS would then think the hotkey key was just pressed based on the was_down
behavior and incorrectly trigger a hotkey event.

Fixes 0000443.
Richard Stanway 9 năm trước cách đây
mục cha
commit
1f39b6a612
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      libobs/obs-windows.c

+ 2 - 2
libobs/obs-windows.c

@@ -384,8 +384,8 @@ static bool vk_down(DWORD vk)
 {
 	short state = GetAsyncKeyState(vk);
 	bool down = (state & 0x8000) != 0;
-	bool was_down = (state & 0x1) != 0;
-	return down || was_down;
+
+	return down;
 }
 
 bool obs_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *context,