[gtk/treeview-separator-fix-drawing-zero-height] treeview: make sure separator nodes have a height > 0



commit af6dd6bf359a0a43544efff2296ae6196484cdc8
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Mar 3 10:38:18 2019 +0100

    treeview: make sure separator nodes have a height > 0
    
    In case the theme doesn't set a height/min-height for the treeview
    separator the treeview drawing gets confused and draws rows on top of each
    other depending on the redraw area.
    
    This is due to gtk_tree_view_get_row_height() assuming that a node with a
    height <= 0 is not set and not a separator and it will default to the
    expander size.
    
    Ideally gtk_tree_view_get_row_height() would know if it operates on a separator,
    but there are too many calls/levels, so just make sure the separator height
    is at least 1 (Adwaita already sets "min-height: 2px", so no change there)

 gtk/gtktreeview.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index e5296108a1..a2f1b3b9e3 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -6395,6 +6395,8 @@ validate_row (GtkTreeView *tree_view,
       if (is_separator)
         {
           height = get_separator_height (tree_view);
+          /* gtk_tree_view_get_row_height() assumes separator nodes are > 0 */
+          height = MAX (height, 1);
         }
       else
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]