[gtk+] treeview: Clip to bin window size when drawing bin window



commit b40aeb7ab463b200d1e05ff77c1654b7636ec95f
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 1 00:03:03 2016 +0100

    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 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 010d094..bc6aa74 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)


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