Fix to LLWindow listener keyUp event. Fix to headless client scanKeyboard, allowing input from eventhost

master
Don Kjer 2011-03-09 03:31:48 +00:00
parent 127c45dfba
commit 58b393bb1e
3 changed files with 27 additions and 4 deletions

View File

@ -46,5 +46,28 @@ MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event)
{ return MASK_NONE; }
void LLKeyboardHeadless::scanKeyboard()
{ }
{
for (S32 key = 0; key < KEY_COUNT; key++)
{
// Generate callback if any event has occurred on this key this frame.
// Can't just test mKeyLevel, because this could be a slow frame and
// key might have gone down then up. JC
if (mKeyLevel[key] || mKeyDown[key] || mKeyUp[key])
{
mCurScanKey = key;
mCallbacks->handleScanKey(key, mKeyDown[key], mKeyUp[key], mKeyLevel[key]);
}
}
// Reset edges for next frame
for (S32 key = 0; key < KEY_COUNT; key++)
{
mKeyUp[key] = FALSE;
mKeyDown[key] = FALSE;
if (mKeyLevel[key])
{
mKeyLevelFrameCount[key]++;
}
}
}

View File

@ -100,7 +100,7 @@ void LLWindowListener::keyUp(LLSD const & evt)
}
// *TODO - figure out how to handle the mask
mKeyboard->handleTranslatedKeyDown(keycode, 0);
mKeyboard->handleTranslatedKeyUp(keycode, 0);
}
void LLWindowListener::mouseDown(LLSD const & evt)

View File

@ -1119,11 +1119,11 @@ bool LLAppViewer::mainLoop()
// Scan keyboard for movement keys. Command keys and typing
// are handled by windows callbacks. Don't do this until we're
// done initializing. JC
if (gViewerWindow->mWindow->getVisible()
if ((gHeadlessClient || gViewerWindow->mWindow->getVisible())
&& gViewerWindow->getActive()
&& !gViewerWindow->mWindow->getMinimized()
&& LLStartUp::getStartupState() == STATE_STARTED
&& !gViewerWindow->getShowProgress()
&& (gHeadlessClient || !gViewerWindow->getShowProgress())
&& !gFocusMgr.focusLocked())
{
LLMemType mjk(LLMemType::MTYPE_JOY_KEY);