summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-04-17 16:23:39 +0100
committerAshod Nakashian <ashnakash@gmail.com>2019-04-23 02:59:45 +0200
commitb34786d2774b261be48de92f65a5d0aa3c32b289 (patch)
tree0acaf342c3e93465777a0aeca0568bdaec3c1bc7 /include
parent9f32d341b80e1f1ffe28542f33003bfe5750639b (diff)
Unipoll: add LibreOfficeKit API for polling, and an option to use it.
Change-Id: Iee7556ee52541ddbf1ef8f31e1ed4697f805a2ac Reviewed-on: https://gerrit.libreoffice.org/70898 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h6
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx19
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitTypes.h6
-rw-r--r--include/vcl/lok.hxx28
4 files changed, 58 insertions, 1 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 0e596f5067ba..f2c8dd40f1b3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -104,6 +104,12 @@ struct _LibreOfficeKitClass
const int nCertificateBinarySize,
const unsigned char* pPrivateKeyBinary,
const int nPrivateKeyBinarySize);
+
+ /// @see lok::Office::runLoop()
+ void (*runLoop) (LibreOfficeKit* pThis,
+ LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback,
+ 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 bd678b0b81d0..6bebf36611dd 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -644,7 +644,6 @@ public:
{
return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset);
}
-
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
@@ -819,6 +818,24 @@ public:
pCertificateBinary, nCertificateBinarySize,
pPrivateKeyBinary, nPrivateKeyBinarySize);
}
+
+ /**
+ * Runs the main-loop in the current thread. To trigger this
+ * mode you need to putenv a SAL_LOK_OPTIONS containing 'unipoll'.
+ * The @pPollCallback is called to poll for events from the Kit client
+ * and the @pWakeCallback can be called by internal LibreOfficeKit threads
+ * to wake the caller of 'runLoop' ie. the main thread.
+ *
+ * it is expected that runLoop does not return until Kit exit.
+ *
+ * @pData is a context/closure passed to both methods.
+ */
+ void runLoop(LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback,
+ void* pData)
+ {
+ mpThis->pClass->runLoop(mpThis, pPollCallback, pWakeCallback, pData);
+ }
};
/// Factory method to create a lok::Office instance.
diff --git a/include/LibreOfficeKit/LibreOfficeKitTypes.h b/include/LibreOfficeKit/LibreOfficeKitTypes.h
index 2e9078ff4e98..e12ddad19161 100644
--- a/include/LibreOfficeKit/LibreOfficeKitTypes.h
+++ b/include/LibreOfficeKit/LibreOfficeKitTypes.h
@@ -22,6 +22,12 @@ extern "C"
*/
typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
+/** @see lok::Office::runLoop().
+ @since LibreOffice 6.3
+ */
+typedef int (*LibreOfficeKitPollCallback)(void* pData, int timeoutUs);
+typedef void (*LibreOfficeKitWakeCallback)(void* pData);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx
new file mode 100644
index 000000000000..5c30b6290221
--- /dev/null
+++ b/include/vcl/lok.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_LOK_HXX
+#define INCLUDED_VCL_LOK_HXX
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+
+namespace vcl
+{
+namespace lok
+{
+void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback,
+ LibreOfficeKitWakeCallback pWakeCallback, void* pData);
+}
+}
+
+#endif // INCLUDE_VCL_LOK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */