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/gtkcheckmenuitem.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/gtkcheckmenuitem.c')
-rw-r--r-- | gtk/gtkcheckmenuitem.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index 24dd548b10..0987fc18fd 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -108,17 +108,21 @@ G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_IT G_ADD_PRIVATE (GtkCheckMenuItem)) static void -gtk_check_menu_item_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +gtk_check_menu_item_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip) { - GtkAllocation clip, widget_clip; + GtkAllocation child_clip; GtkAllocation indicator_alloc; GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget); GtkCheckMenuItemPrivate *priv = check_menu_item->priv; gint toggle_size; - GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate - (widget, allocation); + GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget, + allocation, + baseline, + out_clip); gtk_widget_measure (priv->indicator_widget, GTK_ORIENTATION_HORIZONTAL, @@ -140,14 +144,11 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget, indicator_alloc.y = (allocation->height - indicator_alloc.height) / 2; - gtk_widget_size_allocate_with_baseline (priv->indicator_widget, - &indicator_alloc, - gtk_widget_get_allocated_baseline (widget)); - gtk_widget_get_clip (priv->indicator_widget, &clip); - - gtk_widget_get_clip (widget, &widget_clip); - gdk_rectangle_union (&widget_clip, &clip, &widget_clip); - gtk_widget_set_clip (widget, &widget_clip); + gtk_widget_size_allocate (priv->indicator_widget, + &indicator_alloc, + baseline, + &child_clip); + gdk_rectangle_union (out_clip, &child_clip, out_clip); } static void |