[gtk+/wip/cosimoc/scrolledwin-gadget: 2/4] cssgadget: always shify by widget allocation when rendering background



commit 29a92d5b30241b6205d959f30826f0f690dee5e0
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 23 11:59:42 2015 -0800

    cssgadget: always shify by widget allocation when rendering background
    
    This matches what other widgets do when e.g. gtk_render_background() and
    gtk_render_frame() are called with x/y = 0.
    
    We need to fix GtkMenu to add allocation to its arrow gadgets now to
    compensate.

 gtk/gtkcssgadget.c |    2 +-
 gtk/gtkmenu.c      |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssgadget.c b/gtk/gtkcssgadget.c
index 7f8abb0..f308b6d 100644
--- a/gtk/gtkcssgadget.c
+++ b/gtk/gtkcssgadget.c
@@ -611,7 +611,7 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
 
   x =  priv->allocated_size.x;
   y =  priv->allocated_size.y;
-  if (priv->owner && !gtk_widget_get_has_window (priv->owner))
+  if (priv->owner)
     {
       GtkAllocation widget_alloc;
       gtk_widget_get_allocation (priv->owner, &widget_alloc);
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 43f20fe..7ef2634 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2854,8 +2854,8 @@ gtk_menu_size_allocate (GtkWidget     *widget,
 
   get_arrows_border (menu, &arrow_border);
 
-  arrow_allocation.x = x;
-  arrow_allocation.y = y;
+  arrow_allocation.x = allocation->x + x;
+  arrow_allocation.y = allocation->y + y;
   arrow_allocation.width = width;
   arrow_allocation.height = arrow_border.top;
 
@@ -2864,7 +2864,7 @@ gtk_menu_size_allocate (GtkWidget     *widget,
                              &arrow_allocation, -1,
                              &clip);
 
-  arrow_allocation.y = height - y - arrow_border.bottom;
+  arrow_allocation.y = allocation->y + y + height - arrow_border.bottom;
   arrow_allocation.height = arrow_border.bottom;
 
   if (priv->lower_arrow_visible)


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