summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-05-27 18:16:51 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-05-27 18:16:51 +0300
commit987b9fdae24bc7bbe8aeddcbe2f8a3472d4428c4 (patch)
tree917390b4c62ef8da2b86927b4b29f0fef53a5d10
parent51eafb9ffeea5ae4fca0a40e94ddc60f295abf7b (diff)
MAINT-839 FIXED [PUBLIC]Clicking at menu a second time does not close it.
-rwxr-xr-xindra/llui/llmenugl.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 43ceb0e4c6..fbf2bb5f98 100755
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1457,23 +1457,15 @@ BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask )
// switch to mouse control mode
LLMenuGL::setKeyboardMode(FALSE);
- if (getVisible() && getHighlight() && getBranch())
+ if (getVisible() && isOpen())
{
- // already open - hide menu
- LLMenuGL::setKeyboardMode(FALSE);
- for (child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
- {
- LLView* viewp = *child_it;
- if (dynamic_cast<LLMenuGL*>(viewp) != NULL && viewp->getVisible())
- {
- viewp->setVisible(FALSE);
- }
- }
+ LLMenuGL::sMenuContainer->hideMenus();
}
else
{
onCommit();
}
+
make_ui_sound("UISndClick");
return TRUE;
}
@@ -3642,8 +3634,24 @@ BOOL LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask )
BOOL handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL;
if (!handled)
{
- // clicked off of menu, hide them all
- hideMenus();
+ LLMenuGL* visible_menu = (LLMenuGL*)getVisibleMenu();
+ LLMenuItemGL* parent_menu = visible_menu ? visible_menu->getParentMenuItem() : NULL;
+ if (parent_menu && parent_menu->getVisible())
+ {
+ // don't hide menu if parent was hit
+ LLRect parent_rect;
+ parent_menu->localRectToOtherView(parent_menu->getLocalRect(), &parent_rect, this);
+ if (!parent_rect.pointInRect(x, y))
+ {
+ // clicked off of menu and parent, hide them all
+ hideMenus();
+ }
+ }
+ else
+ {
+ // no visible parent, clicked off of menu, hide them all
+ hideMenus();
+ }
}
return handled;
}