summaryrefslogtreecommitdiff
path: root/gtk/gtkstack.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-07-11 09:58:21 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:16 -0400
commit36ab70ddf5dbe993eb995bd9157f347258765922 (patch)
tree508f0ca9cf6b4fc990e88b0a5892b50f594890fe /gtk/gtkstack.c
parent95bd58ac00ede771ca80684e143fffdc61ff2194 (diff)
downloadgtk+-36ab70ddf5dbe993eb995bd9157f347258765922.tar.gz
widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well change the size-allocate signature to include a out_clip parameter, just like GtkCssGadget did. And since we now always propagate baselines, we might as well pass that one on to size-allocate. This way we can also make sure to transform the clip returned from size-allocate to parent-coordinates, i.e. the same coordinate space priv->allocation is in.
Diffstat (limited to 'gtk/gtkstack.c')
-rw-r--r--gtk/gtkstack.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index b1d515a9a3..b77bde2cf6 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -168,8 +168,10 @@ static void gtk_stack_forall (GtkContainer *contain
static void gtk_stack_compute_expand (GtkWidget *widget,
gboolean *hexpand,
gboolean *vexpand);
-static void gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_stack_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_stack_measure (GtkWidget *widget,
@@ -2027,12 +2029,13 @@ gtk_stack_snapshot (GtkWidget *widget,
}
static void
-gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
GtkAllocation child_allocation;
@@ -2052,10 +2055,8 @@ gtk_stack_size_allocate (GtkWidget *widget,
&min, &nat, NULL, NULL);
child_allocation.height = MAX (min, allocation->height);
- gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->last_visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
-
+ gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (!gdk_rectangle_equal (&priv->last_visible_surface_allocation,
&child_allocation))
@@ -2100,12 +2101,9 @@ gtk_stack_size_allocate (GtkWidget *widget,
child_allocation.x = (allocation->height - child_allocation.height);
}
- gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
#define LERP(a, b, t) ((a) + (((b) - (a)) * (1.0 - (t))))