summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-16 15:55:43 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-16 14:33:41 +0000
commita93217908d12ab9e34052a52dfd59d87fca75e52 (patch)
treefc515ceb9d803fa5196cc6c01bf9041cccb1ec5d /desktop
parent90fa0d8f1a00c690d5199129d26fbe6ee4762972 (diff)
sw lok: move filtering of callbacks during paint to desktop
This will be important when in the per-view case SwViewShell::libreOfficeKitCallback() won't be called anymore; as pointed out by online.git's TileCacheTests::testSimpleCombine() test. Change-Id: Ie68f8c51facdba127763df660e9220f820805ecc Reviewed-on: https://gerrit.libreoffice.org/26372 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/lib/init.hxx3
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx9
3 files changed, 11 insertions, 4 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 2f18223793cc..815f1ac6b4da 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -30,7 +30,7 @@ namespace desktop {
class DESKTOP_DLLPUBLIC CallbackFlushHandler : public Idle
{
public:
- explicit CallbackFlushHandler(LibreOfficeKitCallback pCallback, void* pData);
+ explicit CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData);
virtual ~CallbackFlushHandler();
virtual void Invoke() override;
static void callback(const int type, const char* payload, void* data);
@@ -44,6 +44,7 @@ namespace desktop {
std::vector<std::pair<int, std::string>> m_queue;
std::map<int, std::string> m_states;
+ LibreOfficeKitDocument* m_pDocument;
LibreOfficeKitCallback m_pCallback;
void *m_pData;
bool m_bPartTilePainting;
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index bdda55ea7b7d..3fd66343a424 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1277,8 +1277,9 @@ static void callbackCompressionTest(const int type, const char* payload, void* d
void DesktopLOKTest::testNotificationCompression()
{
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
std::vector<std::tuple<int, std::string>> notifs;
- std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(callbackCompressionTest, &notifs));
+ std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->queue(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, ""); // 0
handler->queue(LOK_CALLBACK_TEXT_SELECTION, "15 25 15 10"); // Superseeded.
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 051362d8b739..5237d2942a4e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -430,8 +430,9 @@ LibLODocument_Impl::~LibLODocument_Impl()
mxComponent->dispose();
}
-CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitCallback pCallback, void* pData)
+CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData)
: Idle( "lokit timer callback" ),
+ m_pDocument(pDocument),
m_pCallback(pCallback),
m_pData(pData),
m_bPartTilePainting(false)
@@ -498,6 +499,10 @@ void CallbackFlushHandler::queue(const int type, const char* data)
//SAL_WARN("lokevt", "Skipping while painting [" + std::to_string(type) + "]: [" + payload + "].");
return;
}
+
+ // In Writer we drop all notifications during painting.
+ if (doc_getDocumentType(m_pDocument) == LOK_DOCTYPE_TEXT)
+ return;
}
// Supress invalid payloads.
@@ -1338,7 +1343,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0;
- pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pCallback, pData));
+ pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pThis, pCallback, pData));
if (comphelper::LibreOfficeKit::isViewCallback())
{