diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index cbcb397889..19d1b4cb56 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2357,6 +2357,8 @@ LLFloaterView::LLFloaterView (const Params& p) mFocusCycleMode(FALSE), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), + mSnapOffsetChatBar(0), + mSnapOffsetLeft(0), mSnapOffsetRight(0) { mSnapView = getHandle(); @@ -3012,11 +3014,23 @@ LLRect LLFloaterView::getSnapRect() const { LLRect snap_rect = getLocalRect(); + // Fix for bad edge snapping + static LLUICachedControl legacy_snap ("FSLegacyEdgeSnap", false); + if (legacy_snap) + { + snap_rect.mBottom += (mSnapOffsetBottom + mSnapOffsetChatBar); + snap_rect.mLeft += mSnapOffsetLeft; + snap_rect.mRight -= mSnapOffsetRight; + } + else + { + // <\FS:KC> Fix for bad edge snapping LLView* snap_view = mSnapView.get(); if (snap_view) { snap_view->localRectToOtherView(snap_view->getLocalRect(), &snap_rect, this); } + }// Fix for bad edge snapping return snap_rect; } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 921a8ff925..cd37945351 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -588,6 +588,13 @@ public: void setFloaterSnapView(LLHandle snap_view) {mSnapView = snap_view; } LLFloater* getFrontmostClosableFloater(); + // Fix for bad edge snapping + void setSnapOffsetBottom(S32 offset) { mSnapOffsetBottom = offset; } + void setSnapOffsetChatBar(S32 offset) { mSnapOffsetChatBar = offset; } + void setSnapOffsetRight(S32 offset) { mSnapOffsetRight = offset; } + void setSnapOffsetLeft(S32 offset) { mSnapOffsetLeft = offset; } + // Fix for bad edge snapping + private: void hiddenFloaterClosed(LLFloater* floater); @@ -595,6 +602,8 @@ private: LLHandle mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; + S32 mSnapOffsetChatBar; // Fix for bad edge snapping + S32 mSnapOffsetLeft; // Fix for bad edge snapping S32 mSnapOffsetRight; S32 mMinimizePositionVOffset; typedef std::vector, boost::signals2::connection> > hidden_floaters_t; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 8c7dc35db7..4424322904 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -919,6 +919,21 @@ void LLToolBar::updateLayoutAsNeeded() mEndCenteringPanel->setVisible(FALSE); } // + + // Fix for bad edge snapping + if (mSideType == SIDE_BOTTOM) + { + gFloaterView->setSnapOffsetBottom(mButtons.empty() ? 0 : getRect().getHeight()); + } + else if (mSideType == SIDE_LEFT) + { + gFloaterView->setSnapOffsetLeft(mButtons.empty() ? 0 : getRect().getWidth()); + } + else if (mSideType == SIDE_RIGHT) + { + gFloaterView->setSnapOffsetRight(mButtons.empty() ? 0 : getRect().getWidth()); + } + // Fix for bad edge snapping if (!mButtons.empty()) { diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c9afb2c98c..f9ada1f219 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -20445,5 +20445,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSLegacyEdgeSnap + + Comment + Use old method for adjusting edge snap regions. + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index dc09271183..d85e8b17af 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -64,6 +64,11 @@ // #include "fscommon.h" +// Fix for bad edge snapping +// *HACK* chat bar cannot return its correct height for some reason +static const S32 MAGIC_CHAT_BAR_PAD = 5; +// Fix for bad edge snapping + // FIRE-787: break up too long chat lines into multiple messages void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); void really_send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); @@ -504,6 +509,16 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const mDefaultChatBar->setVisible(visible); mDefaultChatBar->setFocus(visible); + // Fix for bad edge snapping + if(visible) + { + gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD); + } + else + { + gFloaterView->setSnapOffsetChatBar(0); + } + if(!text) return; @@ -512,6 +527,7 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const mDefaultChatBar->setText(LLStringExplicit(text)); mDefaultChatBar->setCursorToEnd(); } + // Fix for bad edge snapping } // We want to know which nearby chat editor (if any) currently has focus