summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2016-09-10 18:53:55 +0000
committerMarco Cecchetti <mrcekets@gmail.com>2016-09-10 18:57:25 +0000
commita3018b02db3ce92387ccbab274ff1f29dd58f8b3 (patch)
treec8ad6ec79d0ca2fbdf0ab8f659a13f11ca316c83
parent404feac7e9212c57124a1e6219b6d6125c2bbd14 (diff)
Revert "LOK: we use callbacks latch for not missing messages sent very early"
This reverts commit 404feac7e9212c57124a1e6219b6d6125c2bbd14. Change-Id: I3d546d31111a119ce008f99fa77b087e32cbe7af Reviewed-on: https://gerrit.libreoffice.org/28810 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx22
-rw-r--r--desktop/source/lib/init.cxx24
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h7
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx16
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx4
5 files changed, 19 insertions, 54 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 9080f4aba333..5485da30cb67 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -365,7 +365,7 @@ void DesktopLOKTest::testSearchCalc()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("search.ods");
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
@@ -400,7 +400,7 @@ void DesktopLOKTest::testSearchAllNotificationsCalc()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("search.ods");
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
@@ -684,7 +684,7 @@ void DesktopLOKTest::testCommandResult()
CPPUNIT_ASSERT(m_aCommandResult.isEmpty());
// but we get some real values when the callback is set up
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
m_aCommandResultCondition.reset();
pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", nullptr, true);
@@ -703,7 +703,7 @@ void DesktopLOKTest::testWriterComments()
{
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
uno::Reference<awt::XReschedule> xToolkit(com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY);
// Insert a comment at the beginning of the document and wait till the main
@@ -747,7 +747,7 @@ void DesktopLOKTest::testModifiedStatus()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
// Type "t" and check that the document was set as modified
m_bModified = false;
@@ -811,10 +811,10 @@ void DesktopLOKTest::testTrackChanges()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
pDocument->pClass->createView(pDocument);
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
Scheduler::ProcessEventsToIdle();
// Enable trak changes and assert that both views get notified.
@@ -864,7 +864,7 @@ void DesktopLOKTest::testSheetSelections()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("sheets.ods", LOK_DOCTYPE_SPREADSHEET);
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
/*
* Check if selection data is correct
@@ -1025,7 +1025,7 @@ void DesktopLOKTest::testContextMenuCalc()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("sheets.ods", LOK_DOCTYPE_SPREADSHEET);
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
// Values in twips
int row5 = 1150;
@@ -1053,7 +1053,7 @@ void DesktopLOKTest::testContextMenuWriter()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt", LOK_DOCTYPE_TEXT);
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
Point aRandomPoint(1150, 1100);
pDocument->pClass->postMouseEvent(pDocument,
@@ -1078,7 +1078,7 @@ void DesktopLOKTest::testContextMenuImpress()
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_presentation.odp", LOK_DOCTYPE_PRESENTATION);
pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this, /*callback latch*/ false);
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
Point aRandomPoint(1150, 1100);
pDocument->pClass->postMouseEvent(pDocument,
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 93d7c5d160ad..cb86a63d8ff6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -392,12 +392,10 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pHeight);
static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments);
-static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis,
- bool bCallbackLatch);
+
static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibreOfficeKitCallback pCallback,
- void* pData,
- bool bCallbackLatch = false);
+ void* pData);
static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
int nType,
int nCharCode,
@@ -470,7 +468,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getTileMode = doc_getTileMode;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
- m_pDocumentClass->setCallbackLatch = doc_setCallbackLatch;
m_pDocumentClass->registerCallback = doc_registerCallback;
m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
@@ -1561,22 +1558,9 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
}
}
-static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis, bool bCallbackLatch)
-{
- SolarMutexGuard aGuard;
- LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-
- int nView = SfxLokHelper::getView();
- if (nView < 0)
- return;
-
- if (pDocument->mpCallbackFlushHandlers[nView])
- pDocument->mpCallbackFlushHandlers[nView]->setEventLatch(bCallbackLatch);
-}
-
static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibreOfficeKitCallback pCallback,
- void* pData, bool bCallbackLatch)
+ void* pData)
{
SolarMutexGuard aGuard;
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
@@ -1612,8 +1596,6 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
if (pCallback != nullptr)
{
- pDocument->mpCallbackFlushHandlers[nView]->setEventLatch(bCallbackLatch);
-
size_t nId = nView;
for (const auto& pair : pDocument->mpCallbackFlushHandlers)
{
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index e03163f399af..81d65c1ace38 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -147,15 +147,10 @@ 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,
- bool bCallbackLatch);
+ void* pData);
/// @see lok::Document::postKeyEvent
void (*postKeyEvent) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 346671dc1679..aae5f3806a64 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -196,27 +196,15 @@ 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)
- {
- mpDoc->pClass->setCallbackLatch(mpDoc, 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, bool bCallbackLatch = false)
+ inline void registerCallback(LibreOfficeKitCallback pCallback, void* pData)
{
- mpDoc->pClass->registerCallback(mpDoc, pCallback, pData, bCallbackLatch);
+ mpDoc->pClass->registerCallback(mpDoc, pCallback, pData);
}
/**
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5e43e5ea62b1..1f7d33007117 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -913,7 +913,7 @@ static gboolean postDocumentLoad(gpointer pData)
std::unique_lock<std::mutex> aGuard(g_aLOKMutex);
priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, priv->m_aRenderingArguments.c_str());
priv->m_nViewId = priv->m_pDocument->pClass->getView(priv->m_pDocument);
- priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView, /*callback latch*/ false);
+ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView);
priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
priv->m_nParts = priv->m_pDocument->pClass->getParts(priv->m_pDocument);
aGuard.unlock();
@@ -2510,7 +2510,7 @@ static void lok_doc_view_finalize (GObject* object)
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
- priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, nullptr, nullptr, /*callback latch*/ false);
+ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, nullptr, nullptr);
aGuard.unlock();
if (priv->m_pDocument && priv->m_pDocument->pClass->getViews(priv->m_pDocument) > 1)