diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llfloater.cpp | 66 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 1 | ||||
-rw-r--r-- | indra/newview/llurldispatcher.cpp | 4 |
3 files changed, 34 insertions, 37 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 432397d3e9..05bd7fb67f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -58,6 +58,8 @@ #include "llhelp.h" #include "llmultifloater.h" #include "llsdutil.h" +#include <boost/foreach.hpp> + // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; @@ -2163,8 +2165,15 @@ LLFloaterView::LLFloaterView (const Params& p) // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 old_width = getRect().getWidth(); - S32 old_height = getRect().getHeight(); + S32 old_right = mLastSnapRect.mRight; + S32 old_top = mLastSnapRect.mTop; + + LLView::reshape(width, height, called_from_parent); + + S32 new_right = getSnapRect().mRight; + S32 new_top = getSnapRect().mTop; + + mLastSnapRect = getSnapRect(); for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { @@ -2179,59 +2188,40 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) // Make if follow the edge it is closest to U32 follow_flags = 0x0; - if (floaterp->isMinimized()) - { - follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP); - } - else + if (!floaterp->isMinimized()) { LLRect r = floaterp->getRect(); // Compute absolute distance from each edge of screen S32 left_offset = llabs(r.mLeft - 0); - S32 right_offset = llabs(old_width - r.mRight); + S32 right_offset = llabs(old_right - r.mRight); - S32 top_offset = llabs(old_height - r.mTop); + S32 top_offset = llabs(old_top - r.mTop); S32 bottom_offset = llabs(r.mBottom - 0); + S32 translate_x = 0; + S32 translate_y = 0; - if (left_offset < right_offset) - { - follow_flags |= FOLLOWS_LEFT; - } - else + if (left_offset > right_offset) { - follow_flags |= FOLLOWS_RIGHT; + translate_x = new_right - old_right; } - // "No vertical adjustment" usually means that the bottom of the view - // has been pushed up or down. Hence we want the floaters to follow - // the top. if (top_offset < bottom_offset) { - follow_flags |= FOLLOWS_TOP; - } - else - { - follow_flags |= FOLLOWS_BOTTOM; + translate_y = new_top - old_top; } - } - floaterp->setFollows(follow_flags); - - //RN: all dependent floaters copy follow behavior of "parent" - for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin(); - dependent_it != floaterp->mDependents.end(); ++dependent_it) - { - LLFloater* dependent_floaterp = dependent_it->get(); - if (dependent_floaterp) + floaterp->translate(translate_x, translate_y); + BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents) { - dependent_floaterp->setFollows(follow_flags); + if (dependent_floater.get()) + { + dependent_floater.get()->translate(translate_x, translate_y); + } } } } - - LLView::reshape(width, height, called_from_parent); } @@ -2631,6 +2621,12 @@ void LLFloaterView::shiftFloaters(S32 x_offset, S32 y_offset) void LLFloaterView::refresh() { + LLRect snap_rect = getSnapRect(); + if (snap_rect != mLastSnapRect) + { + reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + } + // Constrain children to be entirely on the screen for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 73e9c9e831..4e8c539144 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -537,6 +537,7 @@ public: private: void hiddenFloaterClosed(LLFloater* floater); + LLRect mLastSnapRect; LLHandle<LLView> mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index f6d7ceeec3..4240a38326 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -167,9 +167,9 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, // static bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse) { - if(slurl.getType() != LLSLURL::LOCATION) + if(slurl.getType() != LLSLURL::LOCATION) { - return false; + return false; } // Before we're logged in, need to update the startup screen // to tell the user where they are going. |