fixed unwanted button up events in UI navigation

This commit is contained in:
Thomas Jentzsch 2022-10-01 21:21:20 +02:00
parent 65115cc3a1
commit cff0821f33
2 changed files with 6 additions and 4 deletions

View File

@ -67,7 +67,7 @@ void DialogContainer::updateTime(uInt64 time)
// Joystick has been pressed long
if(myCurrentButtonDown.stick != -1 && myButtonLongPressTime < myTime)
{
myButtonLongPress = true;
myIgnoreButtonUp = true;
activeDialog->handleJoyDown(myCurrentButtonDown.stick, myCurrentButtonDown.button, true);
myButtonLongPressTime = myButtonRepeatTime = myTime + _REPEAT_NONE;
}
@ -348,8 +348,8 @@ void DialogContainer::handleJoyBtnEvent(int stick, int button, bool pressed)
myCurrentButtonDown.stick = myCurrentButtonDown.button = -1;
myButtonRepeatTime = myButtonLongPressTime = 0;
}
if (myButtonLongPress)
myButtonLongPress = false;
if(myIgnoreButtonUp)
myIgnoreButtonUp = false;
else
activeDialog->handleJoyUp(stick, button);
}
@ -383,6 +383,8 @@ void DialogContainer::handleJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, i
myCurrentAxisDown.adir = adir;
myAxisRepeatTime = myTime + (activeDialog->repeatEnabled() ? _REPEAT_INITIAL_DELAY : _REPEAT_NONE);
}
if(adir != JoyDir::NONE)
myIgnoreButtonUp = true; // prevent button released events
activeDialog->handleJoyAxis(stick, axis, adir, button);
}

View File

@ -214,7 +214,7 @@ class DialogContainer
} myCurrentButtonDown;
uInt64 myButtonRepeatTime{0};
uInt64 myButtonLongPressTime{0};
bool myButtonLongPress{false};
bool myIgnoreButtonUp{false};
// For continuous 'joy axis down' events
struct {