diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llmenugl.cpp | 37 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 4 |
2 files changed, 37 insertions, 4 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8ae44fbfd5..bc4445ea6c 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3879,6 +3879,8 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) } else { + // close menus originating from other menu bars when first opening menu via keyboard + LLMenuGL::sMenuContainer->hideMenus(); highlightNextItem(NULL); LLMenuGL::setKeyboardMode(TRUE); } @@ -3921,13 +3923,38 @@ BOOL LLMenuBarGL::handleJumpKey(KEY key) return TRUE; } +BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) +{ + // clicks on menu bar closes existing menus from other contexts but leave + // own menu open so that we get toggle behavior + if (!getHighlightedItem() || !getHighlightedItem()->isActive()) + { + LLMenuGL::sMenuContainer->hideMenus(); + } + + return LLMenuGL::handleMouseDown(x, y, mask); +} + +BOOL LLMenuBarGL::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + // clicks on menu bar closes existing menus from other contexts but leave + // own menu open so that we get toggle behavior + if (!getHighlightedItem() || !getHighlightedItem()->isActive()) + { + LLMenuGL::sMenuContainer->hideMenus(); + } + + return LLMenuGL::handleMouseDown(x, y, mask); +} + + void LLMenuBarGL::draw() { LLMenuItemGL* itemp = getHighlightedItem(); // If we are in mouse-control mode and the mouse cursor is not hovering over - // the current highlighted menu item and it isn't open, then remove the highlight. - // This is done via a polling mechanism here, as we don't receive notifications when - // the mouse cursor moves off of us + // the current highlighted menu item and it isn't open, then remove the + // highlight. This is done via a polling mechanism here, as we don't receive + // notifications when the mouse cursor moves off of us if (itemp && !itemp->isOpen() && !itemp->getHover() && !LLMenuGL::getKeyboardMode()) { clearHoverItem(); @@ -3954,6 +3981,9 @@ void LLMenuBarGL::checkMenuTrigger() } else { + // close menus originating from other menu bars + LLMenuGL::sMenuContainer->hideMenus(); + highlightNextItem(NULL); LLMenuGL::setKeyboardMode(TRUE); } @@ -4362,6 +4392,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup) // keep onscreen gFloaterView->adjustToFitScreen(tearoffp, FALSE); tearoffp->open(); /* Flawfinder: ignore */ + return tearoffp; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 77998be880..16ab61c607 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -499,7 +499,7 @@ public: void setDropShadowed( const BOOL shadowed ); void setParentMenuItem( LLMenuItemGL* parent_menu_item ) { mParentMenuItem = parent_menu_item; } - LLMenuItemGL* getParentMenuItem() { return mParentMenuItem; } + LLMenuItemGL* getParentMenuItem() const { return mParentMenuItem; } void setTornOff(BOOL torn_off); BOOL getTornOff() { return mTornOff; } @@ -690,6 +690,8 @@ public: virtual BOOL handleAcceleratorKey(KEY key, MASK mask); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleJumpKey(KEY key); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // rearrange the child rects so they fit the shape of the menu // bar. |