aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llmenugl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llmenugl.cpp206
1 files changed, 90 insertions, 116 deletions
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp
index 97069fa..1748956 100644
--- a/linden/indra/llui/llmenugl.cpp
+++ b/linden/indra/llui/llmenugl.cpp
@@ -62,7 +62,7 @@
62#include <boost/tokenizer.hpp> 62#include <boost/tokenizer.hpp>
63 63
64// static 64// static
65LLView *LLMenuGL::sDefaultMenuContainer = NULL; 65LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL;
66 66
67S32 MENU_BAR_HEIGHT = 0; 67S32 MENU_BAR_HEIGHT = 0;
68S32 MENU_BAR_WIDTH = 0; 68S32 MENU_BAR_WIDTH = 0;
@@ -404,14 +404,10 @@ void LLMenuItemGL::doIt( void )
404{ 404{
405 // close all open menus by default 405 // close all open menus by default
406 // if parent menu is actually visible (and we are not triggering menu item via accelerator) 406 // if parent menu is actually visible (and we are not triggering menu item via accelerator)
407 // HACK: do not call hidemenus() from a pie menu item, as most pie menu operations 407 if (!getMenu()->getTornOff()
408 // assume that the thing you clicked on stays selected (parcel and/or object) after the
409 // pie menu is gone --RN
410 if (getMenu()->getWidgetType() != WIDGET_TYPE_PIE_MENU
411 && !getMenu()->getTornOff()
412 && getMenu()->getVisible()) 408 && getMenu()->getVisible())
413 { 409 {
414 ((LLMenuHolderGL*)getMenu()->getParent())->hideMenus(); 410 LLMenuGL::sMenuContainer->hideMenus();
415 } 411 }
416} 412}
417 413
@@ -473,18 +469,28 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
473 469
474BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK ) 470BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
475{ 471{
476 //llinfos << mLabel.c_str() << " handleMouseUp " << x << "," << y
477 // << llendl;
478 if (mEnabled) 472 if (mEnabled)
479 { 473 {
480 // switch to mouse navigation mode 474 // switch to mouse navigation mode
481 LLMenuGL::setKeyboardMode(FALSE); 475 LLMenuGL::setKeyboardMode(FALSE);
482 476
483 doIt(); 477 doIt();
484 setHighlight(FALSE);
485 make_ui_sound("UISndClickRelease"); 478 make_ui_sound("UISndClickRelease");
486 return TRUE; 479 return TRUE;
487 } 480 }
481 return FALSE;
482}
483
484BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
485{
486 if (mEnabled)
487 {
488 // switch to mouse navigation mode
489 LLMenuGL::setKeyboardMode(FALSE);
490
491 setHighlight(TRUE);
492 return TRUE;
493 }
488 else 494 else
489 { 495 {
490 return FALSE; 496 return FALSE;
@@ -1168,70 +1174,6 @@ void LLMenuItemToggleGL::doIt( void )
1168} 1174}
1169 1175
1170 1176
1171//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1172// Class LLMenuItemBranchGL
1173//
1174// The LLMenuItemBranchGL represents a menu item that has a
1175// sub-menu. This is used to make cascading menus.
1176//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1177
1178class LLMenuItemBranchGL : public LLMenuItemGL
1179{
1180protected:
1181 LLMenuGL* mBranch;
1182
1183public:
1184 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
1185 KEY key = KEY_NONE, MASK mask = MASK_NONE );
1186 virtual LLXMLNodePtr getXML(bool save_children = true) const;
1187
1188 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
1189
1190 virtual LLString getType() const { return "menu"; }
1191
1192 virtual EWidgetType getWidgetType() const;
1193 virtual LLString getWidgetTag() const;
1194
1195 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
1196
1197 virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
1198
1199 // check if we've used these accelerators already
1200 virtual BOOL addToAcceleratorList(std::list <LLKeyBinding*> *listp);
1201
1202 // called to rebuild the draw label
1203 virtual void buildDrawLabel( void );
1204
1205 // doIt() - do the primary funcationality of the menu item.
1206 virtual void doIt( void );
1207
1208 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
1209 virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
1210
1211 // set the hover status (called by it's menu) and if the object is
1212 // active. This is used for behavior transfer.
1213 virtual void setHighlight( BOOL highlight );
1214
1215 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
1216
1217 virtual BOOL isActive() const;
1218
1219 virtual BOOL isOpen() const;
1220
1221 LLMenuGL *getBranch() const { return mBranch; }
1222
1223 virtual void updateBranchParent( LLView* parentp );
1224
1225 // LLView Functionality
1226 virtual void onVisibilityChange( BOOL curVisibilityIn );
1227
1228 virtual void draw();
1229
1230 virtual void setEnabledSubMenus(BOOL enabled);
1231
1232 virtual void openMenu();
1233};
1234
1235LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, 1177LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
1236 KEY key, MASK mask ) : 1178 KEY key, MASK mask ) :
1237 LLMenuItemGL( name, label, key, mask ), 1179 LLMenuItemGL( name, label, key, mask ),
@@ -1502,6 +1444,9 @@ void LLMenuItemBranchGL::openMenu()
1502 } 1444 }
1503 else if( !mBranch->getVisible() ) 1445 else if( !mBranch->getVisible() )
1504 { 1446 {
1447 // get valid rectangle for menus
1448 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
1449
1505 mBranch->arrange(); 1450 mBranch->arrange();
1506 1451
1507 LLRect rect = mBranch->getRect(); 1452 LLRect rect = mBranch->getRect();
@@ -1524,13 +1469,13 @@ void LLMenuItemBranchGL::openMenu()
1524 mBranch->localPointToOtherView( 0, 0, &x, &y, mBranch->getParent() ); 1469 mBranch->localPointToOtherView( 0, 0, &x, &y, mBranch->getParent() );
1525 S32 delta_x = 0; 1470 S32 delta_x = 0;
1526 S32 delta_y = 0; 1471 S32 delta_y = 0;
1527 if( y < 0 ) 1472 if( y < menu_region_rect.mBottom )
1528 { 1473 {
1529 delta_y = -y; 1474 delta_y = menu_region_rect.mBottom - y;
1530 } 1475 }
1531 1476
1532 S32 window_width = mBranch->getParent()->getRect().getWidth(); 1477 S32 menu_region_width = menu_region_rect.getWidth();
1533 if( x > window_width - rect.getWidth() ) 1478 if( x - menu_region_rect.mLeft > menu_region_width - rect.getWidth() )
1534 { 1479 {
1535 // move sub-menu over to left side 1480 // move sub-menu over to left side
1536 delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth()))); 1481 delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth())));
@@ -1709,7 +1654,7 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1709{ 1654{
1710 BOOL branch_visible = mBranch->getVisible(); 1655 BOOL branch_visible = mBranch->getVisible();
1711 BOOL handled = mBranch->handleAcceleratorKey(key, mask); 1656 BOOL handled = mBranch->handleAcceleratorKey(key, mask);
1712 if (handled && !branch_visible) 1657 if (handled && !branch_visible && getVisible())
1713 { 1658 {
1714 // flash this menu entry because we triggered an invisible menu item 1659 // flash this menu entry because we triggered an invisible menu item
1715 LLMenuHolderGL::setActivatedItem(this); 1660 LLMenuHolderGL::setActivatedItem(this);
@@ -1721,7 +1666,8 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1721BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 1666BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
1722{ 1667{
1723 BOOL menu_open = mBranch->getVisible(); 1668 BOOL menu_open = mBranch->getVisible();
1724 if (getHighlight() && getMenu()->getVisible()) 1669 // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
1670 if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
1725 { 1671 {
1726 if (key == KEY_LEFT) 1672 if (key == KEY_LEFT)
1727 { 1673 {
@@ -1961,9 +1907,9 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
1961 // SUBMENU 1907 // SUBMENU
1962 LLMenuGL *submenu = (LLMenuGL*)LLMenuGL::fromXML(child, parent, factory); 1908 LLMenuGL *submenu = (LLMenuGL*)LLMenuGL::fromXML(child, parent, factory);
1963 appendMenu(submenu); 1909 appendMenu(submenu);
1964 if (LLMenuGL::sDefaultMenuContainer != NULL) 1910 if (LLMenuGL::sMenuContainer != NULL)
1965 { 1911 {
1966 submenu->updateParent(LLMenuGL::sDefaultMenuContainer); 1912 submenu->updateParent(LLMenuGL::sMenuContainer);
1967 } 1913 }
1968 else 1914 else
1969 { 1915 {
@@ -2337,6 +2283,12 @@ void LLMenuGL::setBackgroundColor( const LLColor4& color )
2337 mBackgroundColor = color; 2283 mBackgroundColor = color;
2338} 2284}
2339 2285
2286LLColor4 LLMenuGL::getBackgroundColor()
2287{
2288 return mBackgroundColor;
2289}
2290
2291
2340// rearrange the child rects so they fit the shape of the menu. 2292// rearrange the child rects so they fit the shape of the menu.
2341void LLMenuGL::arrange( void ) 2293void LLMenuGL::arrange( void )
2342{ 2294{
@@ -2350,8 +2302,10 @@ void LLMenuGL::arrange( void )
2350 2302
2351 if( mItems.size() ) 2303 if( mItems.size() )
2352 { 2304 {
2353 U32 max_width = (getParent() != NULL) ? getParent()->getRect().getWidth() : U32_MAX; 2305 const LLRect menu_region_rect = LLMenuGL::sMenuContainer ? LLMenuGL::sMenuContainer->getMenuRect() : LLRect(0, S32_MAX, S32_MAX, 0);
2354 U32 max_height = (getParent() != NULL) ? getParent()->getRect().getHeight() : U32_MAX; 2306
2307 U32 max_width = menu_region_rect.getWidth();
2308 U32 max_height = menu_region_rect.getHeight();
2355 // *FIX: create the item first and then ask for its dimensions? 2309 // *FIX: create the item first and then ask for its dimensions?
2356 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" ); 2310 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" );
2357 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING; 2311 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING;
@@ -2472,7 +2426,7 @@ void LLMenuGL::createSpilloverBranch()
2472 // technically, you can't tear off spillover menus, but we're passing the handle 2426 // technically, you can't tear off spillover menus, but we're passing the handle
2473 // along just to be safe 2427 // along just to be safe
2474 mSpilloverMenu = new LLMenuGL("More", "More", mParentFloaterHandle); 2428 mSpilloverMenu = new LLMenuGL("More", "More", mParentFloaterHandle);
2475 mSpilloverMenu->updateParent(getParent()); 2429 mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer);
2476 // Inherit colors 2430 // Inherit colors
2477 mSpilloverMenu->setBackgroundColor( mBackgroundColor ); 2431 mSpilloverMenu->setBackgroundColor( mBackgroundColor );
2478 mSpilloverMenu->setCanTearOff(FALSE); 2432 mSpilloverMenu->setCanTearOff(FALSE);
@@ -3110,7 +3064,6 @@ void LLMenuGL::setVisible(BOOL visible)
3110 mFadeTimer.stop(); 3064 mFadeTimer.stop();
3111 } 3065 }
3112 3066
3113 //gViewerWindow->finishFastFrame();
3114 LLView::setVisible(visible); 3067 LLView::setVisible(visible);
3115 } 3068 }
3116} 3069}
@@ -3157,6 +3110,8 @@ void hide_top_view( LLView* view )
3157// static 3110// static
3158void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) 3111void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
3159{ 3112{
3113 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
3114
3160 const S32 HPAD = 2; 3115 const S32 HPAD = 2;
3161 LLRect rect = menu->getRect(); 3116 LLRect rect = menu->getRect();
3162 //LLView* cur_view = spawning_view; 3117 //LLView* cur_view = spawning_view;
@@ -3177,13 +3132,15 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
3177 // &left, &bottom ); 3132 // &left, &bottom );
3178 S32 delta_x = 0; 3133 S32 delta_x = 0;
3179 S32 delta_y = 0; 3134 S32 delta_y = 0;
3180 if( bottom < 0 ) 3135 if( bottom < menu_region_rect.mBottom )
3181 { 3136 {
3182 delta_y = -bottom; 3137 // At this point, we need to move the context menu to the
3138 // other side of the mouse.
3139 //delta_y = menu_region_rect.mBottom - bottom;
3140 delta_y = (rect.getHeight() + 2 * HPAD);
3183 } 3141 }
3184 3142
3185 S32 parent_width = menu->getParent()->getRect().getWidth(); 3143 if( left > menu_region_rect.mRight - rect.getWidth() )
3186 if( left > parent_width - rect.getWidth() )
3187 { 3144 {
3188 // At this point, we need to move the context menu to the 3145 // At this point, we need to move the context menu to the
3189 // other side of the mouse. 3146 // other side of the mouse.
@@ -3283,7 +3240,7 @@ void LLPieMenuBranch::doIt( void )
3283 S32 center_y; 3240 S32 center_y;
3284 parent->localPointToScreen(rect.getWidth() / 2, rect.getHeight() / 2, &center_x, &center_y); 3241 parent->localPointToScreen(rect.getWidth() / 2, rect.getHeight() / 2, &center_x, &center_y);
3285 3242
3286 parent->hide(TRUE); 3243 parent->hide(FALSE);
3287 mBranch->show( center_x, center_y, FALSE ); 3244 mBranch->show( center_x, center_y, FALSE );
3288} 3245}
3289 3246
@@ -3473,6 +3430,11 @@ BOOL LLPieMenu::handleMouseDown( S32 x, S32 y, MASK mask )
3473 // to make sure it's within the item's rectangle 3430 // to make sure it's within the item's rectangle
3474 handled = item->handleMouseDown( 0, 0, mask ); 3431 handled = item->handleMouseDown( 0, 0, mask );
3475 } 3432 }
3433 else if (!mRightMouseDown)
3434 {
3435 // call hidemenus to make sure transient selections get cleared
3436 ((LLMenuHolderGL*)getParent())->hideMenus();
3437 }
3476 3438
3477 // always handle mouse down as mouse up will close open menus 3439 // always handle mouse down as mouse up will close open menus
3478 return handled; 3440 return handled;
@@ -3546,6 +3508,11 @@ BOOL LLPieMenu::handleMouseUp( S32 x, S32 y, MASK mask )
3546 hide(TRUE); 3508 hide(TRUE);
3547 } 3509 }
3548 } 3510 }
3511 else if (!mRightMouseDown)
3512 {
3513 // call hidemenus to make sure transient selections get cleared
3514 ((LLMenuHolderGL*)getParent())->hideMenus();
3515 }
3549 3516
3550 if (handled) 3517 if (handled)
3551 { 3518 {
@@ -3555,7 +3522,7 @@ BOOL LLPieMenu::handleMouseUp( S32 x, S32 y, MASK mask )
3555 if (!handled && !mUseInfiniteRadius) 3522 if (!handled && !mUseInfiniteRadius)
3556 { 3523 {
3557 // call hidemenus to make sure transient selections get cleared 3524 // call hidemenus to make sure transient selections get cleared
3558 ((LLMenuHolderGL*)getParent())->hideMenus(); 3525 sMenuContainer->hideMenus();
3559 } 3526 }
3560 3527
3561 if (mFirstMouseDown) 3528 if (mFirstMouseDown)
@@ -3866,10 +3833,9 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3866 S32 width = mRect.getWidth(); 3833 S32 width = mRect.getWidth();
3867 S32 height = mRect.getHeight(); 3834 S32 height = mRect.getHeight();
3868 3835
3869 LLView* parent_view = getParent(); 3836 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
3870 S32 menu_region_width = parent_view->getRect().getWidth();
3871 S32 menu_region_height = parent_view->getRect().getHeight();
3872 3837
3838 LLView* parent_view = getParent();
3873 BOOL moved = FALSE; 3839 BOOL moved = FALSE;
3874 3840
3875 S32 local_x, local_y; 3841 S32 local_x, local_y;
@@ -3879,36 +3845,36 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3879 arrange(); 3845 arrange();
3880 3846
3881 // Adjust the pie rectangle to keep it on screen 3847 // Adjust the pie rectangle to keep it on screen
3882 if (mRect.mLeft < 0) 3848 if (mRect.mLeft < menu_region_rect.mLeft)
3883 { 3849 {
3884 //mShiftHoriz = 0 - mRect.mLeft; 3850 //mShiftHoriz = menu_region_rect.mLeft - mRect.mLeft;
3885 //mRect.translate( mShiftHoriz, 0 ); 3851 //mRect.translate( mShiftHoriz, 0 );
3886 mRect.translate( 0 - mRect.mLeft, 0 ); 3852 mRect.translate( menu_region_rect.mLeft - mRect.mLeft, 0 );
3887 moved = TRUE; 3853 moved = TRUE;
3888 } 3854 }
3889 3855
3890 if (mRect.mRight > menu_region_width) 3856 if (mRect.mRight > menu_region_rect.mRight)
3891 { 3857 {
3892 //mShiftHoriz = menu_region_width - mRect.mRight; 3858 //mShiftHoriz = menu_region_rect.mRight - mRect.mRight;
3893 //mRect.translate( mShiftHoriz, 0); 3859 //mRect.translate( mShiftHoriz, 0);
3894 mRect.translate( menu_region_width - mRect.mRight, 0 ); 3860 mRect.translate( menu_region_rect.mRight - mRect.mRight, 0 );
3895 moved = TRUE; 3861 moved = TRUE;
3896 } 3862 }
3897 3863
3898 if (mRect.mBottom < 0) 3864 if (mRect.mBottom < menu_region_rect.mBottom)
3899 { 3865 {
3900 //mShiftVert = -mRect.mBottom; 3866 //mShiftVert = menu_region_rect.mBottom - mRect.mBottom;
3901 //mRect.translate( 0, mShiftVert ); 3867 //mRect.translate( 0, mShiftVert );
3902 mRect.translate( 0, 0 - mRect.mBottom ); 3868 mRect.translate( 0, menu_region_rect.mBottom - mRect.mBottom );
3903 moved = TRUE; 3869 moved = TRUE;
3904 } 3870 }
3905 3871
3906 3872
3907 if (mRect.mTop > menu_region_height) 3873 if (mRect.mTop > menu_region_rect.mTop)
3908 { 3874 {
3909 //mShiftVert = menu_region_height - mRect.mTop; 3875 //mShiftVert = menu_region_rect.mTop - mRect.mTop;
3910 //mRect.translate( 0, mShiftVert ); 3876 //mRect.translate( 0, mShiftVert );
3911 mRect.translate( 0, menu_region_height - mRect.mTop ); 3877 mRect.translate( 0, menu_region_rect.mTop - mRect.mTop );
3912 moved = TRUE; 3878 moved = TRUE;
3913 } 3879 }
3914 3880
@@ -4067,9 +4033,9 @@ LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
4067 menu->setCanTearOff(TRUE, parent_handle); 4033 menu->setCanTearOff(TRUE, parent_handle);
4068 } 4034 }
4069 menubar->appendMenu(menu); 4035 menubar->appendMenu(menu);
4070 if (LLMenuGL::sDefaultMenuContainer != NULL) 4036 if (LLMenuGL::sMenuContainer != NULL)
4071 { 4037 {
4072 menu->updateParent(LLMenuGL::sDefaultMenuContainer); 4038 menu->updateParent(LLMenuGL::sMenuContainer);
4073 } 4039 }
4074 else 4040 else
4075 { 4041 {
@@ -4198,9 +4164,9 @@ void LLMenuBarGL::checkMenuTrigger()
4198 4164
4199BOOL LLMenuBarGL::jumpKeysActive() 4165BOOL LLMenuBarGL::jumpKeysActive()
4200{ 4166{
4201 // require item to be highlighted to activate key triggers 4167 // require user to be in keyboard navigation mode to activate key triggers
4202 // as menu bars are always visible 4168 // as menu bars are always visible and it is easy to leave the mouse cursor over them
4203 return getHighlightedItem() && LLMenuGL::jumpKeysActive(); 4169 return LLMenuGL::getKeyboardMode() && getHighlightedItem() && LLMenuGL::jumpKeysActive();
4204} 4170}
4205 4171
4206// rearrange the child rects so they fit the shape of the menu bar. 4172// rearrange the child rects so they fit the shape of the menu bar.
@@ -4218,6 +4184,7 @@ void LLMenuBarGL::arrange( void )
4218 item->setRect( rect ); 4184 item->setRect( rect );
4219 item->buildDrawLabel(); 4185 item->buildDrawLabel();
4220 } 4186 }
4187 reshape(rect.mRight, rect.getHeight());
4221} 4188}
4222 4189
4223 4190
@@ -4430,12 +4397,12 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
4430 LLView::reshape(width, height, called_from_parent); 4397 LLView::reshape(width, height, called_from_parent);
4431} 4398}
4432 4399
4433BOOL LLMenuHolderGL::hasVisibleMenu() 4400BOOL LLMenuHolderGL::hasVisibleMenu() const
4434{ 4401{
4435 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 4402 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
4436 { 4403 {
4437 LLView* viewp = *child_it; 4404 LLView* viewp = *child_it;
4438 if (viewp->getVisible()) 4405 if (viewp->getVisible() && viewp->getWidgetType() != WIDGET_TYPE_MENU_BAR)
4439 { 4406 {
4440 return TRUE; 4407 return TRUE;
4441 } 4408 }
@@ -4443,6 +4410,11 @@ BOOL LLMenuHolderGL::hasVisibleMenu()
4443 return FALSE; 4410 return FALSE;
4444} 4411}
4445 4412
4413const LLRect LLMenuHolderGL::getMenuRect() const
4414{
4415 return getLocalRect();
4416}
4417
4446BOOL LLMenuHolderGL::hideMenus() 4418BOOL LLMenuHolderGL::hideMenus()
4447{ 4419{
4448 if (!mCanHide) 4420 if (!mCanHide)
@@ -4452,11 +4424,13 @@ BOOL LLMenuHolderGL::hideMenus()
4452 BOOL menu_visible = hasVisibleMenu(); 4424 BOOL menu_visible = hasVisibleMenu();
4453 if (menu_visible) 4425 if (menu_visible)
4454 { 4426 {
4427 LLMenuGL::setKeyboardMode(FALSE);
4455 // clicked off of menu, hide them all 4428 // clicked off of menu, hide them all
4456 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 4429 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
4457 { 4430 {
4458 LLView* viewp = *child_it; 4431 LLView* viewp = *child_it;
4459 if (viewp->getVisible()) 4432 // clicks off of menu do not hide menu bar
4433 if (viewp->getWidgetType() != WIDGET_TYPE_MENU_BAR && viewp->getVisible())
4460 { 4434 {
4461 viewp->setVisible(FALSE); 4435 viewp->setVisible(FALSE);
4462 } 4436 }
@@ -4598,7 +4572,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup)
4598 LLTearOffMenu* tearoffp = new LLTearOffMenu(menup); 4572 LLTearOffMenu* tearoffp = new LLTearOffMenu(menup);
4599 // keep onscreen 4573 // keep onscreen
4600 gFloaterView->adjustToFitScreen(tearoffp, FALSE); 4574 gFloaterView->adjustToFitScreen(tearoffp, FALSE);
4601 tearoffp->open(); 4575 tearoffp->open(); /* Flawfinder: ignore */
4602 return tearoffp; 4576 return tearoffp;
4603} 4577}
4604 4578