[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 2 commits - chart2/source include/vcl sfx2/source

Jan Holesovsky kendy at collabora.com
Tue Feb 27 11:43:19 UTC 2018


 chart2/source/controller/inc/ChartWindow.hxx  |    5 +++
 chart2/source/controller/main/ChartWindow.cxx |   15 +++++++++
 include/vcl/ITiledRenderable.hxx              |    6 +++
 sfx2/source/view/lokcharthelper.cxx           |   41 +++++++++++++-------------
 4 files changed, 48 insertions(+), 19 deletions(-)

New commits:
commit 3ae573be36d76f371308dde0274d217a02f1d965
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Feb 27 12:00:25 2018 +0100

    lo chart2: The LokChartHelper must post the mouse events too.
    
    Calling directly causes freezes in Execute() when instantiating dialogs.
    
    Change-Id: I3aa09b99e5a13027892aeba02860e87e29b172da
    Reviewed-on: https://gerrit.libreoffice.org/50419
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx
index 7883794a02bf..309916d35608 100644
--- a/chart2/source/controller/inc/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -58,6 +58,11 @@ public:
     virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
     virtual void RequestHelp( const HelpEvent& rHEvt ) override;
 
+    /// For LibreOfficeKit, we need to route these to the mouse events.
+    virtual void LogicMouseButtonDown(const MouseEvent&);
+    virtual void LogicMouseButtonUp(const MouseEvent&);
+    virtual void LogicMouseMove(const MouseEvent&);
+
     void ForceInvalidate();
     virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
     virtual void Invalidate( const Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 58d6c291cb74..7da14ae80288 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -271,6 +271,21 @@ void ChartWindow::RequestHelp( const HelpEvent& rHEvt )
         vcl::Window::RequestHelp( rHEvt );
 }
 
+void ChartWindow::LogicMouseButtonDown(const MouseEvent& rEvent)
+{
+    MouseButtonDown(rEvent);
+}
+
+void ChartWindow::LogicMouseButtonUp(const MouseEvent& rEvent)
+{
+    MouseButtonUp(rEvent);
+}
+
+void ChartWindow::LogicMouseMove(const MouseEvent& rEvent)
+{
+    MouseMove(rEvent);
+}
+
 void ChartWindow::adjustHighContrastMode()
 {
     static const DrawModeFlags nContrastMode =
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index f5b4ba37c663..785411de7de2 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -15,6 +15,8 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/fract.hxx>
 #include <tools/mapunit.hxx>
+#include <vcl/ITiledRenderable.hxx>
+#include <vcl/svapp.hxx>
 #include <vcl/virdev.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -22,7 +24,6 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 
-
 #define TWIPS_PER_PIXEL 15
 
 using namespace com::sun::star;
@@ -272,32 +273,34 @@ bool LokChartHelper::postMouseEvent(int nType, int nX, int nY,
         Rectangle rChartBBox = GetChartBoundingBox();
         if (rChartBBox.IsInside(aMousePos))
         {
+            vcl::ITiledRenderable::LOKAsyncEventData* pLOKEv = new vcl::ITiledRenderable::LOKAsyncEventData;
+            pLOKEv->mpWindow = pChartWindow;
+            switch (nType)
+            {
+                case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+                    pLOKEv->mnEvent = VCLEVENT_WINDOW_MOUSEBUTTONDOWN;
+                    break;
+                case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+                    pLOKEv->mnEvent = VCLEVENT_WINDOW_MOUSEBUTTONUP;
+                    break;
+                case LOK_MOUSEEVENT_MOUSEMOVE:
+                    pLOKEv->mnEvent = VCLEVENT_WINDOW_MOUSEMOVE;
+                    break;
+                default:
+                    assert(false);
+            }
+
             int nChartWinX = nX - rChartBBox.Left();
             int nChartWinY = nY - rChartBBox.Top();
 
             // chart window expects pixels, but the conversion factor
             // can depend on the client zoom
             Point aPos(nChartWinX * fScaleX, nChartWinY * fScaleY);
-            MouseEvent aEvent(aPos, nCount,
+            pLOKEv->maMouseEvent = MouseEvent(aPos, nCount,
                     MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
 
-            switch (nType)
-            {
-            case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
-                pChartWindow->MouseButtonDown(aEvent);
-                break;
-            case LOK_MOUSEEVENT_MOUSEBUTTONUP:
-                pChartWindow->MouseButtonUp(aEvent);
-                if (pChartWindow->IsTracking())
-                    pChartWindow->EndTracking(TrackingEventFlags::DontCallHdl);
-                break;
-            case LOK_MOUSEEVENT_MOUSEMOVE:
-                pChartWindow->MouseMove(aEvent);
-                break;
-            default:
-                assert(false);
-                break;
-            }
+            Application::PostUserEvent(Link<void*, void>(pLOKEv, vcl::ITiledRenderable::LOKPostAsyncEvent));
+
             return true;
         }
     }
commit 1a368c539138fd36690798d0e2f2285a1551fc61
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Feb 27 06:49:24 2018 +0100

    lok: Re-introduce the cancellation of tracking.
    
    Without this, the charts tend to crash on double-click.
    
    This kind of reverts commit 86ea687d3f19c04192ee2b7a82736e110c7be334.
    
    Change-Id: I462e4beec71008a0abe29ec0bb570c8a35c82a7f
    Reviewed-on: https://gerrit.libreoffice.org/50408
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index cea97828d7ed..dd8d950e5dbb 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -120,6 +120,12 @@ public:
             break;
         case VCLEVENT_WINDOW_MOUSEBUTTONUP:
             pLOKEv->mpWindow->LogicMouseButtonUp(pLOKEv->maMouseEvent);
+
+            // sometimes MouseButtonDown captures mouse and starts tracking, and VCL
+            // will not take care of releasing that with tiled rendering
+            if (pLOKEv->mpWindow->IsTracking())
+                pLOKEv->mpWindow->EndTracking(TrackingEventFlags::DontCallHdl);
+
             break;
         case VCLEVENT_WINDOW_MOUSEMOVE:
             pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent);


More information about the Libreoffice-commits mailing list