[Libreoffice-commits] core.git: 2 commits - vcl/source

Caolán McNamara caolanm at redhat.com
Thu Mar 26 09:22:16 PDT 2015


 vcl/source/control/ilstbox.cxx |    4 ---
 vcl/source/window/menu.cxx     |    7 ++----
 vcl/source/window/winproc.cxx  |   47 ++++++++++++++++++-----------------------
 3 files changed, 25 insertions(+), 33 deletions(-)

New commits:
commit 4f9e20c46b616c7c51bae74bfefd5247f922b2a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 26 16:07:26 2015 +0000

    Resolves: fdo#84795 Menus don't disappear with right mouse click
    
    Change-Id: I95ae2e2d564ec1c45de6df5158e4dec1d93053cb

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 74969b8..0121b61 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -3075,9 +3075,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 c7cfb4bae..2890efb 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2871,9 +2871,9 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_
     if (bRealExecute)
         nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL;
     if (!pStartedFrom || !pStartedFrom->IsMenuBar())
-        nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
+        nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK;
 
-    nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE;
+    nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
 
     // could be useful during debugging.
     // nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE;
commit 473eae3a7d43ca13ef14eca844b991ffd143e3a0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 26 15:28:57 2015 +0000

    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

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8cdcd0f..c7cfb4bae 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 5f1ebc3..83dc516 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() )
             {


More information about the Libreoffice-commits mailing list