From 17423e9899f70682db4f4077afa0497a9d971b0d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 18 Jan 2025 15:31:00 +0000 Subject: [PATCH] [Windows] Fix left/right Shift key regression Fixes #101384 by checking the latest state of the Shift keys before sending the KEYUP event. --- platform/windows/display_server_windows.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index f35624d890a..fc352529645 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4684,7 +4684,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA // If multiple Shifts are held down at the same time, // Windows natively only sends a KEYUP for the last one to be released. if (raw->data.keyboard.Flags & RI_KEY_BREAK) { - if (!mods.has_flag(WinKeyModifierMask::SHIFT)) { + // Make sure to check the latest key state since + // we're in the middle of the message queue. + if (GetAsyncKeyState(VK_SHIFT) < 0) { // A Shift is released, but another Shift is still held ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);