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/gtklabel.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/gtklabel.c')
-rw-r--r-- | gtk/gtklabel.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 5b5525f0fa..ab8ce36673 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -398,8 +398,10 @@ static void gtk_label_get_property (GObject *object, GParamSpec *pspec); static void gtk_label_finalize (GObject *object); static void gtk_label_destroy (GtkWidget *widget); -static void gtk_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void gtk_label_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip); static void gtk_label_state_flags_changed (GtkWidget *widget, GtkStateFlags prev_state); static void gtk_label_style_updated (GtkWidget *widget); @@ -3722,19 +3724,18 @@ gtk_label_get_ink_rect (GtkLabel *label, } static void -gtk_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +gtk_label_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip) { GtkLabel *label = GTK_LABEL (widget); GtkLabelPrivate *priv = label->priv; - GdkRectangle clip_rect; if (priv->layout) gtk_label_update_layout_width (label); - gtk_label_get_ink_rect (label, &clip_rect); - gdk_rectangle_union (&clip_rect, allocation, &clip_rect); - gtk_widget_set_clip (widget, &clip_rect); + gtk_label_get_ink_rect (label, out_clip); } static void |