From 825c0c7691c267d932971c50de681f660e728dc2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 24 Apr 2025 13:58:17 -0700
Subject: [PATCH] Reset the keyboard when entering a modal loop on Windows
Fixes https://github.com/libsdl-org/SDL/issues/12876
(cherry picked from commit da3c864d4c7c56d176bbf938345c2a5f784a7cd2)
---
src/video/windows/SDL_windowsevents.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 8a07ac117a591..592603eea2621 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -1854,6 +1854,9 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
data->initial_size_rect.bottom = data->window->y + data->window->h;
SetTimer(hwnd, (UINT_PTR)SDL_IterateMainCallbacks, USER_TIMER_MINIMUM, NULL);
+
+ // Reset the keyboard, as we won't get any key up events during the modal loop
+ SDL_ResetKeyboard();
}
} break;