sw/source/uibase/utlui/content.cxx |    6 ++++++
 vcl/unx/gtk3/gtkinst.cxx           |    2 ++
 2 files changed, 8 insertions(+)

New commits:
commit d19d64b6a3e697fdbf7c0d05a318afddbc349bd4
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Fri Oct 7 02:18:05 2022 -0800
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Oct 10 20:46:44 2022 +0200

    tdf#151387 Fix regression cause by tdf#149279
    
    The gtk_tree_view_expand_to_path function not only expands all parent
    rows of path as necessary but also expands the children of the row of
    the path. This explains the difference seen between gtk3inst and
    salinst when a collapsed row is scrolled to. gtk3inst expands the
    collapsed row, salinst does not. The enhancement patch for tdf#149279
    removed the gtk_tree_view_expand_to_path function from
    gtk_tree_view_scroll_to_row. This caused a regression in the styles
    tree. To fix the regression this patch reverts the removed
    gtk_tree_view_expand_to_path functions. To make the enhancement patch
    behave the same for gtk3 and sal, the scroll to row is collapsed
    after scrolling if that was it's state before.
    
    conflicts:
        vcl/unx/gtk3/gtkinst.cxx
    
    Change-Id: I3c3975a3f258c6c432eb866a1c712299e2faf5be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141048
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    (cherry picked from commit 53d5f5e15c005d95fa8c9d24d98e26afd2ca2103)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141095
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index cf2c9eb569cc..851eb0f75dd0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3933,7 +3933,13 @@ void SwContentTree::UpdateTracking()
                             while (!weld::IsEntryVisible(*m_xTreeView, *xIter))
                                 m_xTreeView->iter_parent(*xIter);
                         }
+                        // Assure the scroll to row is collapsed after 
scrolling if it was collapsed
+                        // before. This is required here to make gtkinst 
scroll_to_row behave like
+                        // salinst.
+                        const bool bRowExpanded = 
m_xTreeView->get_row_expanded(*xIter);
                         m_xTreeView->scroll_to_row(*xIter);
+                        if (!bRowExpanded)
+                            m_xTreeView->collapse_row(*xIter);
                     }
                     bRet = true;
                 }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 690f39a50208..cd9bb63ae4ce 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -14946,6 +14946,7 @@ public:
         assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when 
frozen, select after thaw. Note selection doesn't survive a freeze");
         disable_notify_events();
         GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
+        gtk_tree_view_expand_to_path(m_pTreeView, path);
         gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();
@@ -15623,6 +15624,7 @@ public:
         disable_notify_events();
         const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
         GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, 
const_cast<GtkTreeIter*>(&rGtkIter.iter));
+        gtk_tree_view_expand_to_path(m_pTreeView, path);
         gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();

Reply via email to