[Libreoffice-commits] core.git: desktop/inc desktop/qa desktop/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 16 14:34:12 UTC 2016


 desktop/inc/lib/init.hxx                    |    3 ++-
 desktop/qa/desktop_lib/test_desktop_lib.cxx |    3 ++-
 desktop/source/lib/init.cxx                 |    9 +++++++--
 sw/source/core/view/viewsh.cxx              |    3 ---
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit a93217908d12ab9e34052a52dfd59d87fca75e52
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 16 15:55:43 2016 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 2f18223..815f1ac 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 bdda55e..3fd6634 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 051362d..5237d29 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())
     {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 832283f..6e50009 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -124,9 +124,6 @@ void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac
 
 void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const
 {
-    if (mbInLibreOfficeKitCallback)
-        return;
-
     getIDocumentDrawModelAccess().GetDrawModel()->libreOfficeKitCallback(nType, pPayload);
 }
 


More information about the Libreoffice-commits mailing list