vcl/source/app/salvtables.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 0f2bddacae89a50c1349e2511c3b60c7c7120aad
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Nov 9 16:05:43 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Nov 9 21:19:45 2020 +0100

    tdf#136962 only do implicit SetUpdateMode optimization if the widget is 
hidden
    
    callers can always opt-in with freeze/thaw for the lesser optimization
    available if shown
    
    Change-Id: Ib9317451a3059cc33f70d0c23543d8024bd21ede
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105487
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 61a1e52211c3..fd9b2777db41 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3336,7 +3336,9 @@ static SalInstanceTreeView* g_DragSource;
 
 namespace
 {
-    class UpdateGuard
+    // tdf#131581 if the TreeView is hidden then there are possibly additional
+    // optimizations available
+    class UpdateGuardIfHidden
     {
     private:
         SvTabListBox& m_rTreeView;
@@ -3344,10 +3346,11 @@ namespace
         bool m_bOrigEnableInvalidate;
 
     public:
-        UpdateGuard(SvTabListBox& rTreeView)
+        UpdateGuardIfHidden(SvTabListBox& rTreeView)
             : m_rTreeView(rTreeView)
-            , m_bOrigUpdate(m_rTreeView.IsUpdateMode())
-            // tdf#137432 only do the EnableInvalidate(false) optimization if 
the widget is currently hidden
+            // tdf#136962 only do SetUpdateMode(false) optimization if the 
widget is currently hidden
+            , m_bOrigUpdate(!m_rTreeView.IsVisible() && 
m_rTreeView.IsUpdateMode())
+            // tdf#137432 only do EnableInvalidate(false) optimization if the 
widget is currently hidden
             , m_bOrigEnableInvalidate(!m_rTreeView.IsVisible() && 
m_rTreeView.GetModel()->IsEnableInvalidate())
         {
             if (m_bOrigUpdate)
@@ -3356,7 +3359,7 @@ namespace
                 m_rTreeView.GetModel()->EnableInvalidate(false);
         }
 
-        ~UpdateGuard()
+        ~UpdateGuardIfHidden()
         {
             if (m_bOrigEnableInvalidate)
                 m_rTreeView.GetModel()->EnableInvalidate(true);
@@ -4594,7 +4597,7 @@ public:
 
     virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) 
override
     {
-        UpdateGuard aGuard(*m_xTreeView);
+        UpdateGuardIfHidden aGuard(*m_xTreeView);
 
         SalInstanceTreeIter aVclIter(m_xTreeView->First());
         while (aVclIter.iter)
@@ -4607,7 +4610,7 @@ public:
 
     virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& 
func) override
     {
-        UpdateGuard aGuard(*m_xTreeView);
+        UpdateGuardIfHidden aGuard(*m_xTreeView);
 
         SalInstanceTreeIter aVclIter(m_xTreeView->FirstSelected());
         while (aVclIter.iter)
@@ -4620,7 +4623,7 @@ public:
 
     virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& 
func) override
     {
-        UpdateGuard aGuard(*m_xTreeView);
+        UpdateGuardIfHidden aGuard(*m_xTreeView);
 
         SalInstanceTreeIter aVclIter(m_xTreeView->GetFirstEntryInView());
         while (aVclIter.iter)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to