Skip to content

Commit

Permalink
Joystick: Enable button up signal for hat buttons (#10543)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kjersbry committed Mar 13, 2023
1 parent a3fa4dd commit 07378c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Joystick/Joystick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07378c9

Please sign in to comment.