diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-06 20:14:09 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-06 20:14:09 +0100 |
commit | d6eb142710e6ac307b4c5c0e0a54166852d71cbc (patch) | |
tree | 8f5d2a1d2fd9b5e7cf8c9724329a361834b81379 | |
parent | 4864dfaa4b455905fece5cd93502b80890d1b2d2 (diff) |
api/keys: prevent idempotent keysopentrack-2.3-rc21p4
-rw-r--r-- | opentrack/keybinding-worker.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/opentrack/keybinding-worker.cpp b/opentrack/keybinding-worker.cpp index 2ac814af..b0cef22d 100644 --- a/opentrack/keybinding-worker.cpp +++ b/opentrack/keybinding-worker.cpp @@ -85,6 +85,7 @@ KeybindingWorker& KeybindingWorker::make() void KeybindingWorker::run() { BYTE keystate[256] = {0}; + BYTE old_keystate[256] = {0}; while (!should_quit) { @@ -125,7 +126,7 @@ void KeybindingWorker::run() { for (int i = 0; i < 256; i++) { Key k; - if (keystate[i] & 0x80) + if (old_keystate[i] != keystate[i] && keystate[i] & 0x80) { switch (i) { @@ -147,6 +148,7 @@ void KeybindingWorker::run() { break; } } + old_keystate[i] = keystate[i]; } } } |