[gtk+] box gadget: Don't allow shifting too far



commit 73307f78dc8a10a2db2a0979ec7ede40f367b781
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 22 22:49:01 2016 -0500

    box gadget: Don't allow shifting too far
    
    We don't want to let baseline adjustment shift the child
    out of the original allocation. This is purely a sanity
    measure - in practice, the baseline should always be bigger
    than the child_baseline.

 gtk/gtkboxgadget.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkboxgadget.c b/gtk/gtkboxgadget.c
index cf9cb73..ea18a21 100644
--- a/gtk/gtkboxgadget.c
+++ b/gtk/gtkboxgadget.c
@@ -314,7 +314,7 @@ gtk_box_gadget_allocate_child (GObject        *child,
               if (minimum_baseline >= 0 && baseline >= 0)
                 {
                   child_allocation.height = MIN(natural, allocation->height);
-                  child_allocation.y = allocation->y + baseline - minimum_baseline;
+                  child_allocation.y = allocation->y + MAX(0, baseline - minimum_baseline);
                   break;
                 }
             case GTK_ALIGN_CENTER:


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