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



commit 3e8c9749cd39443eae9710582d10640594feef66
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 826b741..ea78723 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -563,6 +563,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)
 {
@@ -676,6 +688,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]