1
0
Fork 0

core: Unset "pointer emulating" sequence lazily

Unsetting it in meta_display_handle_event() will make the pointer
emulation checks fail on TOUCH_END event handlers across clutter
actors, the sequence should still be considered as pointer emulating
at that time.

As we don't have a way to hook this post clutter event handling,
instead unset/reset it lazily on the next pointer emulating TOUCH_BEGIN
event, the checks would already fail on other sequences, even if the
pointer emulating touch ended earlier. The only extra thing we need
to take care about is sequence collision, at which point it's safe to
just unset the stored sequence if its new incarnation isn't flagged/
deemed as pointer emulating.

https://bugzilla.gnome.org/show_bug.cgi?id=756754
This commit is contained in:
Carlos Garnacho 2015-10-16 15:13:40 +02:00
parent 428c687b5a
commit 96b5042dda

View file

@ -182,10 +182,25 @@ meta_display_handle_event (MetaDisplay *display,
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;
if (event->type == CLUTTER_TOUCH_BEGIN)
{
if (sequence_is_pointer_emulated (display, event))
{
/* This is the new pointer emulating sequence */
display->pointer_emulating_sequence = sequence;
}
else if (display->pointer_emulating_sequence == sequence)
{
/* This sequence was "pointer emulating" in a prior incarnation,
* but now it isn't. We unset the pointer emulating sequence at
* this point so the current sequence is not mistaken as pointer
* emulating, while we've ensured that it's been deemed
* "pointer emulating" throughout all of the event processing
* of the previous incarnation.
*/
display->pointer_emulating_sequence = NULL;
}
}
#ifdef HAVE_WAYLAND
MetaWaylandCompositor *compositor = NULL;
@ -335,11 +350,6 @@ 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;
}