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

New commits:
commit 53d5f5e15c005d95fa8c9d24d98e26afd2ca2103
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Fri Oct 7 02:18:05 2022 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Oct 8 02:18:24 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.
    
    Change-Id: I3c3975a3f258c6c432eb866a1c712299e2faf5be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141048
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 9e3984333715..1605a470d438 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3997,7 +3997,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 f0ba23618dcb..a50f98c31ee5 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -15199,6 +15199,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, true, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();
@@ -15900,6 +15901,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, true, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();

Reply via email to