CHUI-692 FIXED Arrow keys will move avatar while IM container, nearby chat or IM session floater is in focus.

master
maxim@mnikolenko 2013-01-22 17:53:18 +02:00
parent 824457f98c
commit 9e6677ffc2
1 changed files with 5 additions and 13 deletions

View File

@ -2503,22 +2503,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
LLFloater* focused_floaterp = gFloaterView->getFocusedFloater();
std::string focusedFloaterName = (focused_floaterp ? focused_floaterp->getInstanceName() : "");
// Traverses up the hierarchy
if( keyboard_focus )
{
if (nearby_chat)
if ((focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel"))
{
LLChatEntry* chat_editor = nearby_chat->getChatBox();
// arrow keys move avatar while chatting hack
if (chat_editor && chat_editor->hasFocus())
{
// If text field is empty, there's no point in trying to move
// cursor with arrow keys, so allow movement
if (chat_editor->getText().empty()
|| gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
if (gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
{
// let Control-Up and Control-Down through for chat line history,
if (!(key == KEY_UP && mask == MASK_CONTROL)
@ -2540,7 +2532,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
break;
}
}
}
}
}
@ -2575,6 +2566,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
// Initialize nearby chat if it's missing
LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
if (!nearby_chat)
{
LLSD name("im_container");