Fix bug #306 that prevented ALT key from working correctly on Windows.

This commit is contained in:
Federico Terzi 2020-06-02 21:37:53 +02:00
parent 90f6908a81
commit 24641b6cad

View File

@ -210,16 +210,18 @@ LRESULT CALLBACK window_procedure(HWND window, unsigned int msg, WPARAM wp, LPAR
// Convert the input data
RAWINPUT* raw = reinterpret_cast<RAWINPUT*>(lpb.data());
// Make sure it's a keyboard type event, relative to a key press.
if (raw->header.dwType == RIM_TYPEKEYBOARD)
{
// We only want KEY UP AND KEY DOWN events
if (raw->data.keyboard.Message != WM_KEYDOWN && raw->data.keyboard.Message != WM_KEYUP) {
if (raw->data.keyboard.Message != WM_KEYDOWN && raw->data.keyboard.Message != WM_KEYUP &&
raw->data.keyboard.Message != WM_SYSKEYDOWN) {
return 0;
}
int is_key_down = raw->data.keyboard.Message == WM_KEYDOWN;
// The alt key sends a SYSKEYDOWN instead of KEYDOWN event
int is_key_down = raw->data.keyboard.Message == WM_KEYDOWN ||
raw->data.keyboard.Message == WM_SYSKEYDOWN;
DWORD currentTick = GetTickCount();