From ce170ea187abe2b8017cde611d0e2e86a523ee79 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 21 Sep 2019 01:26:38 +0300 Subject: [PATCH] Generate synthetic key release events for repeated keys on Windows The OS only sends WM_KEYDOWN messages as long as the key is pressed. --- source/input/windows/keyboard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/input/windows/keyboard.cpp b/source/input/windows/keyboard.cpp index d9810b1..690ba3a 100644 --- a/source/input/windows/keyboard.cpp +++ b/source/input/windows/keyboard.cpp @@ -44,7 +44,9 @@ void Keyboard::input_event(const Graphics::Window::Event &event) else key = VK_LSHIFT; } - set_button_state(key_from_sys(key), (event.msg==WM_KEYDOWN || event.msg==WM_SYSKEYDOWN), true); + set_button_state(key_from_sys(key), false, true); + if(event.msg==WM_KEYDOWN || event.msg==WM_SYSKEYDOWN) + set_button_state(key_from_sys(key), true, true); } break; case WM_CHAR: -- 2.45.2