[gtk+/wip/garnacho/touchpad-gestures: 60/71] gtkgesture: Filter out touchpad events by default.



commit 3464d4ab73a10c9943463ece2f2db56a87c72787
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 9 19:04:59 2015 +0200

    gtkgesture: Filter out touchpad events by default.
    
    The gestures that don't want touchpad gesture events are majority,
    even those that want such events will only listen to subsets (eg.
    pinch, swipe,...).
    
    So it makes sense to ignore touchpad events by default, and let
    subclasses opt those in.

 gtk/gtkgesture.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 15111c5..521a723 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -562,6 +562,18 @@ gesture_within_window (GtkGesture *gesture,
 }
 
 static gboolean
+gtk_gesture_filter_event (GtkEventController *controller,
+                          const GdkEvent     *event)
+{
+  /* Even though GtkGesture handles these events, we want
+   * touchpad gestures disabled by default, it will be
+   * subclasses which punch the holes in for the events
+   * they can possibly handle.
+   */
+  return EVENT_IS_TOUCHPAD_GESTURE (event);
+}
+
+static gboolean
 gtk_gesture_handle_event (GtkEventController *controller,
                           const GdkEvent     *event)
 {
@@ -675,6 +687,7 @@ gtk_gesture_class_init (GtkGestureClass *klass)
   object_class->set_property = gtk_gesture_set_property;
   object_class->finalize = gtk_gesture_finalize;
 
+  controller_class->filter_event = gtk_gesture_filter_event;
   controller_class->handle_event = gtk_gesture_handle_event;
   controller_class->reset = gtk_gesture_reset;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]