diff options
Diffstat (limited to 'linden/indra/llui/llmenugl.cpp')
-rw-r--r-- | linden/indra/llui/llmenugl.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp index 1748956..1920aac 100644 --- a/linden/indra/llui/llmenugl.cpp +++ b/linden/indra/llui/llmenugl.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -3254,6 +3255,7 @@ LLPieMenu::LLPieMenu(const LLString& name, const LLString& label) | |||
3254 | mUseInfiniteRadius(FALSE), | 3255 | mUseInfiniteRadius(FALSE), |
3255 | mHoverItem(NULL), | 3256 | mHoverItem(NULL), |
3256 | mHoverThisFrame(FALSE), | 3257 | mHoverThisFrame(FALSE), |
3258 | mHoveredAnyItem(FALSE), | ||
3257 | mOuterRingAlpha(1.f), | 3259 | mOuterRingAlpha(1.f), |
3258 | mCurRadius(0.f), | 3260 | mCurRadius(0.f), |
3259 | mRightMouseDown(FALSE) | 3261 | mRightMouseDown(FALSE) |
@@ -3268,6 +3270,7 @@ LLPieMenu::LLPieMenu(const LLString& name) | |||
3268 | mUseInfiniteRadius(FALSE), | 3270 | mUseInfiniteRadius(FALSE), |
3269 | mHoverItem(NULL), | 3271 | mHoverItem(NULL), |
3270 | mHoverThisFrame(FALSE), | 3272 | mHoverThisFrame(FALSE), |
3273 | mHoveredAnyItem(FALSE), | ||
3271 | mOuterRingAlpha(1.f), | 3274 | mOuterRingAlpha(1.f), |
3272 | mCurRadius(0.f), | 3275 | mCurRadius(0.f), |
3273 | mRightMouseDown(FALSE) | 3276 | mRightMouseDown(FALSE) |
@@ -3338,12 +3341,12 @@ BOOL LLPieMenu::handleHover( S32 x, S32 y, MASK mask ) | |||
3338 | 3341 | ||
3339 | // release mouse capture after short period of visibility if we're using a finite boundary | 3342 | // release mouse capture after short period of visibility if we're using a finite boundary |
3340 | // so that right click outside of boundary will trigger new pie menu | 3343 | // so that right click outside of boundary will trigger new pie menu |
3341 | if (gFocusMgr.getMouseCapture() == this && | 3344 | if (hasMouseCapture() && |
3342 | !mRightMouseDown && | 3345 | !mRightMouseDown && |
3343 | mShrinkBorderTimer.getStarted() && | 3346 | mShrinkBorderTimer.getStarted() && |
3344 | mShrinkBorderTimer.getElapsedTimeF32() >= PIE_SHRINK_TIME) | 3347 | mShrinkBorderTimer.getElapsedTimeF32() >= PIE_SHRINK_TIME) |
3345 | { | 3348 | { |
3346 | gFocusMgr.setMouseCapture(NULL, NULL); | 3349 | gFocusMgr.setMouseCapture(NULL); |
3347 | mUseInfiniteRadius = FALSE; | 3350 | mUseInfiniteRadius = FALSE; |
3348 | } | 3351 | } |
3349 | 3352 | ||
@@ -3395,6 +3398,7 @@ BOOL LLPieMenu::handleHover( S32 x, S32 y, MASK mask ) | |||
3395 | break; | 3398 | break; |
3396 | } | 3399 | } |
3397 | } | 3400 | } |
3401 | mHoveredAnyItem = TRUE; | ||
3398 | } | 3402 | } |
3399 | else | 3403 | else |
3400 | { | 3404 | { |
@@ -3456,7 +3460,7 @@ BOOL LLPieMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) | |||
3456 | if (clicked_in_pie) | 3460 | if (clicked_in_pie) |
3457 | { | 3461 | { |
3458 | // capture mouse cursor as if on initial menu show | 3462 | // capture mouse cursor as if on initial menu show |
3459 | gFocusMgr.setMouseCapture(this, NULL); | 3463 | gFocusMgr.setMouseCapture(this); |
3460 | mShrinkBorderTimer.stop(); | 3464 | mShrinkBorderTimer.stop(); |
3461 | mUseInfiniteRadius = TRUE; | 3465 | mUseInfiniteRadius = TRUE; |
3462 | handled = TRUE; | 3466 | handled = TRUE; |
@@ -3482,11 +3486,22 @@ BOOL LLPieMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) | |||
3482 | mShrinkBorderTimer.getElapsedTimeF32() > PIE_SHRINK_TIME) | 3486 | mShrinkBorderTimer.getElapsedTimeF32() > PIE_SHRINK_TIME) |
3483 | { | 3487 | { |
3484 | mUseInfiniteRadius = FALSE; | 3488 | mUseInfiniteRadius = FALSE; |
3485 | gFocusMgr.setMouseCapture(NULL, NULL); | 3489 | gFocusMgr.setMouseCapture(NULL); |
3486 | } | 3490 | } |
3487 | 3491 | ||
3492 | S32 delta_x = x /*+ mShiftHoriz*/ - getLocalRect().getCenterX(); | ||
3493 | S32 delta_y = y /*+ mShiftVert*/ - getLocalRect().getCenterY(); | ||
3494 | if (!mHoveredAnyItem && !mFirstMouseDown && (delta_x * delta_x) + (delta_y * delta_y) < PIE_CENTER_SIZE * PIE_CENTER_SIZE) | ||
3495 | { | ||
3496 | // user released right mouse button in middle of pie, interpret this as closing the menu | ||
3497 | sMenuContainer->hideMenus(); | ||
3498 | return TRUE; | ||
3499 | } | ||
3500 | |||
3501 | |||
3488 | BOOL result = handleMouseUp( x, y, mask ); | 3502 | BOOL result = handleMouseUp( x, y, mask ); |
3489 | mRightMouseDown = FALSE; | 3503 | mRightMouseDown = FALSE; |
3504 | mHoveredAnyItem = FALSE; | ||
3490 | 3505 | ||
3491 | return result; | 3506 | return result; |
3492 | } | 3507 | } |
@@ -3893,6 +3908,8 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down) | |||
3893 | mRightMouseDown = mouse_down; | 3908 | mRightMouseDown = mouse_down; |
3894 | mFirstMouseDown = mouse_down; | 3909 | mFirstMouseDown = mouse_down; |
3895 | mUseInfiniteRadius = TRUE; | 3910 | mUseInfiniteRadius = TRUE; |
3911 | mHoveredAnyItem = FALSE; | ||
3912 | |||
3896 | if (!mFirstMouseDown) | 3913 | if (!mFirstMouseDown) |
3897 | { | 3914 | { |
3898 | make_ui_sound("UISndPieMenuAppear"); | 3915 | make_ui_sound("UISndPieMenuAppear"); |
@@ -3902,7 +3919,7 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down) | |||
3902 | 3919 | ||
3903 | // we want all mouse events in case user does quick right click again off of pie menu | 3920 | // we want all mouse events in case user does quick right click again off of pie menu |
3904 | // rectangle, to support gestural menu traversal | 3921 | // rectangle, to support gestural menu traversal |
3905 | gFocusMgr.setMouseCapture(this, NULL); | 3922 | gFocusMgr.setMouseCapture(this); |
3906 | 3923 | ||
3907 | if (mouse_down) | 3924 | if (mouse_down) |
3908 | { | 3925 | { |
@@ -3929,10 +3946,11 @@ void LLPieMenu::hide(BOOL item_selected) | |||
3929 | mFirstMouseDown = FALSE; | 3946 | mFirstMouseDown = FALSE; |
3930 | mRightMouseDown = FALSE; | 3947 | mRightMouseDown = FALSE; |
3931 | mUseInfiniteRadius = FALSE; | 3948 | mUseInfiniteRadius = FALSE; |
3949 | mHoveredAnyItem = FALSE; | ||
3932 | 3950 | ||
3933 | LLView::setVisible(FALSE); | 3951 | LLView::setVisible(FALSE); |
3934 | 3952 | ||
3935 | gFocusMgr.setMouseCapture(NULL, NULL); | 3953 | gFocusMgr.setMouseCapture(NULL); |
3936 | } | 3954 | } |
3937 | 3955 | ||
3938 | ///============================================================================ | 3956 | ///============================================================================ |
@@ -4529,6 +4547,7 @@ void LLTearOffMenu::onFocusLost() | |||
4529 | { | 4547 | { |
4530 | // remove highlight from parent item and our own menu | 4548 | // remove highlight from parent item and our own menu |
4531 | mMenu->clearHoverItem(); | 4549 | mMenu->clearHoverItem(); |
4550 | LLFloater::onFocusLost(); | ||
4532 | } | 4551 | } |
4533 | 4552 | ||
4534 | BOOL LLTearOffMenu::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) | 4553 | BOOL LLTearOffMenu::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) |