From dcabfa39d91e2ed608ae9dce579de07340f9910d Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 20 Aug 2024 15:02:54 +0200 Subject: [PATCH] Windows: send key release events when losing focus, or the client app may never see them --- Backends/System/Windows/Sources/kinc/backend/system.c.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Backends/System/Windows/Sources/kinc/backend/system.c.h b/Backends/System/Windows/Sources/kinc/backend/system.c.h index 38cac60b2..59f4e0649 100644 --- a/Backends/System/Windows/Sources/kinc/backend/system.c.h +++ b/Backends/System/Windows/Sources/kinc/backend/system.c.h @@ -475,6 +475,13 @@ LRESULT WINAPI KoreWindowsMessageProcedure(HWND hWnd, UINT msg, WPARAM wParam, L else { kinc_internal_mouse_window_deactivated(kinc_windows_window_index_from_hwnd(hWnd)); kinc_internal_background_callback(); + // Release all keys because the client app will not see the actual key release events + for (int i = 0; i < MAX_KEYS; ++i) { + if (keyPressed[i]) { + onKeyUp(hWnd, i); + } + } + controlDown = false; #ifdef HANDLE_ALT_ENTER altDown = false; #endif