summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-05-04 09:03:04 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:11 -0400
commitb4e26e686dd36e1a3b22e97f1373cb72333b2595 (patch)
treeb1ce92a2307fb4b3962222180a1c5bdde94d268c
parentb29b807c3c6753a09a6910629a26ea71a8a76110 (diff)
downloadgtk+-b4e26e686dd36e1a3b22e97f1373cb72333b2595.tar.gz
checkbutton: Don't use parent button's gadget
check buttons showing their indicator still use the internal boxgadget and have therefore the wrong size, but this gets us closer.
-rw-r--r--gtk/gtkcheckbutton.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 5c29e2a40f..691b740d0d 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -197,18 +197,21 @@ gtk_check_button_measure (GtkWidget *widget,
int *natural_baseline)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
- GtkCssGadget *gadget;
if (priv->draw_indicator)
- gadget = priv->gadget;
+ {
+ gtk_css_gadget_get_preferred_size (priv->gadget,
+ orientation,
+ for_size,
+ minimum, natural,
+ minimum_baseline, natural_baseline);
+ }
else
- gadget = GTK_BUTTON (widget)->priv->gadget;
-
- gtk_css_gadget_get_preferred_size (gadget,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
+ {
+ GTK_WIDGET_CLASS (gtk_check_button_parent_class)->measure (widget, orientation, for_size,
+ minimum, natural,
+ minimum_baseline, natural_baseline);
+ }
}
static void
@@ -412,27 +415,19 @@ gtk_check_button_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
- GtkButton *button = GTK_BUTTON (widget);
- GtkCssGadget *gadget;
GdkRectangle clip;
if (priv->draw_indicator)
- gadget = priv->gadget;
+ {
+ gtk_css_gadget_allocate (priv->gadget,
+ allocation,
+ gtk_widget_get_allocated_baseline (widget),
+ &clip);
+ gtk_widget_set_clip (widget, &clip);
+ }
else
- gadget = button->priv->gadget;
-
- gtk_widget_set_allocation (widget, allocation);
- gtk_css_gadget_allocate (gadget,
- allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
-
- gtk_widget_set_clip (widget, &clip);
-
- if (gtk_widget_get_realized (widget))
{
- GtkAllocation border_allocation;
- gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+ GTK_WIDGET_CLASS (gtk_check_button_parent_class)->size_allocate (widget, allocation);
}
}