summaryrefslogtreecommitdiff
path: root/indra/newview/lltransientfloatermgr.cpp
diff options
context:
space:
mode:
authorAlexei Arabadji <aarabadji@productengine.com>2010-01-22 13:42:52 +0200
committerAlexei Arabadji <aarabadji@productengine.com>2010-01-22 13:42:52 +0200
commit74429f2ed926362a2ec47d590fc862b55b26f0f8 (patch)
tree03b8f0199a32a878974174133d9095d268017fe7 /indra/newview/lltransientfloatermgr.cpp
parent4230c655483b61277bdd4c87e0e2a02a39179c88 (diff)
fixed EXT-3670 “Clicking on IM session in IM session well closes IM floater”,
implemented exclude sets for groups of transient floaters, now transient floaters not closes if user click on view from global exclude set or from floater group set; made IM floater goes foreground if it visible but not focused instead hide floater; --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/lltransientfloatermgr.cpp')
-rw-r--r--indra/newview/lltransientfloatermgr.cpp69
1 files changed, 46 insertions, 23 deletions
diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp
index 347399f239..f474f47eb7 100644
--- a/indra/newview/lltransientfloatermgr.cpp
+++ b/indra/newview/lltransientfloatermgr.cpp
@@ -44,57 +44,68 @@ LLTransientFloaterMgr::LLTransientFloaterMgr()
{
gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(
&LLTransientFloaterMgr::leftMouseClickCallback, this, _1, _2, _3));
+
+ mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(GLOBAL, std::set<LLView*>()));
+ mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(IM, std::set<LLView*>()));
}
-void LLTransientFloaterMgr::registerTransientFloater(LLFloater* floater)
+void LLTransientFloaterMgr::registerTransientFloater(LLTransientFloater* floater)
{
mTransSet.insert(floater);
}
-void LLTransientFloaterMgr::unregisterTransientFloater(LLFloater* floater)
+void LLTransientFloaterMgr::unregisterTransientFloater(LLTransientFloater* floater)
{
mTransSet.erase(floater);
}
+void LLTransientFloaterMgr::addControlView(ETransientGroup group, LLView* view)
+{
+ mGroupControls.find(group)->second.insert(view);
+}
+
+void LLTransientFloaterMgr::removeControlView(ETransientGroup group, LLView* view)
+{
+ mGroupControls.find(group)->second.erase(view);
+}
+
void LLTransientFloaterMgr::addControlView(LLView* view)
{
- mControlsSet.insert(view);
+ addControlView(GLOBAL, view);
}
void LLTransientFloaterMgr::removeControlView(LLView* view)
{
// we will still get focus lost callbacks on this view, but that's ok
// since we run sanity checking logic every time
- mControlsSet.erase(view);
+ removeControlView(GLOBAL, view);
}
-void LLTransientFloaterMgr::hideTransientFloaters()
+void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y)
{
- for (std::set<LLFloater*>::iterator it = mTransSet.begin(); it
+ for (std::set<LLTransientFloater*>::iterator it = mTransSet.begin(); it
!= mTransSet.end(); it++)
{
- LLFloater* floater = *it;
- if (floater->isDocked())
+ LLTransientFloater* floater = *it;
+ if (floater->isTransientDocked())
{
- floater->setVisible(FALSE);
+ ETransientGroup group = floater->getGroup();
+
+ bool hide = isControlClicked(mGroupControls.find(group)->second, x, y);
+ if (hide)
+ {
+ floater->setTransientVisible(FALSE);
+ }
}
}
}
-void LLTransientFloaterMgr::leftMouseClickCallback(S32 x, S32 y,
- MASK mask)
+bool LLTransientFloaterMgr::isControlClicked(std::set<LLView*>& set, S32 x, S32 y)
{
- bool hide = true;
- for (controls_set_t::iterator it = mControlsSet.begin(); it
- != mControlsSet.end(); it++)
+ bool res = true;
+ for (controls_set_t::iterator it = set.begin(); it
+ != set.end(); it++)
{
- // don't hide transient floater if any context menu opened
- if (LLMenuGL::sMenuContainer->getVisibleMenu() != NULL)
- {
- hide = false;
- break;
- }
-
LLView* control_view = *it;
if (!control_view->getVisible())
{
@@ -105,14 +116,26 @@ void LLTransientFloaterMgr::leftMouseClickCallback(S32 x, S32 y,
// if click inside view rect
if (rect.pointInRect(x, y))
{
- hide = false;
+ res = false;
break;
}
}
+ return res;
+}
+
+void LLTransientFloaterMgr::leftMouseClickCallback(S32 x, S32 y,
+ MASK mask)
+{
+ // don't hide transient floater if any context menu opened
+ if (LLMenuGL::sMenuContainer->getVisibleMenu() != NULL)
+ {
+ return;
+ }
+ bool hide = isControlClicked(mGroupControls.find(GLOBAL)->second, x, y);
if (hide)
{
- hideTransientFloaters();
+ hideTransientFloaters(x, y);
}
}