diff options
author | Timm Bäder <mail@baedert.org> | 2018-08-16 06:53:03 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2018-11-13 16:28:54 +0100 |
commit | ade171a2ed1f868b13dd1f1cb221e6622b92e052 (patch) | |
tree | 19d911660e38043ee30b51e29548f7c9b72acdcc /gtk/gtkswitch.c | |
parent | 1f1306a53b7c496ba0694544bde71265110fe4ed (diff) | |
download | gtk+-ade171a2ed1f868b13dd1f1cb221e6622b92e052.tar.gz |
widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
Diffstat (limited to 'gtk/gtkswitch.c')
-rw-r--r-- | gtk/gtkswitch.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index b02c7fdd04..f8c235fe69 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -316,9 +316,10 @@ gtk_switch_measure (GtkWidget *widget, } static void -gtk_switch_size_allocate (GtkWidget *widget, - const GtkAllocation *allocation, - int baseline) +gtk_switch_size_allocate (GtkWidget *widget, + int width, + int height, + int baseline) { GtkSwitch *self = GTK_SWITCH (widget); GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self); @@ -326,29 +327,29 @@ gtk_switch_size_allocate (GtkWidget *widget, GtkAllocation slider_alloc; int min; - slider_alloc.x = round (priv->handle_pos * (allocation->width / 2)); + slider_alloc.x = round (priv->handle_pos * (width / 2)); slider_alloc.y = 0; - slider_alloc.width = allocation->width / 2; - slider_alloc.height = allocation->height; + slider_alloc.width = width / 2; + slider_alloc.height = height; gtk_widget_size_allocate (priv->slider, &slider_alloc, -1); /* Center ON label in left half */ gtk_widget_measure (priv->on_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL); - child_alloc.x = ((allocation->width / 2) - min) / 2; + child_alloc.x = ((width / 2) - min) / 2; child_alloc.width = min; gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL); - child_alloc.y = (allocation->height - min) / 2; + child_alloc.y = (height - min) / 2; child_alloc.height = min; gtk_widget_size_allocate (priv->on_label, &child_alloc, -1); /* Center OFF label in right half */ gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL); - child_alloc.x = (allocation->width / 2) + ((allocation->width / 2) - min) / 2; + child_alloc.x = (width / 2) + ((width / 2) - min) / 2; child_alloc.width = min; gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL); - child_alloc.y = (allocation->height - min) / 2; + child_alloc.y = (height - min) / 2; child_alloc.height = min; gtk_widget_size_allocate (priv->off_label, &child_alloc, -1); } |