diff options
author | Timm Bäder <mail@baedert.org> | 2017-07-11 09:58:21 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:16 -0400 |
commit | 36ab70ddf5dbe993eb995bd9157f347258765922 (patch) | |
tree | 508f0ca9cf6b4fc990e88b0a5892b50f594890fe /gtk/gtkviewport.c | |
parent | 95bd58ac00ede771ca80684e143fffdc61ff2194 (diff) | |
download | gtk+-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/gtkviewport.c')
-rw-r--r-- | gtk/gtkviewport.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index e633844109..54ff2b1f48 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -98,8 +98,10 @@ static void gtk_viewport_get_property (GObject *object, static void gtk_viewport_destroy (GtkWidget *widget); static void gtk_viewport_snapshot (GtkWidget *widget, GtkSnapshot *snapshot); -static void gtk_viewport_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void gtk_viewport_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip); static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, gpointer data); static void viewport_set_adjustment (GtkViewport *viewport, @@ -503,12 +505,13 @@ gtk_viewport_snapshot (GtkWidget *widget, } static void -gtk_viewport_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +gtk_viewport_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip) { GtkViewport *viewport = GTK_VIEWPORT (widget); GtkViewportPrivate *priv = viewport->priv; - GtkAllocation clip = *allocation; GtkAdjustment *hadjustment = priv->hadjustment; GtkAdjustment *vadjustment = priv->vadjustment; GtkWidget *child; @@ -522,21 +525,19 @@ gtk_viewport_size_allocate (GtkWidget *widget, child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) { - GtkAllocation child_allocation; + GtkAllocation child_allocation, child_clip; child_allocation.x = allocation->x - gtk_adjustment_get_value (hadjustment); child_allocation.y = allocation->y - gtk_adjustment_get_value (vadjustment); child_allocation.width = gtk_adjustment_get_upper (hadjustment); child_allocation.height = gtk_adjustment_get_upper (vadjustment); - gtk_widget_size_allocate (child, &child_allocation); - gtk_widget_get_clip (child, &clip); + /* Explicitly ignore the child clip here. */ + gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip); } g_object_thaw_notify (G_OBJECT (hadjustment)); g_object_thaw_notify (G_OBJECT (vadjustment)); - - gtk_widget_set_clip (widget, &clip); } static void |