[Libreoffice-commits] core.git: include/vcl sc/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 9 18:55:41 UTC 2021


 include/vcl/weld.hxx           |    6 ++++++
 sc/source/ui/view/viewfun2.cxx |   12 +++++-------
 sc/source/ui/view/viewfunc.cxx |    3 +--
 vcl/unx/gtk3/gtk3gtkinst.cxx   |   12 +++++++++++-
 4 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 4db804df44b1b4cb9512e02aaac8d45e986a03eb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 9 15:24:10 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 9 20:54:56 2021 +0200

    enable set_busy_cursor to stack up in the gtk version too
    
    Change-Id: Ib9f8ee5af3e40c7563561d0eebc59f4a4fafcfa4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113888
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0ecea6e3fb54..ee26ea3423a7 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -287,6 +287,12 @@ public:
     virtual void freeze() = 0;
     virtual void thaw() = 0;
 
+    /* push/pop busy mouse cursor state
+
+      bBusy of true to push a busy state onto the stack and false
+      to pop it off, calls to this should balance.
+
+      see weld::WaitObject */
     virtual void set_busy_cursor(bool bBusy) = 0;
 
     virtual void queue_resize() = 0;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 43021d09c02d..6182277d3833 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -38,7 +38,6 @@
 #include <svx/svdview.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
-#include <vcl/waitobj.hxx>
 #include <osl/diagnose.h>
 
 #include <viewfunc.hxx>
@@ -895,8 +894,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
     }
 
     //  Insert via PasteFromClip
-
-    WaitObject aWait( GetFrameWin() );
+    weld::WaitObject aWait(GetViewData().GetDialogParent());
 
     ScAddress aPos( nCol, nRow, nTab );
 
@@ -2347,7 +2345,7 @@ void ScViewFunc::InsertTables(std::vector<OUString>& aNames, SCTAB nTab,
     if (bRecord && !rDoc.IsUndoEnabled())
         bRecord = false;
 
-    WaitObject aWait( GetFrameWin() );
+    weld::WaitObject aWait(GetViewData().GetDialogParent());
 
     if (bRecord)
     {
@@ -2388,7 +2386,7 @@ bool ScViewFunc::AppendTable( const OUString& rName, bool bRecord )
     if (bRecord && !rDoc.IsUndoEnabled())
         bRecord = false;
 
-    WaitObject aWait( GetFrameWin() );
+    weld::WaitObject aWait(GetViewData().GetDialogParent());
 
     if (bRecord)
         rDoc.BeginDrawUndo();                          //  InsertTab creates a SdrUndoNewPage
@@ -2435,7 +2433,7 @@ void ScViewFunc::DeleteTables( const SCTAB nTab, SCTAB nSheets )
     ScDocument& rDoc    = pDocSh->GetDocument();
     bool bVbaEnabled = rDoc.IsInVBAMode();
     SCTAB       nNewTab = nTab;
-    WaitObject aWait( GetFrameWin() );
+    weld::WaitObject aWait(GetViewData().GetDialogParent());
 
     while ( nNewTab > 0 && !rDoc.IsVisible( nNewTab ) )
         --nNewTab;
@@ -2474,7 +2472,7 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord )
     ScDocument& rDoc    = pDocSh->GetDocument();
     bool bVbaEnabled = rDoc.IsInVBAMode();
     SCTAB       nNewTab = TheTabs.front();
-    WaitObject aWait( GetFrameWin() );
+    weld::WaitObject aWait(GetViewData().GetDialogParent());
     if (bRecord && !rDoc.IsUndoEnabled())
         bRecord = false;
     if ( bVbaEnabled )
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index bef26c640673..e772f906303f 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -34,7 +34,6 @@
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/virdev.hxx>
-#include <vcl/waitobj.hxx>
 #include <stdlib.h>
 #include <unotools/charclass.hxx>
 #include <vcl/uitest/logger.hxx>
@@ -1830,7 +1829,7 @@ void ScViewFunc::DeleteMulti( bool bRows )
 
     //  proceed
 
-    WaitObject aWait( GetFrameWin() );      // important for TrackFormulas in UpdateReference
+    weld::WaitObject aWait(GetViewData().GetDialogParent());      // important for TrackFormulas in UpdateReference
 
     ResetAutoSpellForContentChange();
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 10df2ee6e317..5ee5a9bf0bb3 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2109,6 +2109,7 @@ protected:
 private:
     bool m_bTakeOwnership;
     bool m_bDraggedOver;
+    int m_nWaitCount;
     sal_uInt16 m_nLastMouseButton;
     sal_uInt16 m_nLastMouseClicks;
     int m_nPressedButton;
@@ -2480,6 +2481,7 @@ public:
         , m_pBuilder(pBuilder)
         , m_bTakeOwnership(bTakeOwnership)
         , m_bDraggedOver(false)
+        , m_nWaitCount(0)
         , m_nLastMouseButton(0)
         , m_nLastMouseClicks(0)
         , m_nPressedButton(-1)
@@ -3021,7 +3023,15 @@ public:
 
     virtual void set_busy_cursor(bool bBusy) override
     {
-        set_cursor(m_pWidget, bBusy ? "progress" : nullptr);
+        if (bBusy)
+            ++m_nWaitCount;
+        else
+            --m_nWaitCount;
+        if (m_nWaitCount == 1)
+            set_cursor(m_pWidget, "progress");
+        else if (m_nWaitCount == 0)
+            set_cursor(m_pWidget, nullptr);
+        assert (m_nWaitCount >= 0);
     }
 
     virtual void queue_resize() override


More information about the Libreoffice-commits mailing list