SL-20442 Add an 'Until shortcut key released' option to gestures so we can do properly user-mappable keys

master
Alexander Gavriliuk 2023-11-23 22:04:49 +01:00 committed by Guru
parent 9bf5ad98e5
commit 110eb2c989
3 changed files with 20 additions and 31 deletions

View File

@ -42,16 +42,6 @@ const S32 GESTURE_VERSION = 2;
// LLMultiGesture
//---------------------------------------------------------------------------
LLMultiGesture::LLMultiGesture()
: mKey(),
mMask(),
mName(),
mTrigger(),
mReplaceText(),
mSteps(),
mPlaying(FALSE),
mCurrentStep(0),
mDoneCallback(NULL),
mCallbackData(NULL)
{
reset();
}
@ -67,10 +57,11 @@ void LLMultiGesture::reset()
mPlaying = FALSE;
mCurrentStep = 0;
mWaitTimer.reset();
mWaitingAnimations = FALSE;
mWaitingKeyRelease = FALSE;
mWaitingTimer = FALSE;
mTriggeredByKey = FALSE;
mKeyReleased = FALSE;
mWaitingAnimations = FALSE;
mWaitingAtEnd = FALSE;
mRequestedAnimIDs.clear();
mPlayingAnimIDs.clear();

View File

@ -59,11 +59,11 @@ protected:
const LLMultiGesture& operator=(const LLMultiGesture& rhs);
public:
KEY mKey;
MASK mMask;
KEY mKey { 0 };
MASK mMask { 0 };
// This name can be empty if the inventory item is not around and
// the gesture manager has not yet set the name
// the gesture manager has not yet set the name
std::string mName;
// String, like "/foo" or "hello" that makes it play
@ -75,34 +75,34 @@ public:
std::vector<LLGestureStep*> mSteps;
// Is the gesture currently playing?
BOOL mPlaying;
BOOL mPlaying { FALSE };
// "instruction pointer" for steps
S32 mCurrentStep;
S32 mCurrentStep { 0 };
// We're waiting for triggered animations to stop playing
BOOL mWaitingAnimations;
BOOL mWaitingAnimations { FALSE };
// We're waiting for key release
BOOL mWaitingKeyRelease;
BOOL mWaitingKeyRelease { FALSE };
// We're waiting a fixed amount of time
BOOL mWaitingTimer;
BOOL mWaitingTimer { FALSE };
// We're waiting for triggered animations to stop playing
BOOL mTriggeredByKey;
BOOL mTriggeredByKey { FALSE };
// Has the key been released?
BOOL mKeyReleased;
BOOL mKeyReleased { FALSE };
// Waiting after the last step played for all animations to complete
BOOL mWaitingAtEnd;
BOOL mWaitingAtEnd { FALSE };
// Timer for waiting
LLFrameTimer mWaitTimer;
void (*mDoneCallback)(LLMultiGesture* gesture, void* data);
void* mCallbackData;
void (*mDoneCallback)(LLMultiGesture* gesture, void* data) { NULL };
void* mCallbackData { NULL };
// Animations that we requested to start
std::set<LLUUID> mRequestedAnimIDs;

View File

@ -944,7 +944,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
{
LL_INFOS("GestureMgr") << "Waited too long for key release, continuing gesture."
<< LL_ENDL;
gesture->mWaitingAnimations = FALSE;
gesture->mWaitingKeyRelease = FALSE;
gesture->mCurrentStep++;
}
else
@ -1072,14 +1072,13 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
{
LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
if (gesture->mTriggeredByKey // Only wait here IF we were triggered by a key!
&& gesture->mKeyReleased == FALSE // We can only do this once! Prevent gestures infinitely running
&& gesture->mWaitingKeyRelease == FALSE // We can only do this once! Prevent gestures infinitely running
&& wait_step->mFlags & WAIT_FLAG_KEY_RELEASE)
{
// Lets wait for the key release first so we don't hold up re-presses
gesture->mWaitingKeyRelease = TRUE;
// Use the wait timer as a deadlock breaker for key release
// waits.
gesture->mKeyReleased = FALSE;
// Use the wait timer as a deadlock breaker for key release waits.
gesture->mWaitTimer.reset();
}
else if (wait_step->mFlags & WAIT_FLAG_TIME)
@ -1090,8 +1089,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
{
gesture->mWaitingAnimations = TRUE;
// Use the wait timer as a deadlock breaker for animation
// waits.
// Use the wait timer as a deadlock breaker for animation waits.
gesture->mWaitTimer.reset();
}
else