diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-09 16:05:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-09 21:19:45 +0100 |
commit | 0f2bddacae89a50c1349e2511c3b60c7c7120aad (patch) | |
tree | e59a3020a5f96c06c59abc144aa8222c9e4204c7 | |
parent | 563f3e31268b1540a7b76889e8c558de87e5bc95 (diff) |
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 <caolanm@redhat.com>
-rw-r--r-- | vcl/source/app/salvtables.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
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) |