summaryrefslogtreecommitdiff
path: root/indra/llui/llfloater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfloater.cpp')
-rw-r--r--indra/llui/llfloater.cpp34
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();
}
-
}