Kaydet (Commit) 37a19f78 authored tarafından Michael Meeks's avatar Michael Meeks

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: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst f1ed27ee
...@@ -2971,10 +2971,13 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma ...@@ -2971,10 +2971,13 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments)); std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments));
beans::PropertyValue aSynchronMode; if (!vcl::lok::isUnipoll())
aSynchronMode.Name = "SynchronMode"; {
aSynchronMode.Value <<= false; beans::PropertyValue aSynchronMode;
aPropertyValuesVector.push_back(aSynchronMode); aSynchronMode.Name = "SynchronMode";
aSynchronMode.Value <<= false;
aPropertyValuesVector.push_back(aSynchronMode);
}
int nView = SfxLokHelper::getView(); int nView = SfxLokHelper::getView();
if (nView < 0) if (nView < 0)
......
...@@ -18,6 +18,7 @@ namespace vcl ...@@ -18,6 +18,7 @@ namespace vcl
{ {
namespace lok namespace lok
{ {
bool VCL_DLLPUBLIC isUnipoll();
void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback, void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback,
LibreOfficeKitWakeCallback pWakeCallback, void* pData); LibreOfficeKitWakeCallback pWakeCallback, void* pData);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/Desktop.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <vcl/lok.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/commandevent.hxx> #include <vcl/commandevent.hxx>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
...@@ -313,7 +314,14 @@ namespace ...@@ -313,7 +314,14 @@ namespace
} }
pEvent->mnView = SfxLokHelper::getView(nullptr); 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));
} }
} }
......
...@@ -1675,6 +1675,12 @@ void registerPollCallbacks( ...@@ -1675,6 +1675,12 @@ void registerPollCallbacks(
} }
} }
bool isUnipoll()
{
ImplSVData * pSVData = ImplGetSVData();
return pSVData && pSVData->mpPollClosure != nullptr;
}
} } // namespace lok, namespace vcl } } // namespace lok, namespace vcl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment