SL-16845 PTT Mic doesn't close when leaving window and releasing key

master
Andrey Kleshchev 2022-03-14 16:30:16 +02:00
parent 10e9e3ca1b
commit bd3ef8a0ed
3 changed files with 21 additions and 2 deletions

View File

@ -148,6 +148,22 @@ void LLKeyboard::addKeyName(KEY key, const std::string& name)
sNamesToKeys[nameuc] = key;
}
void LLKeyboard::resetKeyDownAndHandle()
{
MASK mask = currentMask(FALSE);
for (S32 i = 0; i < KEY_COUNT; i++)
{
if (mKeyLevel[i])
{
mKeyDown[i] = FALSE;
mKeyLevel[i] = FALSE;
mKeyUp[i] = TRUE;
mCurTranslatedKey = (KEY)i;
mCallbacks->handleTranslatedKeyUp(i, mask);
}
}
}
// BUG this has to be called when an OS dialog is shown, otherwise modifier key state
// is wrong because the keyup event is never received by the main window. JC
void LLKeyboard::resetKeys()

View File

@ -58,7 +58,8 @@ public:
LLKeyboard();
virtual ~LLKeyboard();
void resetKeys();
void resetKeyDownAndHandle();
void resetKeys();
F32 getCurKeyElapsedTime() { return getKeyDown(mCurScanKey) ? getKeyElapsedTime( mCurScanKey ) : 0.f; }

View File

@ -1573,9 +1573,11 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
showCursor();
getWindow()->setMouseClipping(FALSE);
// If losing focus while keys are down, reset them.
// If losing focus while keys are down, handle them as
// an 'up' to correctly release states, then reset states
if (gKeyboard)
{
gKeyboard->resetKeyDownAndHandle();
gKeyboard->resetKeys();
}