summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfloater.cpp7
-rw-r--r--indra/llui/llfloater.h1
-rw-r--r--indra/newview/llsidetray.cpp37
3 files changed, 44 insertions, 1 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 35e0d9d890..d19e33ea55 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2869,7 +2869,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
// close callback
if (p.close_callback.isProvided())
{
- mCloseSignal.connect(initCommitCallback(p.close_callback));
+ setCloseCallback(initCommitCallback(p.close_callback));
}
}
@@ -2879,6 +2879,11 @@ boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_
return mMinimizeSignal->connect(cb);
}
+boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t::slot_type& cb )
+{
+ return mCloseSignal.connect(cb);
+}
+
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 0e83b80c89..5b7b020881 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -144,6 +144,7 @@ public:
bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL);
boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb );
void initFromParams(const LLFloater::Params& p);
bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 8aaa7f0e13..a9bb01ac70 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -96,6 +96,7 @@ bool LLSideTray::instanceCreated ()
class LLSideTrayTab: public LLPanel
{
+ LOG_CLASS(LLSideTrayTab);
friend class LLUICtrlFactory;
friend class LLSideTray;
public:
@@ -122,6 +123,8 @@ protected:
void undock(LLFloater* floater_tab);
LLSideTray* getSideTray();
+
+ void onFloaterClose(LLSD::Boolean app_quitting);
public:
virtual ~LLSideTrayTab();
@@ -140,6 +143,8 @@ public:
void onOpen (const LLSD& key);
void toggleTabDocked();
+ void setDocked(bool dock);
+ bool isDocked() const;
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
@@ -151,6 +156,7 @@ private:
std::string mDescription;
LLView* mMainPanel;
+ boost::signals2::connection mFloaterCloseConn;
};
LLSideTrayTab::LLSideTrayTab(const Params& p)
@@ -271,6 +277,35 @@ void LLSideTrayTab::toggleTabDocked()
LLFloaterReg::toggleInstance("side_bar_tab", tab_name);
}
+// Same as toggleTabDocked() apart from making sure that we do exactly what we want.
+void LLSideTrayTab::setDocked(bool dock)
+{
+ if (isDocked() == dock)
+ {
+ llwarns << "Tab " << getName() << " is already " << (dock ? "docked" : "undocked") << llendl;
+ return;
+ }
+
+ toggleTabDocked();
+}
+
+bool LLSideTrayTab::isDocked() const
+{
+ return dynamic_cast<LLSideTray*>(getParent()) != NULL;
+}
+
+void LLSideTrayTab::onFloaterClose(LLSD::Boolean app_quitting)
+{
+ // If user presses Ctrl-Shift-W, handle that gracefully by docking all
+ // undocked tabs before their floaters get destroyed (STORM-1016).
+
+ // Don't dock on quit for the current dock state to be correctly saved.
+ if (app_quitting) return;
+
+ lldebugs << "Forcibly docking tab " << getName() << llendl;
+ setDocked(true);
+}
+
BOOL LLSideTrayTab::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
// Let children handle the event
@@ -294,6 +329,7 @@ void LLSideTrayTab::dock(LLFloater* floater_tab)
return;
}
+ mFloaterCloseConn.disconnect();
setRect(side_tray->getLocalRect());
reshape(getRect().getWidth(), getRect().getHeight());
@@ -342,6 +378,7 @@ void LLSideTrayTab::undock(LLFloater* floater_tab)
}
floater_tab->addChild(this);
+ mFloaterCloseConn = floater_tab->setCloseCallback(boost::bind(&LLSideTrayTab::onFloaterClose, this, _2));
floater_tab->setTitle(mTabTitle);
floater_tab->setName(getName());