From 7dada07dbaae3dfb9b1319453e51019bfff2717f Mon Sep 17 00:00:00 2001 From: Josh Bell Date: Tue, 20 Feb 2007 22:02:36 +0000 Subject: svn merge -r 57620:58007 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --- indra/llui/llfloater.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 22d898c5ce..b56ae5167b 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1218,24 +1218,36 @@ void LLFloater::onClickEdit(void *userdata) } // static -void LLFloater::closeByMenu( void* userdata ) +void LLFloater::closeFocusedFloater() { - LLFloater* self = (LLFloater*) userdata; - if (!self || self->getHost()) return; + LLFloater* focused_floater = NULL; + + std::map::iterator iter; + for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter) + { + focused_floater = iter->second; + if (focused_floater->hasFocus()) + { + break; + } + } - LLFloaterView* parent = (LLFloaterView*) self->getParent(); + if (iter == sFloaterMap.end()) + { + // nothing found, return + return; + } - // grab focus status before close just in case floater is deleted - BOOL has_focus = gFocusMgr.childHasKeyboardFocus(self); - self->close(); + focused_floater->close(); - // if this floater used to have focus and now nothing took focus + // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) - if (has_focus && gFocusMgr.getKeyboardFocus() == NULL) + if (gFocusMgr.getKeyboardFocus() == NULL) { - parent->focusFrontFloater(); + // HACK: use gFloaterView directly in case we are using Ctrl-W to close snapshot window + // which sits in gSnapshotFloaterView, and needs to pass focus on to normal floater view + gFloaterView->focusFrontFloater(); } - } -- cgit v1.2.3