From 16f282e34af70dffd0d6f480291d3a939fadfb7b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 25 Jan 2022 23:54:15 +0100 Subject: dinput: don't pass keypress on subsequent poll --- dinput/keybinding-worker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dinput') 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; -- cgit v1.2.3