From deae6d3a89652f472d74de4dc0e1c88519197f9a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 13 Feb 2012 20:21:21 +0100 Subject: [PATCH] Complete fix for FIRE-5002: Pressing "/" now always starts chat --- indra/newview/llnearbychathub.cpp | 19 +++++++++++++++++++ indra/newview/llnearbychathub.h | 3 +++ indra/newview/llviewerkeyboard.cpp | 24 +++++++++++++++++------- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/indra/newview/llnearbychathub.cpp b/indra/newview/llnearbychathub.cpp index fba547e3a3..b22060869c 100644 --- a/indra/newview/llnearbychathub.cpp +++ b/indra/newview/llnearbychathub.cpp @@ -487,3 +487,22 @@ BOOL LLNearbyChat::chatIsEmpty() const // return FALSE for unfocused chat editor, so other UI elements can claim arrow keys return FALSE; } + +void LLNearbyChat::startChatInDefaultChatBar(const char* line) +{ + showDefaultChatBar(TRUE); + setFocusedInputEditor(mDefaultChatBar, TRUE); + + if (line) + { + std::string line_string(line); + mFocusedInputEditor->setText(line_string); + } + + mFocusedInputEditor->setCursorToEnd(); +} + +std::string LLNearbyChat::getCurrentChatInDefaultCharBar() +{ + return mDefaultChatBar ? mDefaultChatBar->getText() : LLStringUtil::null; +} \ No newline at end of file diff --git a/indra/newview/llnearbychathub.h b/indra/newview/llnearbychathub.h index d4d8ac96fd..cb279c6bf8 100644 --- a/indra/newview/llnearbychathub.h +++ b/indra/newview/llnearbychathub.h @@ -62,6 +62,9 @@ public: BOOL chatIsEmpty() const; + void startChatInDefaultChatBar(const char* line); + std::string getCurrentChatInDefaultCharBar(); + LLNearbyChatControl* mFocusedInputEditor; }; diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index cb651cd6fa..6a932f2f0c 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -577,19 +577,29 @@ void start_gesture( EKeystate s ) if (KEYSTATE_UP == s && ! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) { - // Remove floating chat bar - // TODO: This needs the new bottom chat bar to work at all -/* if (LLNearbyChat::getInstance()->getCurrentChat().empty()) + // Changed for new chatbar + //if (LLNearbyChat::getInstance()->getCurrentChat().empty()) + //{ + // // No existing chat in chat editor, insert '/' + // LLNearbyChat::startChat("/"); + //} + //else + //{ + // // Don't overwrite existing text in chat editor + // LLNearbyChat::startChat(NULL); + //} + + if (LLNearbyChat::instance().getCurrentChatInDefaultCharBar().empty()) { // No existing chat in chat editor, insert '/' - LLNearbyChat::startChat("/"); + LLNearbyChat::instance().startChatInDefaultChatBar("/"); } else { // Don't overwrite existing text in chat editor - LLNearbyChat::startChat(NULL); - }*/ - // + LLNearbyChat::instance().startChatInDefaultChatBar(NULL); + } + // } }