diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 15:28:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 16:09:16 +0000 |
commit | 473eae3a7d43ca13ef14eca844b991ffd143e3a0 (patch) | |
tree | a2bb23a5c17d804da8fd4db1ec9ba709b2d9611c | |
parent | df77bc8839f29b7035bd8542cc9f88db31571e88 (diff) |
Revert "fdo#84795 Menu, DropDown-List don't disappear with right mouse click"
This reverts commit fa022a9c4fe74f3f67fb3c35ef49022842d7499b.
because if a right-click context menu is active and we click outside it in
order to remove it then that click goes to whatever is underneath the mouse
which is undesirable
the list dropdown part of this looks good, its the general menus that are the problem
Conflicts:
vcl/source/window/winproc.cxx
Change-Id: Ib96e52f22cdeefd59dbf4333f555d9f52b3385e2
-rw-r--r-- | vcl/source/window/menu.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 47 |
2 files changed, 23 insertions, 29 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 8cdcd0f7f346..c7cfb4bae8a8 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2870,9 +2870,8 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ WinBits nStyle = WB_BORDER; if (bRealExecute) nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL; - - // mouse-button right: close the sub-menu (float-win) and don't stop the handling fdo#84795 - nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE; + if (!pStartedFrom || !pStartedFrom->IsMenuBar()) + nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE; nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE; diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 5f1ebc3e5a6f..83dc51682888 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -60,9 +60,7 @@ bool ImplCallPreNotify( NotifyEvent& rEvt ) || rEvt.GetWindow()->PreNotify( rEvt ); } - -enum ENUM_IHMFM {IHMFM_FALSE = 0, IHMFM_TRUE = 1, IHMFM_FLOAT = 2}; -static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePos, +static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePos, sal_uInt16 nCode, MouseNotifyEvent nSVEvent, bool bMouseLeave ) { @@ -82,14 +80,14 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE ) { if ( bMouseLeave ) - return IHMFM_TRUE; + return true; if ( !pFloat || (nHitTest == HITTEST_RECT) ) { if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp ) ImplDestroyHelpWindow( true ); pChild->ImplGetFrame()->SetPointer( POINTER_ARROW ); - return IHMFM_TRUE; + return true; } } else @@ -103,13 +101,13 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); nPopupFlags = pLastLevelFloat->GetPopupModeFlags(); pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); - return IHMFM_FLOAT | IHMFM_TRUE; // don't stop the handling fdo#84795 + return true; } else if ( nHitTest == HITTEST_RECT ) { if ( !(pFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE) ) pFloat->ImplSetMouseDown(); - return IHMFM_TRUE; + return true; } } else @@ -120,7 +118,7 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM { if ( pFloat->ImplIsMouseDown() ) pFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL ); - return IHMFM_TRUE; + return true; } } else @@ -130,7 +128,7 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM if ( !(nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) ) { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); - return IHMFM_TRUE; + return true; } } } @@ -145,21 +143,21 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM { if ( (nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) ) - return IHMFM_TRUE; + return true; pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ) - return IHMFM_FLOAT | IHMFM_FALSE; + return false; else - return IHMFM_TRUE; + return true; } else - return IHMFM_TRUE; + return true; } } } } - return IHMFM_FALSE; + return false; } static void ImplHandleMouseHelpRequest( vcl::Window* pChild, const Point& rMousePos ) @@ -384,7 +382,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool // #106845# if the window was disabed during capturing we have to pass the mouse events to release capturing if ( pSVData->maWinData.mpCaptureWin != pChild && (!pChild->IsEnabled() || !pChild->IsInputEnabled() || pChild->IsInModalNonRefMode() ) ) { - sal_uInt16 FloatHdl = (ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ) & IHMFM_FLOAT); + ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ); if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE ) { ImplHandleMouseHelpRequest( pChild, aMousePos ); @@ -404,18 +402,15 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool pChild->ImplNotifyKeyMouseCommandEventListeners( aNEvt ); } - if(FloatHdl != IHMFM_FLOAT) // mouse-button left: don't stop the handling for the click fdo#84795 + if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN ) + return true; + else { - if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN ) - return true; - else - { - // Set normal MousePointer for disabled windows - if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE ) - ImplSetMousePointer( pChild ); + // Set normal MousePointer for disabled windows + if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE ) + ImplSetMousePointer( pChild ); - return false; - } + return false; } } @@ -643,7 +638,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool { ImplDelData aDelData; pChild->ImplAddDel( &aDelData ); - if ( (ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ) & ~IHMFM_FLOAT) == IHMFM_TRUE ) + if ( ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ) ) { if ( !aDelData.IsDead() ) { |