Fix chat focus issues once and for all

This commit is contained in:
Melanie
2013-04-13 04:58:30 +02:00
parent fc4fcc9450
commit 273f57d5a2
5 changed files with 43 additions and 2 deletions

View File

@@ -112,7 +112,7 @@ public:
BOOL focusNextItem(BOOL text_entry_only);
BOOL focusPrevItem(BOOL text_entry_only);
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
virtual BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
// Non Virtuals

View File

@@ -187,7 +187,10 @@ void LLFloaterChat::handleVisibilityChange(BOOL new_visibility)
// virtual
void LLFloaterChat::onFocusReceived()
{
gFocusMgr.setKeyboardFocus(getChildView("Chat Editor")); // Work around the chat bar no longer focusing from within the layout_stack
LLView* chat_editor = getChildView("Chat Editor");
if (childIsVisible("Chat Editor"))
gFocusMgr.setKeyboardFocus(chat_editor);
LLFloater::onFocusReceived();
}
@@ -740,3 +743,16 @@ void LLFloaterChat::hide(LLFloater* instance, const LLSD& key)
VisibilityPolicy<LLFloater>::hide(instance, key);
}
}
BOOL LLFloaterChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash )
{
LLView* chat_editor = getChildView("Chat Editor");
if (childIsVisible("Chat Editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
return TRUE;
}
return LLUICtrl::focusFirstItem(prefer_text_fields, focus_flash);
}

View File

@@ -98,6 +98,8 @@ public:
LLPanelActiveSpeakers* mPanel;
BOOL mScrolledToEnd;
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
CachedUICtrl<LLButton> mToggleActiveSpeakersBtn;
CachedUICtrl<LLChatBar> mChatPanel;
};

View File

@@ -2606,3 +2606,23 @@ const bool LLFloaterIMPanel::isModerator(const LLUUID& speaker_id)
return FALSE;
}
BOOL LLFloaterIMPanel::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash )
{
LLView* chat_editor = getChildView("chat_editor");
if (childIsVisible("chat_editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
return TRUE;
}
return LLUICtrl::focusFirstItem(prefer_text_fields, focus_flash);
}
void LLFloaterIMPanel::onFocusReceived()
{
LLView* chat_editor = getChildView("chat_editor");
if (childIsVisible("chat_editor"))
gFocusMgr.setKeyboardFocus(chat_editor);
LLFloater::onFocusReceived();
}

View File

@@ -231,6 +231,9 @@ public:
void *cargo_data, EAcceptance *accept,
std::string& tooltip_msg);
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
void onFocusReceived();
void onInputEditorFocusReceived();
void onInputEditorFocusLost();
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);