loolwsd/ChildSession.cpp | 2 ++ loolwsd/LOKitClient.cpp | 2 +- loolwsd/LOOLKit.cpp | 2 +- loolwsd/LibreOfficeKit.hpp | 16 ++++++++++++++-- loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h | 7 ++++++- 5 files changed, 24 insertions(+), 5 deletions(-)
New commits: commit f2106157f31801d96ac8fdf5e74956455ebbf778 Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Fri Sep 9 22:23:51 2016 +0200 loolwsd: we use callbacks latch for not missing messages sent very early - lok::Document::setCallbackLatch: used by a child session for set/unset the latch - lok::Document::registerCallback has a new boolean parameter used for setting the latch state just before the callback is actually registered for a (new) view - now cell cursors of other views are correctly notified to the new view diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp index 93a2312..93c4cf6 100644 --- a/loolwsd/ChildSession.cpp +++ b/loolwsd/ChildSession.cpp @@ -357,6 +357,8 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT // Inform this view of other views _docManager.notifyCurrentViewOfOtherViews(getId()); + _loKitDocument->setCallbackLatch(false); + Log::info("Loaded session " + getId()); return true; } diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp index b882b79..13a180e 100644 --- a/loolwsd/LOKitClient.cpp +++ b/loolwsd/LOKitClient.cpp @@ -112,7 +112,7 @@ protected: return Application::EXIT_UNAVAILABLE; } - loKitDocument->pClass->registerCallback(loKitDocument, myCallback, nullptr); + loKitDocument->pClass->registerCallback(loKitDocument, myCallback, nullptr, /*callback latch*/ false); loKitDocument->pClass->initializeForRendering(loKitDocument, nullptr); diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index 94c0846..261821b 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -1138,7 +1138,7 @@ private: viewId = _loKitDocument->getView(); _viewIdToCallbackDescr.emplace(viewId, std::unique_ptr<CallbackDescriptor>(new CallbackDescriptor({ this, viewId }))); - _loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get()); + _loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get(), /*callback latch*/ true); Log::info() << "Document [" << _url << "] view [" << viewId << "] loaded, leaving " diff --git a/loolwsd/LibreOfficeKit.hpp b/loolwsd/LibreOfficeKit.hpp index 5881c77..700db4b 100644 --- a/loolwsd/LibreOfficeKit.hpp +++ b/loolwsd/LibreOfficeKit.hpp @@ -214,15 +214,27 @@ public: } /** + * Enable/disable callbacks latch. LOK will set the latch when it wants to + * queue new callbacks but not flush them. + * + * @param bCallbackLatch: true enables the latch, false disables it. + */ + inline void setCallbackLatch(bool bCallbackLatch) + { + _pDoc->pClass->setCallbackLatch(_pDoc, bCallbackLatch); + } + + /** * Registers a callback. LOK will invoke this function when it wants to * inform the client about events. * * @param pCallback the callback to invoke * @param pData the user data, will be passed to the callback on invocation + * @param bCallbackLatch the event latch status to be set before the callback is registered */ - inline void registerCallback(LibreOfficeKitCallback pCallback, void* pData) + inline void registerCallback(LibreOfficeKitCallback pCallback, void* pData, bool bCallbackLatch = false) { - _pDoc->pClass->registerCallback(_pDoc, pCallback, pData); + _pDoc->pClass->registerCallback(_pDoc, pCallback, pData, bCallbackLatch); } /** diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h index 81d65c1..e03163f 100644 --- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h +++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h @@ -147,10 +147,15 @@ struct _LibreOfficeKitDocumentClass void (*initializeForRendering) (LibreOfficeKitDocument* pThis, const char* pArguments); + /// @see lok::Document::setCallbackLatch(). + void (*setCallbackLatch) (LibreOfficeKitDocument* pThis, + bool bCallbackLatch); + /// @see lok::Document::registerCallback(). void (*registerCallback) (LibreOfficeKitDocument* pThis, LibreOfficeKitCallback pCallback, - void* pData); + void* pData, + bool bCallbackLatch); /// @see lok::Document::postKeyEvent void (*postKeyEvent) (LibreOfficeKitDocument* pThis, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits