From e648f2c244dbdf2b65122ce0754ab7be71de7e42 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 1 Jul 2015 15:49:33 +0200 Subject: [PATCH] events: Ensure touchpad gesture events go through clutter They otherwise fall through paths that enable bypass_clutter, this is necessary so they can be picked by captured-event handlers along the actor hierarchy. https://bugzilla.gnome.org/show_bug.cgi?id=752248 --- src/core/events.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/core/events.c b/src/core/events.c index 5cd88b55a..4c6d33438 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -40,6 +40,13 @@ #endif #include "meta-surface-actor.h" +#define IS_GESTURE_EVENT(e) ((e)->type == CLUTTER_TOUCHPAD_SWIPE || \ + (e)->type == CLUTTER_TOUCHPAD_PINCH || \ + (e)->type == CLUTTER_TOUCH_BEGIN || \ + (e)->type == CLUTTER_TOUCH_UPDATE || \ + (e)->type == CLUTTER_TOUCH_END || \ + (e)->type == CLUTTER_TOUCH_CANCEL) + static MetaWindow * get_window_for_event (MetaDisplay *display, const ClutterEvent *event) @@ -265,15 +272,18 @@ meta_display_handle_event (MetaDisplay *display, if (window) { - if (!clutter_event_get_event_sequence (event)) - { - /* Swallow all non-touch events on windows that come our way. - * Touch events that reach here aren't yet in an accepted state, - * so Clutter must see them to maybe trigger gestures into - * recognition. - */ - bypass_clutter = TRUE; - } + /* Events that are likely to trigger compositor gestures should + * be known to clutter so they can propagate along the hierarchy. + * Gesture-wise, there's two groups of events we should be getting + * here: + * - CLUTTER_TOUCH_* with a touch sequence that's not yet accepted + * by the gesture tracker, these might trigger gesture actions + * into recognition. Already accepted touch sequences are handled + * directly by meta_gesture_tracker_handle_event(). + * - CLUTTER_TOUCHPAD_* events over windows. These can likewise + * trigger ::captured-event handlers along the way. + */ + bypass_clutter = !IS_GESTURE_EVENT (event); meta_window_handle_ungrabbed_event (window, event);