summaryrefslogtreecommitdiff
path: root/gtk/gtkswitch.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-08-04 14:32:40 +0200
committerMatthias Clasen <mclasen@redhat.com>2014-08-04 14:36:42 +0200
commit1569952d0e97448edffdf60266272ff4a4a08bd8 (patch)
tree1755959bd89077e9c1fa2147fed2443e23c5d67c /gtk/gtkswitch.c
parent2e85046b8f96f4f751d6afa13ab220b4dab5c7f6 (diff)
downloadgtk+-1569952d0e97448edffdf60266272ff4a4a08bd8.tar.gz
GtkSwitch: Update handle_x in size-allocate
Since we are storing positions here that depend on the allocation, we need to update them in size-allocate. This fixes incorrect positioning of the handle if the switch is active initially. https://bugzilla.gnome.org/show_bug.cgi?id=734213
Diffstat (limited to 'gtk/gtkswitch.c')
-rw-r--r--gtk/gtkswitch.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index b1758061d0..28962d2a9b 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -474,6 +474,11 @@ gtk_switch_size_allocate (GtkWidget *widget,
allocation->width,
allocation->height);
+ if (priv->is_active)
+ priv->handle_x = gtk_widget_get_allocated_width (widget) / 2;
+ else
+ priv->handle_x = 0;
+
_gtk_widget_set_simple_clip (widget);
}