From 0c6251d0d2b52cd49d63d7dcb61491f5c810ff33 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Tue, 11 Jan 2011 11:34:23 +0000 Subject: [PATCH] switch: allow the user to toggle the switch by clicking on the handle --- gtk/gtkswitch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index 28a5d8d468..6b9866e167 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -202,6 +202,15 @@ gtk_switch_button_release (GtkWidget *widget, return TRUE; } + /* toggle the switch if the handle was clicked but a drag had not been + * initiated */ + if (!priv->is_dragging && !priv->in_press) + { + gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active); + + return TRUE; + } + /* dragged toggle */ if (priv->is_dragging) {