From 4dd0ca962c0875c3474feebeab3079aba1b17845 Mon Sep 17 00:00:00 2001 From: Michal Hruby Date: Mon, 3 Oct 2011 14:33:51 +0200 Subject: Fix bug #865122 --- src/idorange.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/idorange.c') diff --git a/src/idorange.c b/src/idorange.c index ba5c2c8..31d17ec 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -40,6 +40,8 @@ static void ido_range_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void ido_range_grab_notify (GtkWidget *widget, + gboolean was_grabbed); #define IDO_RANGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDO_TYPE_RANGE, IdoRangePrivate)) @@ -60,6 +62,8 @@ ido_range_class_init (IdoRangeClass *class) gobject_class->set_property = ido_range_set_property; gobject_class->get_property = ido_range_get_property; + widget_class->grab_notify = ido_range_grab_notify; + g_object_class_install_property (gobject_class, PROP_STYLE, g_param_spec_enum ("range-style", @@ -130,6 +134,12 @@ ido_range_set_property (GObject *object, } } +static void +ido_range_grab_notify (GtkWidget *widget, gboolean was_grabbed) +{ + g_return_if_fail (IDO_IS_RANGE (widget)); +} + static void ido_range_constructed (GObject *object) { -- cgit v1.2.3 From ae22267afe6a82527449c08fd10a29d66fb39d8c Mon Sep 17 00:00:00 2001 From: Michal Hruby Date: Mon, 3 Oct 2011 14:58:08 +0200 Subject: Use the grab-notify workaround only when using Gtk3 --- src/idorange.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/idorange.c') diff --git a/src/idorange.c b/src/idorange.c index 31d17ec..b11cb4e 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -40,8 +40,10 @@ static void ido_range_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +#ifdef USE_GTK3 static void ido_range_grab_notify (GtkWidget *widget, gboolean was_grabbed); +#endif #define IDO_RANGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDO_TYPE_RANGE, IdoRangePrivate)) @@ -62,7 +64,9 @@ ido_range_class_init (IdoRangeClass *class) gobject_class->set_property = ido_range_set_property; gobject_class->get_property = ido_range_get_property; +#ifdef USE_GTK3 widget_class->grab_notify = ido_range_grab_notify; +#endif g_object_class_install_property (gobject_class, PROP_STYLE, @@ -134,11 +138,21 @@ ido_range_set_property (GObject *object, } } +#ifdef USE_GTK3 static void ido_range_grab_notify (GtkWidget *widget, gboolean was_grabbed) { + /* + * FIXME: workaround for lp bug #865122. + * Without this handler, GtkRange will call remove_grab which results + * in an infinite loop of grab_notifies. + * + * The widget will still work properly, because grab-broken-event will get + * properly fired and internal state of GtkRange will be properly updated. + */ g_return_if_fail (IDO_IS_RANGE (widget)); } +#endif static void ido_range_constructed (GObject *object) -- cgit v1.2.3 From 81e42543c66291fc99681923df0066fa45cae6ae Mon Sep 17 00:00:00 2001 From: Michal Hruby Date: Mon, 3 Oct 2011 15:27:13 +0200 Subject: And we need to include config.h --- src/idorange.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/idorange.c') diff --git a/src/idorange.c b/src/idorange.c index b11cb4e..f25cf56 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -25,6 +25,7 @@ #include "idorange.h" #include "idotypebuiltins.h" +#include "config.h" struct _IdoRangePrivate { -- cgit v1.2.3 From 565816b6512db46bb00f0a90d3bffacc351af7cc Mon Sep 17 00:00:00 2001 From: Michal Hruby Date: Mon, 3 Oct 2011 16:49:54 +0200 Subject: Get rid of unnecessary check --- src/idorange.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/idorange.c') diff --git a/src/idorange.c b/src/idorange.c index f25cf56..7c55d47 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -151,7 +151,6 @@ ido_range_grab_notify (GtkWidget *widget, gboolean was_grabbed) * The widget will still work properly, because grab-broken-event will get * properly fired and internal state of GtkRange will be properly updated. */ - g_return_if_fail (IDO_IS_RANGE (widget)); } #endif -- cgit v1.2.3