From 28982ade942b9aba50b8eff0d993f46e399971db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 9 May 2022 13:17:46 +0200 Subject: [PATCH] gesture-tracker: Never reject sequences in Wayland sessions In constrast to x11, Wayland has sane handling for touch events and allows the compositor to handle a touch event while the clients are already seeing it. This means we don't need the REJECTED state on Wayland, since we can also grab sequences after the client has seen them. So disallow moving sequences to the REJECTED state on Wayland. Part-of: --- src/core/meta-gesture-tracker.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/core/meta-gesture-tracker.c b/src/core/meta-gesture-tracker.c index 9e6d55d45..2bb07c3ce 100644 --- a/src/core/meta-gesture-tracker.c +++ b/src/core/meta-gesture-tracker.c @@ -227,6 +227,24 @@ static gboolean state_is_applicable (MetaSequenceState prev_state, MetaSequenceState state) { + + if (meta_is_wayland_compositor ()) + { + /* Never reject sequences on Wayland, on Wayland we deliver touch events + * to clients right away and can cancel them later when accepting a + * sequence. + */ + if (state == META_SEQUENCE_REJECTED) + return FALSE; + } + else + { + /* Sequences must be accepted/denied before PENDING_END */ + if (prev_state == META_SEQUENCE_NONE && + state == META_SEQUENCE_PENDING_END) + return FALSE; + } + /* PENDING_END state is final */ if (prev_state == META_SEQUENCE_PENDING_END) return FALSE; @@ -235,11 +253,6 @@ state_is_applicable (MetaSequenceState prev_state, if (state == META_SEQUENCE_NONE) return FALSE; - /* Sequences must be accepted/denied before PENDING_END */ - if (prev_state == META_SEQUENCE_NONE && - state == META_SEQUENCE_PENDING_END) - return FALSE; - /* Make sequences stick to their accepted/denied state */ if (state != META_SEQUENCE_PENDING_END && prev_state != META_SEQUENCE_NONE)