summaryrefslogtreecommitdiff
path: root/gtk/gtkeventcontrollerscroll.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-12-26 20:04:07 -0500
committerMatthias Clasen <mclasen@redhat.com>2017-12-26 20:06:06 -0500
commit8c108490941d1000af5d8fc6d2c99782c5639369 (patch)
treea216ca9476b56eec80f2f4ec9d8725d597b9e2dd /gtk/gtkeventcontrollerscroll.c
parent8d9414c228a0d518581184cb80f28f0a5d1caedc (diff)
downloadgtk+-8c108490941d1000af5d8fc6d2c99782c5639369.tar.gz
Avoid excess notification for GdkEventControllerScroll::flags
We have a test that checks this, and it is the right thing to do.
Diffstat (limited to 'gtk/gtkeventcontrollerscroll.c')
-rw-r--r--gtk/gtkeventcontrollerscroll.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c
index 6bd35adb5c..7b3fe2b910 100644
--- a/gtk/gtkeventcontrollerscroll.c
+++ b/gtk/gtkeventcontrollerscroll.c
@@ -66,6 +66,7 @@
#include "gtkeventcontrollerscroll.h"
#include "gtktypebuiltins.h"
#include "gtkmarshalers.h"
+#include "gtkprivate.h"
#define SCROLL_CAPTURE_THRESHOLD_MS 150
@@ -210,7 +211,7 @@ gtk_event_controller_scroll_set_property (GObject *object,
switch (prop_id)
{
case PROP_FLAGS:
- scroll->flags = g_value_get_flags (value);
+ gtk_event_controller_scroll_set_flags (scroll, g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -373,7 +374,7 @@ gtk_event_controller_scroll_class_init (GtkEventControllerScrollClass *klass)
P_("Flags"),
GTK_TYPE_EVENT_CONTROLLER_SCROLL_FLAGS,
GTK_EVENT_CONTROLLER_SCROLL_NONE,
- G_PARAM_READWRITE);
+ GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEventControllerScroll::scroll-begin:
@@ -488,11 +489,11 @@ gtk_event_controller_scroll_set_flags (GtkEventControllerScroll *scroll,
{
g_return_if_fail (GTK_IS_EVENT_CONTROLLER_SCROLL (scroll));
- if (scroll->flags != flags)
- {
- scroll->flags = flags;
- g_object_notify (G_OBJECT (scroll), "flags");
- }
+ if (scroll->flags == flags)
+ return;
+
+ scroll->flags = flags;
+ g_object_notify_by_pspec (G_OBJECT (scroll), pspecs[PROP_FLAGS]);
}
/**