[libadwaita/wip/exalm/flap-swipe: 2/3] flap: Stop using begin-swipe
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/flap-swipe: 2/3] flap: Stop using begin-swipe
- Date: Fri, 7 May 2021 08:03:22 +0000 (UTC)
commit 7338d5a95aa65300236109561347c91ca927853a
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Mar 8 19:15:14 2021 +0500
flap: Stop using begin-swipe
begin-swipe can fire when we don't actually perform a swipe, we don't want
to switch to swipe mode immediately.
src/adw-flap.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/src/adw-flap.c b/src/adw-flap.c
index e8d7bd7..c49606b 100644
--- a/src/adw-flap.c
+++ b/src/adw-flap.c
@@ -410,30 +410,19 @@ get_start_or_end (AdwFlap *self)
return (is_rtl && is_horiz) ? GTK_PACK_END : GTK_PACK_START;
}
-static void
-begin_swipe_cb (AdwSwipeTracker *tracker,
- AdwNavigationDirection direction,
- AdwFlap *self)
-{
- if (self->reveal_progress <= 0 && !self->swipe_to_open)
- return;
-
- if (self->reveal_progress >= 1 && !self->swipe_to_close)
- return;
-
- if (self->reveal_animation)
- adw_animation_stop (self->reveal_animation);
-
- self->swipe_active = TRUE;
-}
-
static void
update_swipe_cb (AdwSwipeTracker *tracker,
double progress,
AdwFlap *self)
{
- if (!self->swipe_active)
- return;
+ if (!self->swipe_active &&
+ (self->reveal_progress > 0 || self->swipe_to_open) &&
+ (self->reveal_progress < 1 || self->swipe_to_close)) {
+ if (self->reveal_animation)
+ adw_animation_stop (self->reveal_animation);
+
+ self->swipe_active = TRUE;
+ }
set_reveal_progress (self, progress);
}
@@ -1539,7 +1528,6 @@ adw_flap_init (AdwFlap *self)
self->tracker = adw_swipe_tracker_new (ADW_SWIPEABLE (self));
adw_swipe_tracker_set_enabled (self->tracker, FALSE);
- g_signal_connect_object (self->tracker, "begin-swipe", G_CALLBACK (begin_swipe_cb), self, 0);
g_signal_connect_object (self->tracker, "update-swipe", G_CALLBACK (update_swipe_cb), self, 0);
g_signal_connect_object (self->tracker, "end-swipe", G_CALLBACK (end_swipe_cb), self, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]