summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-07-09 18:55:32 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-08-12 23:20:25 +0200
commit3808322f80e322195165a8162d9c8765a68bcc52 (patch)
tree8722b6f9a25317095beaf362462f6181db800d90 /gtk
parent777ac92862529d9b9065a2f9e86f055bbfdd4b61 (diff)
downloadgtk+-3808322f80e322195165a8162d9c8765a68bcc52.tar.gz
eventcontroller: Add private ::filter method
This will be used right before handle_event() in order to filter out events, useful to make the previous "no touchpad events" behavior the default, and have gesture subclasses include manually the touchpad events they handle.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkeventcontroller.c4
-rw-r--r--gtk/gtkeventcontrollerprivate.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c
index a5cfde1e3e..5449846371 100644
--- a/gtk/gtkeventcontroller.c
+++ b/gtk/gtkeventcontroller.c
@@ -145,6 +145,7 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ klass->filter_event = gtk_event_controller_handle_event_default;
klass->handle_event = gtk_event_controller_handle_event_default;
object_class->set_property = gtk_event_controller_set_property;
@@ -218,6 +219,9 @@ gtk_event_controller_handle_event (GtkEventController *controller,
controller_class = GTK_EVENT_CONTROLLER_GET_CLASS (controller);
+ if (controller_class->filter_event (controller, event))
+ return retval;
+
if (controller_class->handle_event)
{
g_object_ref (controller);
diff --git a/gtk/gtkeventcontrollerprivate.h b/gtk/gtkeventcontrollerprivate.h
index 603da71a7d..2f66ecccbc 100644
--- a/gtk/gtkeventcontrollerprivate.h
+++ b/gtk/gtkeventcontrollerprivate.h
@@ -36,6 +36,9 @@ struct _GtkEventControllerClass
void (* reset) (GtkEventController *controller);
/*<private>*/
+
+ gboolean (* filter_event) (GtkEventController *controller,
+ const GdkEvent *event);
gpointer padding[10];
};