From d37f0033e5a76ca1096e616d3d1d3d92cdc41853 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 24 Jan 2014 22:03:50 +0100 Subject: [PATCH] Make preventing floaters being dragged underneath the main chat bar actually work, even for Vintage and Latency skin --- indra/llui/llfloater.cpp | 4 ++-- indra/llui/llfloater.h | 2 +- indra/llui/lllayoutstack.cpp | 7 +++++++ indra/llui/lllayoutstack.h | 8 ++++++++ indra/newview/fsnearbychathub.cpp | 2 -- indra/newview/llviewerwindow.cpp | 9 +++++++++ 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 6f085aa698..a6b9837403 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3203,9 +3203,9 @@ void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LL } // Prevent floaters being dragged under main chat bar -void LLFloaterView::setMainChatbarRect(const LLRect& chatbar_rect) +void LLFloaterView::setMainChatbarRect(LLLayoutPanel* panel, const LLRect& chatbar_rect) { - mMainChatbarRect = chatbar_rect; + panel->localRectToScreen(chatbar_rect, &mMainChatbarRect); mMainChatbarRect.stretch(FLOATER_MIN_VISIBLE_PIXELS); } // diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index f01ce00211..e623d4d2c0 100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -589,7 +589,7 @@ public: void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect); // Prevent floaters being dragged under main chat bar - void setMainChatbarRect(const LLRect& chatbar_rect); + void setMainChatbarRect(LLLayoutPanel* panel, const LLRect& chatbar_rect); private: void hiddenFloaterClosed(LLFloater* floater); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index fdd056f17c..ebcc1f968a 100755 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -201,6 +201,13 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user) stackp->mNeedsLayout = true; } LLPanel::handleReshape(new_rect, by_user); + + // Add callback for reshaping + if (!mReshapeCallback.empty()) + { + mReshapeCallback(this, new_rect); + } + // } // diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index d640334f41..361d9446f7 100755 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -210,6 +210,11 @@ public: void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; } + // Add callback for reshaping + typedef boost::function reshape_callback_t; + void setReshapeCallback(reshape_callback_t cb) { mReshapeCallback = cb; } + // + protected: LLLayoutPanel(const Params& p); @@ -226,6 +231,9 @@ protected: bool mIgnoreReshape; LLLayoutStack::ELayoutOrientation mOrientation; class LLResizeBar* mResizeBar; + + // Add callback for reshaping + reshape_callback_t mReshapeCallback; }; diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index e6c3e6ce71..043d885b49 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -525,12 +525,10 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const if(visible) { gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD); - gFloaterView->setMainChatbarRect(mDefaultChatBar->getParent()->getRect()); } else { gFloaterView->setSnapOffsetChatBar(0); - gFloaterView->setMainChatbarRect(LLRect()); } if(!text) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index c873efb710..f959eae7a8 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1975,6 +1975,15 @@ void LLViewerWindow::initBase() gFloaterView->setFloaterSnapView(main_view->getChild("floater_snap_region")->getHandle()); gSnapshotFloaterView = main_view->getChild("Snapshot Floater View"); + // Prevent floaters being dragged under main chat bar + LLLayoutPanel* chatbar_panel = dynamic_cast(gToolBarView->getChildView("default_chat_bar")->getParent()); + if (chatbar_panel) + { + chatbar_panel->setReshapeCallback(boost::bind(&LLFloaterView::setMainChatbarRect, gFloaterView, _1, _2)); + gFloaterView->setMainChatbarRect(chatbar_panel, chatbar_panel->getRect()); + } + // + // optionally forward warnings to chat console/chat floater // for qa runs and dev builds #if !LL_RELEASE_FOR_DOWNLOAD