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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 4 08:30:17 UTC 2019


 include/vcl/seleng.hxx       |    1 +
 vcl/source/window/seleng.cxx |   13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 3259c1058913887f51af456918927a50d139d70d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 3 15:17:15 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 4 10:29:48 2019 +0200

    add nullchecking SelectionEngine::CaptureMouse
    
    Change-Id: Ie8594c8fe2a9e2d84121f3a6a1ee8afab265b14f
    Reviewed-on: https://gerrit.libreoffice.org/70216
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx
index 800e767c7cba..472226fbb661 100644
--- a/include/vcl/seleng.hxx
+++ b/include/vcl/seleng.hxx
@@ -104,6 +104,7 @@ public:
     //context menu via "Command" which is delivered after
     //mouse down but before mouse up, then use this
     void                ReleaseMouse();
+    void                CaptureMouse();
 
     // Keyboard
     void                CursorPosChanging( bool bShift, bool bMod1 );
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index 4f7630b54e06..415999a80fa2 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -131,7 +131,7 @@ bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
 
     if( !rMEvt.IsRight() )
     {
-        pWin->CaptureMouse();
+        CaptureMouse();
         nFlags |= SelectionEngineFlags::IN_SEL;
     }
     else
@@ -284,6 +284,13 @@ void SelectionEngine::ReleaseMouse()
     pWin->ReleaseMouse();
 }
 
+void SelectionEngine::CaptureMouse()
+{
+    if (!pWin || pWin->IsMouseCaptured())
+        return;
+    pWin->CaptureMouse();
+}
+
 bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
 {
 
@@ -325,8 +332,8 @@ void SelectionEngine::SetWindow( vcl::Window* pNewWin )
         if (nFlags & SelectionEngineFlags::IN_SEL)
             ReleaseMouse();
         pWin = pNewWin;
-        if ( pWin && ( nFlags & SelectionEngineFlags::IN_SEL ) )
-            pWin->CaptureMouse();
+        if (nFlags & SelectionEngineFlags::IN_SEL)
+            CaptureMouse();
     }
 }
 


More information about the Libreoffice-commits mailing list