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.
This commit is contained in:
Benjamin Otte 2016-11-01 00:03:03 +01:00
parent b3e5c31b08
commit b40aeb7ab4

View File

@ -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)