diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-06 20:13:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-12-06 20:13:42 +0100 |
commit | 75b4a6e3a32b4345941e15953d55572384eb210e (patch) | |
tree | 8867dfd025b1358eaf675749afa7f6319baa2679 /opentrack/win32-joystick.cpp | |
parent | dcd4df5e49e6207273c961069d14ce42ad83d147 (diff) |
api/joy: prevent idempotent keypressed passed to receiver
Diffstat (limited to 'opentrack/win32-joystick.cpp')
-rw-r--r-- | opentrack/win32-joystick.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/opentrack/win32-joystick.cpp b/opentrack/win32-joystick.cpp index f4bfba76..73e27f80 100644 --- a/opentrack/win32-joystick.cpp +++ b/opentrack/win32-joystick.cpp @@ -169,7 +169,7 @@ bool win32_joy_ctx::joy::poll(fn f) for (int i = 0; i < 128; i++) { - const bool state = !!(js.rgbButtons[i] & 0x80); + const bool state = !!(js.rgbButtons[i] & 0x80) && js.rgbButtons[i] != js_old.rgbButtons[i]; if (state != pressed[i]) { f(guid, i, state); @@ -178,6 +178,8 @@ bool win32_joy_ctx::joy::poll(fn f) pressed[i] = state; } + js_old = js; + return true; } |