[gtk+] widget: Create render node with correct bounds



commit e96c485afae622ad12ab3cdb3534ae7d8ccde741
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 1 03:57:42 2016 +0100

    widget: Create render node with correct bounds
    
    We want a render node where (0,0) is the top left of the widget.
    However, we need to account for the clip origin not matching the
    allocation origin.

 gtk/gtkwidget.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 0293784..1fd5d7e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15624,12 +15624,15 @@ gtk_widget_create_render_node (GtkWidget   *widget,
                                const char  *name)
 {
   GskRenderNode *res = gsk_renderer_create_render_node (renderer);
-  GtkAllocation clip;
+  GtkAllocation clip, allocation;
   graphene_rect_t bounds;
 
   gtk_widget_get_clip (widget, &clip);
+  gtk_widget_get_allocation (widget, &allocation);
 
-  graphene_rect_init (&bounds, 0, 0, clip.width, clip.height);
+  graphene_rect_init (&bounds, 
+                      allocation.x - clip.x, allocation.y - clip.y,
+                      clip.width, clip.height);
 
   gsk_render_node_set_name (res, name);
   gsk_render_node_set_bounds (res, &bounds);


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