diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-31 21:05:40 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-31 21:05:40 +0100 |
commit | 1b78a8ffeb9c320747422ba10bf7c26018cae580 (patch) | |
tree | ebd33a7b522bda2719aecf11f7578f14beebfe0b /dinput | |
parent | d971b9d699f7862b4c9414abfdb64445f4be9018 (diff) |
dinput: fix modifiers not registering
Found-by: @Len62
cf. https://github.com/opentrack/opentrack/issues/688#issuecomment-34063145
Diffstat (limited to 'dinput')
-rw-r--r-- | dinput/keybinding-worker.cpp | 12 | ||||
-rw-r--r-- | dinput/keybinding-worker.hpp | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index 468ef477..fec28a03 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -158,9 +158,9 @@ void KeybindingWorker::run() default: { Key k; - k.shift = !!((keystate[DIK_LSHIFT] & 0x80) | (keystate[DIK_RSHIFT] & 0x80)); - k.alt = !!((keystate[DIK_LALT] & 0x80) | (keystate[DIK_RALT] & 0x80)); - k.ctrl = !!((keystate[DIK_LCONTROL] & 0x80) | (keystate[DIK_RCONTROL] & 0x80)); + k.shift = !!(keystate[DIK_LSHIFT] | keystate[DIK_RSHIFT]); + k.alt = !!(keystate[DIK_LALT] | keystate[DIK_RALT]); + k.ctrl = !!(keystate[DIK_LCONTROL] | keystate[DIK_RCONTROL]); k.keycode = idx; k.held = held; @@ -180,9 +180,9 @@ void KeybindingWorker::run() joy_fn f = [&](const QString& guid, int idx, bool held) { Key k; k.keycode = idx; - k.shift = !!(keystate[DIK_LSHIFT] & 0x80 || keystate[DIK_RSHIFT] & 0x80); - k.alt = !!(keystate[DIK_LALT] & 0x80 || keystate[DIK_RALT] & 0x80); - k.ctrl = !!(keystate[DIK_LCONTROL] & 0x80 || keystate[DIK_RCONTROL] & 0x80); + k.shift = !!(keystate[DIK_LSHIFT] | keystate[DIK_RSHIFT]); + k.alt = !!(keystate[DIK_LALT] | keystate[DIK_RALT]); + k.ctrl = !!(keystate[DIK_LCONTROL] | keystate[DIK_RCONTROL]); k.guid = guid; k.held = held; diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp index f7314482..407b0107 100644 --- a/dinput/keybinding-worker.hpp +++ b/dinput/keybinding-worker.hpp @@ -49,8 +49,8 @@ private: QMainWindow fake_main_window; dinput_handle::di_t din; - unsigned char keystate[256] {}; - unsigned char old_keystate[256] {}; + bool keystate[256] {}; + bool old_keystate[256] {}; void run() override; bool init(); |