summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-08-14 09:14:02 +0200
committerMiklos Vajna <vmiklos@collabora.com>2024-08-14 11:17:33 +0200
commita22fe103e7a26270b7213448c570400a563c18ba (patch)
tree90a80e9b0dff895a5ca3c76075c80c0c7d04255e /include
parentd27a88f4fed168068bce5fc36d0bf62301641e25 (diff)
Related: cool#9735 vcl lok: add an AnyInput() callback
Open the 300 pages bugdoc, paste a oneliner plain text content in a paragraph which is part of a numbered list, observe a 274 ms hang till layout is done for all pages, then we get an updated tile. This could be better, there is no such hang in the desktop case. What happens is that 1) vcl doesn't try to invoke the poll callback of the LOK client when there was a processed timer and 2) Writer layout doesn't try to split its work into pieces because the LOK client has no way to inform vcl that it has pending input events. Fix the first problem in this commit: add a new API that allows a LOK client to inform vcl that it has pending input events and use that SvpSalInstance::ImplYield(): if a LOK client has pending input events, then invoke the poll callback after each processed timer. For example, this allows the LOK client to process emitted callbacks between two idle layout jobs, word counting, etc. The second problem around Writer to use comphelper::LibreOfficeKit::anyInput() is not yet fixed. Change-Id: I2e39253bfc4d1b5546bc60eef9ff05ccdc0868b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171846 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx8
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitTypes.h3
-rw-r--r--include/comphelper/lok.hxx6
4 files changed, 21 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 8691d56131c6..0e14a349ddfa 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -154,6 +154,10 @@ struct _LibreOfficeKitClass
*/
char* (*extractDocumentStructureRequest)(LibreOfficeKit* pThis, const char* pFilePath,
const char* pFilter);
+
+ /// @see lok::Office::registerAnyInputCallback()
+ void (*registerAnyInputCallback)(LibreOfficeKit* pThis,
+ LibreOfficeKitAnyInputCallback pCallback, void* pData);
};
#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 238168ebdb3b..1e99d910ba0d 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -1272,6 +1272,14 @@ public:
{
return mpThis->pClass->extractDocumentStructureRequest(mpThis, pFilePath, pFilter);
}
+
+ /**
+ * Registers a callback that can determine if there are any pending input events.
+ */
+ void registerAnyInputCallback(LibreOfficeKitAnyInputCallback pCallback, void* pData)
+ {
+ return mpThis->pClass->registerAnyInputCallback(mpThis, pCallback, pData);
+ }
};
/// Factory method to create a lok::Office instance.
diff --git a/include/LibreOfficeKit/LibreOfficeKitTypes.h b/include/LibreOfficeKit/LibreOfficeKitTypes.h
index 8513ef75421d..a702a229834b 100644
--- a/include/LibreOfficeKit/LibreOfficeKitTypes.h
+++ b/include/LibreOfficeKit/LibreOfficeKitTypes.h
@@ -25,6 +25,9 @@ typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pD
typedef int (*LibreOfficeKitPollCallback)(void* pData, int timeoutUs);
typedef void (*LibreOfficeKitWakeCallback)(void* pData);
+/// @see lok::Office::registerAnyInputCallback()
+typedef bool (*LibreOfficeKitAnyInputCallback)(void* pData);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index f998c12dedc3..a497912c4a6f 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -10,6 +10,8 @@
#ifndef INCLUDED_COMPHELPER_LOK_HXX
#define INCLUDED_COMPHELPER_LOK_HXX
+#include <functional>
+
#include <comphelper/comphelperdllapi.h>
#include <rtl/ustring.hxx>
@@ -131,6 +133,10 @@ COMPHELPER_DLLPUBLIC void statusIndicatorSetValue(int percent);
COMPHELPER_DLLPUBLIC void statusIndicatorFinish();
COMPHELPER_DLLPUBLIC void setBlockedCommandList(const char* blockedCommandList);
+
+COMPHELPER_DLLPUBLIC void setAnyInputCallback(std::function<bool(void*)> pAnyInputCallback,
+ void* pData);
+COMPHELPER_DLLPUBLIC bool anyInput();
}
#endif // INCLUDED_COMPHELPER_LOK_HXX