[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/source include/vcl sfx2/source vcl/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Mon May 6 09:20:15 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 33bfff357d68a521186a493b31b795b85bde897c
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Apr 27 13:37:52 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon May 6 11:19:33 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/71770
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index da88ae1b28f8..52b7f399c38b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3004,10 +3004,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 85834534316c..98b76d43514c 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 <sfx2/viewsh.hxx>
 #include <sfx2/request.hxx>
@@ -308,7 +309,14 @@ namespace
         }
 
         pEvent->mnView = SfxLokHelper::getView(nullptr);
-        Application::PostUserEvent(Link<void*, void>(pEvent, LOKPostAsyncEvent));
+        if (vcl::lok::isUnipoll())
+        {
+            if (Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier())
+                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 5e97a2629641..70cc7287acec 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1722,6 +1722,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