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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Tue May 7 09:30:46 UTC 2019


 desktop/source/lib/init.cxx    |   11 +++++++----
 include/vcl/lok.hxx            |    1 +
 sfx2/source/view/lokhelper.cxx |   10 +++++++++-
 vcl/source/app/svapp.cxx       |    6 ++++++
 4 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 37a19f781d4e4f0fa1c6abf4679d222213bbddfb
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Apr 27 13:37:52 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue May 7 11:30:10 2019 +0200

    unipoll: emit user input-events & uno commands directly when in unipoll mode.
    
    Rather than emitting asynchronously at idle.
    
    Change-Id: I6c72e9fad0b5587941e3a4a4d17d331a0d889942
    Reviewed-on: https://gerrit.libreoffice.org/71809
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c6fe2d8c2636..7e0507c1d73c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2971,10 +2971,13 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
 
     std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments));
 
-    beans::PropertyValue aSynchronMode;
-    aSynchronMode.Name = "SynchronMode";
-    aSynchronMode.Value <<= false;
-    aPropertyValuesVector.push_back(aSynchronMode);
+    if (!vcl::lok::isUnipoll())
+    {
+        beans::PropertyValue aSynchronMode;
+        aSynchronMode.Name = "SynchronMode";
+        aSynchronMode.Value <<= false;
+        aPropertyValuesVector.push_back(aSynchronMode);
+    }
 
     int nView = SfxLokHelper::getView();
     if (nView < 0)
diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx
index 5c30b6290221..2dbc0443d7b7 100644
--- a/include/vcl/lok.hxx
+++ b/include/vcl/lok.hxx
@@ -18,6 +18,7 @@ namespace vcl
 {
 namespace lok
 {
+bool VCL_DLLPUBLIC isUnipoll();
 void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback,
                                          LibreOfficeKitWakeCallback pWakeCallback, void* pData);
 }
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 9e9b9ab53e82..a7828287205d 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -12,6 +12,7 @@
 #include <com/sun/star/frame/Desktop.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <vcl/lok.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/commandevent.hxx>
 #include <sfx2/app.hxx>
@@ -313,7 +314,14 @@ namespace
         }
 
         pEvent->mnView = SfxLokHelper::getView(nullptr);
-        Application::PostUserEvent(Link<void*, void>(pEvent, LOKPostAsyncEvent));
+        if (vcl::lok::isUnipoll())
+        {
+            if (!Application::IsMainThread())
+                SAL_WARN("lok", "Posting event directly but not called from main thread!");
+            LOKPostAsyncEvent(pEvent, nullptr);
+        }
+        else
+            Application::PostUserEvent(Link<void*, void>(pEvent, LOKPostAsyncEvent));
     }
 }
 
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 0037d35443f9..df05d78d864f 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1675,6 +1675,12 @@ void registerPollCallbacks(
     }
 }
 
+bool isUnipoll()
+{
+    ImplSVData * pSVData = ImplGetSVData();
+    return pSVData && pSVData->mpPollClosure != nullptr;
+}
+
 } } // namespace lok, namespace vcl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list