diff options
author | Josh Bell <josh@lindenlab.com> | 2007-02-20 22:02:36 +0000 |
---|---|---|
committer | Josh Bell <josh@lindenlab.com> | 2007-02-20 22:02:36 +0000 |
commit | 7dada07dbaae3dfb9b1319453e51019bfff2717f (patch) | |
tree | a7f2b84ea65c39cee31474640dd5f265c0b2f432 /indra/llui/llfloater.cpp | |
parent | 73bc0fb42b5bcd80030d9f30d5cb57ec2397ba08 (diff) |
svn merge -r 57620:58007 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance
Diffstat (limited to 'indra/llui/llfloater.cpp')
-rw-r--r-- | indra/llui/llfloater.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
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<LLViewHandle, LLFloater*>::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(); } - } |