From 6156baad67c744ed03ea47798bfeb8a77698efc6 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sun, 11 Jan 2009 16:10:10 -0600 Subject: Second Life viewer sources 1.22.4-RC --- linden/indra/llui/llfloater.cpp | 31 +++++++++++++++++++++++++++---- linden/indra/llui/llfloater.h | 5 +++++ linden/indra/llui/lltexteditor.cpp | 4 ++-- 3 files changed, 34 insertions(+), 6 deletions(-) (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 047342f..de4f6ce 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp @@ -544,6 +544,7 @@ void LLFloater::close(bool app_quitting) if (getHost()) { ((LLMultiFloater*)getHost())->removeFloater(this); + gFloaterView->addChild(this); } if (getSoundFlags() != SILENT @@ -1318,8 +1319,8 @@ void LLFloater::onClickEdit(void *userdata) self->mEditing = self->mEditing ? FALSE : TRUE; } -// static -void LLFloater::closeFocusedFloater() +// static +LLFloater* LLFloater::getClosableFloaterFromFocus() { LLFloater* focused_floater = NULL; @@ -1336,10 +1337,32 @@ void LLFloater::closeFocusedFloater() if (iter == sFloaterMap.end()) { // nothing found, return - return; + return NULL; + } + + // The focused floater may not be closable, + // Find and close a parental floater that is closeable, if any. + for(LLFloater* floater_to_close = focused_floater; + NULL != floater_to_close; + floater_to_close = gFloaterView->getParentFloater(floater_to_close)) + { + if(floater_to_close->isCloseable()) + { + return floater_to_close; + } } - focused_floater->close(); + return NULL; +} + +// static +void LLFloater::closeFocusedFloater() +{ + LLFloater* floater_to_close = LLFloater::getClosableFloaterFromFocus(); + if(floater_to_close) + { + floater_to_close->close(); + } // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h index 0be5d44..267707f 100644 --- a/linden/indra/llui/llfloater.h +++ b/linden/indra/llui/llfloater.h @@ -206,6 +206,11 @@ public: LLHandle getHandle() const { return mHandle; } + // Return a closeable floater, if any, given the current focus. + static LLFloater* getClosableFloaterFromFocus(); + + // Close the floater returned by getClosableFloaterFromFocus() and + // handle refocusing. static void closeFocusedFloater(); static void onClickClose(void *userdata); diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 4b0acf8..2205005 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -471,9 +471,9 @@ void LLTextEditor::updateLineStartList(S32 startpos) } // if scrolled to bottom, stay at bottom - // unless user is editing text + // unless user is selecting text // do this after updating page size - if (mScrolledToBottom && mTrackBottom && !hasFocus()) + if (mScrolledToBottom && mTrackBottom && !hasMouseCapture()) { endOfDoc(); } -- cgit v1.1