diff options
author | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2013-09-11 14:17:56 +0300 |
---|---|---|
committer | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2013-09-11 14:17:56 +0300 |
commit | 186113144e950adf78eaf452d76d3a59b6af2974 (patch) | |
tree | 9837d093d4d61f2083e96d1f0368d97d65bbf1b3 | |
parent | 9e451513d95691d073519bea12b3899807784d21 (diff) |
MAINT-2894 FIXED Handle mouse events for popup menus in modal dialogs.
-rwxr-xr-x | indra/llui/llmodaldialog.cpp | 37 | ||||
-rwxr-xr-x | indra/newview/lltoast.cpp | 2 |
2 files changed, 35 insertions, 4 deletions
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 8c2be44904..ff85b0ad09 100755 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -34,7 +34,7 @@ #include "llui.h" #include "llwindow.h" #include "llkeyboard.h" - +#include "llmenugl.h" // static std::list<LLModalDialog*> LLModalDialog::sModalStack; @@ -161,6 +161,18 @@ void LLModalDialog::setVisible( BOOL visible ) BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { + LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); + if (popup_menu != NULL) + { + S32 mx, my; + LLUI::getMousePositionScreen(&mx, &my); + LLRect menu_screen_rc = popup_menu->calcScreenRect(); + if(!menu_screen_rc.pointInRect(mx, my)) + { + LLMenuGL::sMenuContainer->hideMenus(); + } + } + if (mModal) { if (!LLFloater::handleMouseDown(x, y, mask)) @@ -173,16 +185,34 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { LLFloater::handleMouseDown(x, y, mask); } + + return TRUE; } BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) -{ +{ if( childrenHandleHover(x, y, mask) == NULL ) { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; + lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; } + + LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); + if (popup_menu != NULL) + { + S32 mx, my; + LLUI::getMousePositionScreen(&mx, &my); + LLRect menu_screen_rc = popup_menu->calcScreenRect(); + if(menu_screen_rc.pointInRect(mx, my)) + { + S32 local_x = mx - popup_menu->getRect().mLeft; + S32 local_y = my - popup_menu->getRect().mBottom; + popup_menu->handleHover(local_x, local_y, mask); + gFocusMgr.setMouseCapture(NULL); + } + } + return TRUE; } @@ -210,6 +240,7 @@ BOOL LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) { + LLMenuGL::sMenuContainer->hideMenus(); childrenHandleRightMouseDown(x, y, mask); return TRUE; } diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index d876c9a3f4..448fae48de 100755 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -555,7 +555,7 @@ BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask) mHideBtnPressed = mHideBtn->getRect().pointInRect(x, y); } - return LLFloater::handleMouseDown(x, y, mask); + return LLModalDialog::handleMouseDown(x, y, mask); } //-------------------------------------------------------------------------- |