From 07378c93c5add98835e61786abac9502310f617b Mon Sep 17 00:00:00 2001 From: Kjersti Brynestad <36163186+kjersbry@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:29:51 +0100 Subject: [PATCH] Joystick: Enable button up signal for hat buttons (#10543) Releasing a hat button did not lead to _executeButtonAction being called with BUTTON_UP. This adds the hat buttons to lastBbuttonValues, such that the button-up transitions for hat buttons are recorded. --- src/Joystick/Joystick.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index 0aebecfcca7..767d2081812 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -520,6 +520,8 @@ void Joystick::_handleButtons() int rgButtonValueIndex = hatIndex*numHatButtons + hatButtonIndex + _buttonCount; // Get hat value from joystick bool newButtonValue = _getHat(hatIndex, hatButtonIndex); + if(rgButtonValueIndex < 256) + lastBbuttonValues[rgButtonValueIndex] = _rgButtonValues[rgButtonValueIndex]; if (newButtonValue && _rgButtonValues[rgButtonValueIndex] == BUTTON_UP) { _rgButtonValues[rgButtonValueIndex] = BUTTON_DOWN; emit rawButtonPressedChanged(rgButtonValueIndex, newButtonValue);