[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 23 09:42:24 PST 2015


 sw/inc/viewsh.hxx              |    1 +
 sw/source/core/view/viewsh.cxx |   10 +++++++---
 sw/source/core/view/vnew.cxx   |    2 ++
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 05df28f0404fb788c2d494ab3caea8842c0a7681
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 23 18:38:55 2015 +0100

    LOK: don't ignore all callback events when we're in the callback already
    
    There are two conflicting requirements here:
    
    - if there was an invalidation event, and PaintTile() is called due to
      that, then we're not interested in invalidation events generated by
      PaintTile() itself.
    - we do want other event types all the time like the cursor rectangle
    
    Change SwViewShell::libreOfficeKitCallback(), so that it doesn't ignore
    all callbacks when we're in the callback already, just the so far only
    problematic type: tile invalidation.
    
    Change-Id: Idcaedbbe0fe2b5b1aa9bafbfe33a81c8011fe148

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 25a50bc..3416f9b 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -197,6 +197,7 @@ protected:
 
     LibreOfficeKitCallback mpLibreOfficeKitCallback;
     void* mpLibreOfficeKitData;
+    bool mbInLibreOfficeKitCallback;
 
 public:
     TYPEINFO();
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 964cf83..4c17e95 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -125,6 +125,11 @@ void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac
 
 void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const
 {
+    if (mbInLibreOfficeKitCallback && nType == LOK_CALLBACK_INVALIDATE_TILES)
+        // Make sure no more invalidation events are issued when we're in the
+        // callback already.
+        return;
+
     if (mpLibreOfficeKitCallback)
         mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData);
 }
@@ -1778,8 +1783,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     OutputDevice *pSaveOut = mpOut;
     bool bTiledRendering = mbTiledRendering;
     mbTiledRendering = true;
-    LibreOfficeKitCallback pCallback = mpLibreOfficeKitCallback;
-    mpLibreOfficeKitCallback = 0;
+    mbInLibreOfficeKitCallback = true;
     mpOut = &rDevice;
 
     // resizes the virtual device so to contain the entrie context
@@ -1827,7 +1831,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
 
     // SwViewShell's output device tear down
     mpOut = pSaveOut;
-    mpLibreOfficeKitCallback = pCallback;
+    mbInLibreOfficeKitCallback = false;
     mbTiledRendering = bTiledRendering;
 
     static bool bDebug = getenv("SW_DEBUG_TILEDRENDERING") != 0;
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 6fef158..986bb3e 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -171,6 +171,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow,
     mbSelectAll(false),
     mpLibreOfficeKitCallback(0),
     mpLibreOfficeKitData(0),
+    mbInLibreOfficeKitCallback(false),
     mpPrePostOutDev(0), // #i72754#
     maPrePostMapMode()
 {
@@ -249,6 +250,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow,
     mbSelectAll(false),
     mpLibreOfficeKitCallback(0),
     mpLibreOfficeKitData(0),
+    mbInLibreOfficeKitCallback(false),
     mpPrePostOutDev(0), // #i72754#
     maPrePostMapMode()
 {


More information about the Libreoffice-commits mailing list