summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-03-26 15:28:57 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-04-08 12:48:28 +0000
commitc6dbd3206c23b8b54cc4392a12fb8ba11d4caf81 (patch)
treeefa1b79e827e18d3bdf626ee5cac5e76ab4bf613
parentd1b2478379ac79664f667d55abda1bc05ab8403c (diff)
Resolves: fdo#84795 Menus don't disappear with right mouse click
re-do this so right-clicking when a menu is open closes that menu but doesn't cause another popup menu or otherwise pass that click through to the app 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 (cherry picked from commit 473eae3a7d43ca13ef14eca844b991ffd143e3a0) Conflicts: vcl/source/window/winproc.cxx Change-Id: Ib96e52f22cdeefd59dbf4333f555d9f52b3385e2 Resolves: fdo#84795 Menus don't disappear with right mouse click Change-Id: I95ae2e2d564ec1c45de6df5158e4dec1d93053cb (cherry picked from commit 4f9e20c46b616c7c51bae74bfefd5247f922b2a6) why would we ever want FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK if we're from the menubar we never set it, but if we are a submenu from a menu in the menubar we set it. with it set, and on right click, the right click is passed through to what ever is underneath the pointer I don't see why we want to do that, especially the inconsistency from e.g. the File menu, vs the "File->New" menu Change-Id: I548f5c95e2511b5e921e8b74600f65eecdd8f498 (cherry picked from commit a8f9dd59de4e655bc77fa0546b81440aee46b837) remove the gap now to pretend it was never there Change-Id: I234defd865e6bf5d9d9eccc85cde7e69c0549c3f (cherry picked from commit a62d7f3b08b413d17e650279110ab8a48c419b18) Reviewed-on: https://gerrit.libreoffice.org/15092 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--include/vcl/floatwin.hxx9
-rw-r--r--vcl/source/control/ilstbox.cxx4
-rw-r--r--vcl/source/window/menu.cxx6
-rw-r--r--vcl/source/window/winproc.cxx48
4 files changed, 26 insertions, 41 deletions
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index c5ebb8d9b193..a4bc319be969 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -44,11 +44,10 @@ class ToolBox;
#define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((sal_uLong)0x00000800)
#define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((sal_uLong)0x00001000)
#define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((sal_uLong)0x00002000)
-#define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((sal_uLong)0x00004000)
-#define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00008000)
-#define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00010000)
-#define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00020000)
-#define FLOATWIN_POPUPMODE_NOHORZPLACEMENT ((sal_uLong)0x00040000)
+#define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00004000)
+#define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00008000)
+#define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00010000)
+#define FLOATWIN_POPUPMODE_NOHORZPLACEMENT ((sal_uLong)0x00020000)
#define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
#define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 29f54626a967..e6e4c592c3e0 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -3078,9 +3078,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
pGrandparentOutDev->ReMirror( aRect );
// mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
- const sal_uLong nFlags = FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
-
- StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | nFlags );
+ StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE );
if( nPos != LISTBOX_ENTRY_NOTFOUND )
mpImplLB->ShowProminentEntry( nPos );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8a6fa57edfb2..5b880f977799 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2840,11 +2840,7 @@ 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;
-
- nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE;
+ nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
// could be useful during debugging.
// nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE;
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ce5bc24cb900..7dbb543603f7 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, sal_uInt16 nSVEvent,
bool bMouseLeave )
{
@@ -82,14 +80,14 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM
if ( nSVEvent == EVENT_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,18 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rM
{
if ( (nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) &&
(nSVEvent == EVENT_MOUSEBUTTONUP) )
- return IHMFM_TRUE;
+ return true;
pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
- if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK )
- return IHMFM_FLOAT | IHMFM_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 +379,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, sal_uInt16 nSVEvent, bool bMous
// #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 == EVENT_MOUSEMOVE )
{
ImplHandleMouseHelpRequest( pChild, aMousePos );
@@ -404,18 +399,15 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, sal_uInt16 nSVEvent, bool bMous
pChild->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
}
- if(FloatHdl != IHMFM_FLOAT) // mouse-button left: don't stop the handling for the click fdo#84795
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ return true;
+ else
{
- if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
- return true;
- else
- {
- // Set normal MousePointer for disabled windows
- if ( nSVEvent == EVENT_MOUSEMOVE )
- ImplSetMousePointer( pChild );
+ // Set normal MousePointer for disabled windows
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ ImplSetMousePointer( pChild );
- return false;
- }
+ return false;
}
}
@@ -644,7 +636,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, sal_uInt16 nSVEvent, bool bMous
{
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() )
{