Skip to content

Commit 76835d2

Browse files
committed
Merge pull request godotengine#104802 from Hilderin/fix-pressed-keys-resetted-when-hiding-window-on-windows
Fix pressed keys reset when hiding a window on Windows
2 parents ed62fb1 + f323337 commit 76835d2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

platform/windows/display_server_windows.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4773,9 +4773,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
47734773
// if the same nIDEvent is passed, the timer is replaced and the same timer_id is returned.
47744774
// The problem with the timer is that the window cannot be resized or the buttons cannot be used correctly
47754775
// if the window is not activated first. This happens because the code in the activation process runs
4776-
// after the mouse click is handled. To address this, the timer is now used only when the window is created.
4776+
// after the mouse click is handled. To address this, the timer is now used only during the window creation,
4777+
// and only as part of the activation process. We don't want 'Input::release_pressed_events()'
4778+
// to be called immediately in '_process_activate_event' when the window is not yet activated,
4779+
// as it would reset the currently pressed keys when hiding a window, which is incorrect behavior.
47774780
windows[window_id].activate_state = GET_WM_ACTIVATE_STATE(wParam, lParam);
4778-
if (windows[window_id].first_activation_done) {
4781+
if (windows[window_id].first_activation_done && (windows[window_id].activate_state == WA_ACTIVE || windows[window_id].activate_state == WA_CLICKACTIVE)) {
47794782
_process_activate_event(window_id);
47804783
} else {
47814784
windows[window_id].activate_timer_id = SetTimer(windows[window_id].hWnd, DisplayServerWindows::TIMER_ID_WINDOW_ACTIVATION, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);

0 commit comments

Comments
 (0)