summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-01-06 10:48:18 -0500
committerAndras Timar <andras.timar@collabora.com>2017-02-17 16:37:01 +0100
commit58c58b049dd79108ae1dc223b4a336c3655c616d (patch)
tree45fff83d43fdef77595afd0d018bff8e9a04841d /desktop
parent9f3e57e5fa31ca5654ee9eeaba03c871a1c83150 (diff)
Lok: support for batch API calls
Mouse and keyboard operations typically come in batches, and often each results in tile invalidations and/or layout modifications. Processing each input event on its own, then processing the resulting output event is very costly and unecessary when we know there is more of the same. The new API adds support for batching such related input events by disabling the output events generated by Core until the batch is done. The client can then process the resulting events, which will be compressed and deduplicated. Change-Id: Id381dab807186d010021a8778ee440074a739920 Reviewed-on: https://gerrit.libreoffice.org/33402 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> (cherry picked from commit 1c27286b9d5331634c073cd3e327bd941e61bbb6)
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/lib/init.hxx4
-rw-r--r--desktop/source/lib/init.cxx26
2 files changed, 30 insertions, 0 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 302f54de5391..bfe9954c3308 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -41,6 +41,10 @@ namespace desktop {
void setEventLatch(const bool bEventLatch)
{
m_bEventLatch = bEventLatch;
+ if (!IsActive())
+ {
+ Start();
+ }
}
bool isEventLatchOn() const { return m_bEventLatch; }
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 268f37286213..92e3485b57fb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -532,6 +532,8 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
int* pFontWidth,
int* pFontHeight);
static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
+static void doc_beginBatch(LibreOfficeKitDocument* pThis);
+static void doc_endBatch(LibreOfficeKitDocument* pThis);
LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
: mxComponent(xComponent)
@@ -578,6 +580,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->renderFont = doc_renderFont;
m_pDocumentClass->getPartHash = doc_getPartHash;
+ m_pDocumentClass->beginBatch = doc_beginBatch;
+ m_pDocumentClass->endBatch = doc_endBatch;
gDocumentClass = m_pDocumentClass;
}
@@ -2696,6 +2700,28 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/,
return nullptr;
}
+static void doc_beginBatch(LibreOfficeKitDocument* pThis)
+{
+ SolarMutexGuard aGuard;
+
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+ for (const auto& pair : pDocument->mpCallbackFlushHandlers)
+ {
+ pair.second->setEventLatch(true);
+ }
+}
+
+static void doc_endBatch(LibreOfficeKitDocument* pThis)
+{
+ SolarMutexGuard aGuard;
+
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+ for (const auto& pair : pDocument->mpCallbackFlushHandlers)
+ {
+ pair.second->setEventLatch(false);
+ }
+}
+
static char* lo_getError (LibreOfficeKit *pThis)
{
SolarMutexGuard aGuard;