diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-01-25 23:54:15 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-01-25 23:55:01 +0100 |
commit | 16f282e34af70dffd0d6f480291d3a939fadfb7b (patch) | |
tree | f033e5c0e561ecdf7fc48bee279ec9b8caf965fe | |
parent | 0907114710af7bf50629fffc3a0a823b62eac08e (diff) |
dinput: don't pass keypress on subsequent poll
-rw-r--r-- | dinput/keybinding-worker.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index 5acdc65a..02036352 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -218,6 +218,10 @@ bool KeybindingWorker::run_keyboard_nolock() const int idx = keyboard_states[k].dwOfs & 0xff; // defensive programming const bool held = !!(keyboard_states[k].dwData & 0x80); + if (held == keystate[idx]) + continue; + keystate[idx] = held; + switch (idx) { case DIK_LCONTROL: @@ -243,8 +247,6 @@ bool KeybindingWorker::run_keyboard_nolock() } break; } - - keystate[idx] = held; } return true; |