From b40aeb7ab463b200d1e05ff77c1654b7636ec95f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 1 Nov 2016 00:03:03 +0100 Subject: [PATCH] treeview: Clip to bin window size when drawing bin window This ensures that the drawing does not extend the actually drawn area. It also ensures that our math is sane, because the math assumes the clip area cannot extend the window. After all, before GTK4 it always was like that. Fixes a bunch of drawing bugs when the clip area does indeed extend too far. --- gtk/gtktreeview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 010d09476b..bc6aa74fa5 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -4944,13 +4944,13 @@ gtk_tree_view_bin_draw (GtkWidget *widget, bin_window_width = gdk_window_get_width (tree_view->priv->bin_window); bin_window_height = gdk_window_get_height (tree_view->priv->bin_window); + cairo_rectangle (cr, 0, 0, bin_window_width, bin_window_height); + cairo_clip (cr); + if (!gdk_cairo_get_clip_rectangle (cr, &clip)) return TRUE; new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, clip.y); - - if (new_y < 0) - new_y = 0; y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node); if (gtk_tree_view_get_height (tree_view) < bin_window_height)