[gtk+/wip/baseline2] GtkButton: Fix y displacement with baseline alignment



commit 8f17db9b4a00a6edf53d75f5ff2496d275c4056d
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 22 12:00:00 2013 +0100

    GtkButton: Fix y displacement with baseline alignment
    
    We need to shift down the baseline too when displacing y.

 gtk/gtkbutton.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 5165ba4..d0b5711 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1651,6 +1651,10 @@ gtk_button_size_allocate (GtkWidget     *widget,
          child_allocation.height = child_allocation.height - (focus_width + focus_pad) * 2;
        }
 
+      baseline = gtk_widget_get_allocated_baseline (widget);
+      if (baseline != -1)
+       baseline -= child_allocation.y - allocation->y;
+
       if (priv->depressed)
        {
          gint child_displacement_x;
@@ -1667,9 +1671,6 @@ gtk_button_size_allocate (GtkWidget     *widget,
       child_allocation.width  = MAX (1, child_allocation.width);
       child_allocation.height = MAX (1, child_allocation.height);
 
-      baseline = gtk_widget_get_allocated_baseline (widget);
-      if (baseline != -1)
-       baseline -= child_allocation.y - allocation->y;
       gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
     }
 }


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