diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-04-17 16:23:39 +0100 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-04-23 02:59:45 +0200 |
commit | b34786d2774b261be48de92f65a5d0aa3c32b289 (patch) | |
tree | 0acaf342c3e93465777a0aeca0568bdaec3c1bc7 /include/LibreOfficeKit | |
parent | 9f32d341b80e1f1ffe28542f33003bfe5750639b (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/LibreOfficeKit')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 6 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 19 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitTypes.h | 6 |
3 files changed, 30 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 |