From df384965c32ef3ca1cf6f0a65a074eeb0f40a1dc Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 13 Oct 2014 16:20:28 +0200 Subject: [PATCH] core: Unset "pointer emulating" sequence after event processing The set/unset branches of meta_display_update_pointer_emulating_sequence() have been split and put directly where it makes sense. The pointer emulated sequence will be updated before processing the CLUTTER_TOUCH_BEGIN, and after processing the CLUTTER_TOUCH_END, this way the checks on this hold true during all the sequence lifetime. https://bugzilla.gnome.org/show_bug.cgi?id=738411 --- src/core/events.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/core/events.c b/src/core/events.c index e0892d896..c20794bc4 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -151,23 +151,6 @@ sequence_is_pointer_emulated (MetaDisplay *display, return FALSE; } -static void -meta_display_update_pointer_emulating_sequence (MetaDisplay *display, - const ClutterEvent *event) -{ - ClutterEventSequence *sequence; - - sequence = clutter_event_get_event_sequence (event); - - if (event->type == CLUTTER_TOUCH_BEGIN && - !display->pointer_emulating_sequence && - sequence_is_pointer_emulated (display, event)) - display->pointer_emulating_sequence = sequence; - else if (event->type == CLUTTER_TOUCH_END && - display->pointer_emulating_sequence == sequence) - display->pointer_emulating_sequence = NULL; -} - static gboolean meta_display_handle_event (MetaDisplay *display, const ClutterEvent *event) @@ -176,8 +159,15 @@ meta_display_handle_event (MetaDisplay *display, gboolean bypass_clutter = FALSE; G_GNUC_UNUSED gboolean bypass_wayland = FALSE; MetaGestureTracker *tracker; + ClutterEventSequence *sequence; - meta_display_update_pointer_emulating_sequence (display, event); + sequence = clutter_event_get_event_sequence (event); + + /* Set the pointer emulating sequence on touch begin, if eligible */ + if (event->type == CLUTTER_TOUCH_BEGIN && + !display->pointer_emulating_sequence && + sequence_is_pointer_emulated (display, event)) + display->pointer_emulating_sequence = sequence; #ifdef HAVE_WAYLAND MetaWaylandCompositor *compositor = NULL; @@ -314,6 +304,11 @@ meta_display_handle_event (MetaDisplay *display, } #endif + /* Unset the pointer emulating sequence after its end event is processed */ + if (event->type == CLUTTER_TOUCH_END && + display->pointer_emulating_sequence == sequence) + display->pointer_emulating_sequence = NULL; + display->current_time = CurrentTime; return bypass_clutter; }