From 0c6cfea81e99a815c35b1a0e908a29bc6dc424f1 Mon Sep 17 00:00:00 2001 From: Jon Nermut Date: Thu, 18 Jan 2018 20:38:00 +1100 Subject: iOS: add a temporarily exposed function that calls CallbackFlushHandler::Invoke in order to manually flush the callback queue. To be reverted once the callback problem is solved. Change-Id: I95273b8a01eec62f639edd6767f69e02a294d8aa Reviewed-on: https://gerrit.libreoffice.org/48101 Reviewed-by: jan iversen Tested-by: jan iversen --- desktop/source/lib/init.cxx | 18 ++++++++++++++++++ .../LibreOfficeLight/LOKit/Document.swift | 6 ++++++ .../LibreOfficeLight/LOKit/LOKitThread.swift | 10 ++++++++++ .../LibreOfficeLight/lokit-Bridging-Header.h | 2 ++ 4 files changed, 36 insertions(+) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5688dab671f6..db8a5c5142c9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3802,4 +3802,22 @@ static void lo_destroy(LibreOfficeKit* pThis) } +#ifdef IOS +extern "C" +{ +__attribute__((visibility("default"))) +{ + SolarMutexGuard aGuard; + LibLODocument_Impl* pDocument = static_cast(pThis); + + int nOrigViewId = doc_getView(pThis); + + if (nOrigViewId >= 0 && pDocument->mpCallbackFlushHandlers[nOrigViewId]) + { + pDocument->mpCallbackFlushHandlers[nOrigViewId]->Invoke(); + } +} +} +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift index f708334f5c97..79e28d674595 100644 --- a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift @@ -536,6 +536,12 @@ open class Document { docClass.setViewLanguage(pDoc, id, language); } + + public func invokeHandlers() + { + temporaryHackToInvokeCallbackHandlers(pDoc) + + } } diff --git a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/LOKitThread.swift b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/LOKitThread.swift index 314ef0355f3f..e8f60e0f2119 100644 --- a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/LOKitThread.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/LOKitThread.swift @@ -212,6 +212,15 @@ public class DocumentHolder { closure(self.doc) } + self.invokeHandlers() + } + + public func invokeHandlers() + { + LOKitThread.instance.async + { + self.doc.invokeHandlers() + } } /// Gives sync access to the document - blocks until the closure runs. @@ -220,6 +229,7 @@ public class DocumentHolder { return LOKitThread.instance.sync { + self.invokeHandlers() return closure(self.doc) } } diff --git a/ios/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h b/ios/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h index bc276e9d31e2..67feadb801f3 100644 --- a/ios/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h +++ b/ios/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h @@ -12,3 +12,5 @@ // as its own xCode project. #define LOK_USE_UNSTABLE_API #import "../../source/LibreOfficeKit.h" + +void temporaryHackToInvokeCallbackHandlers(LibreOfficeKitDocument* pThis); -- cgit