]> git.tdb.fi Git - libs/gui.git/commitdiff
Generate synthetic key release events for repeated keys on Windows
authorMikko Rasa <tdb@tdb.fi>
Fri, 20 Sep 2019 22:26:38 +0000 (01:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 20 Sep 2019 22:26:38 +0000 (01:26 +0300)
The OS only sends WM_KEYDOWN messages as long as the key is pressed.

source/input/windows/keyboard.cpp

index d9810b18a8416b837054c38fe5617110f8fa6a01..690ba3a05e7b0e657f59d278dd3c3feee3ddd844 100644 (file)
@@ -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: