[libadwaita/wip/exalm/swipe-group: 10/14] swipe-tracker: Remove the direct parameter from begin-swipe




commit b0f32d564e95d2fc1c471d2845cf84584ca4edbd
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Feb 26 14:44:59 2021 +0500

    swipe-tracker: Remove the direct parameter from begin-swipe
    
    Another thing that's not needed without swipe groups.

 src/adw-carousel.c              |  1 -
 src/adw-flap.c                  |  1 -
 src/adw-leaflet.c               |  8 ++------
 src/adw-swipe-tracker-private.h |  3 +--
 src/adw-swipe-tracker.c         | 13 +++++--------
 5 files changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index 66ef7e9..b527e1b 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -403,7 +403,6 @@ get_closest_snap_point (AdwCarousel *self)
 static void
 begin_swipe_cb (AdwSwipeTracker        *tracker,
                 AdwNavigationDirection  direction,
-                gboolean                direct,
                 AdwCarousel            *self)
 {
   if (self->animation)
diff --git a/src/adw-flap.c b/src/adw-flap.c
index 9fc73c8..d104d54 100644
--- a/src/adw-flap.c
+++ b/src/adw-flap.c
@@ -413,7 +413,6 @@ get_start_or_end (AdwFlap *self)
 static void
 begin_swipe_cb (AdwSwipeTracker        *tracker,
                 AdwNavigationDirection  direction,
-                gboolean                direct,
                 AdwFlap                *self)
 {
   if (self->reveal_progress <= 0 && !self->swipe_to_open)
diff --git a/src/adw-leaflet.c b/src/adw-leaflet.c
index 81ba3cb..de227ac 100644
--- a/src/adw-leaflet.c
+++ b/src/adw-leaflet.c
@@ -179,7 +179,6 @@ struct _AdwLeaflet {
     gboolean can_swipe_forward;
 
     GtkPanDirection active_direction;
-    gboolean is_direct_swipe;
     int swipe_direction;
   } child_transition;
 
@@ -1578,10 +1577,8 @@ set_orientation (AdwLeaflet     *self,
 static void
 begin_swipe_cb (AdwSwipeTracker        *tracker,
                 AdwNavigationDirection  direction,
-                gboolean                direct,
                 AdwLeaflet             *self)
 {
-  self->child_transition.is_direct_swipe = direct;
   self->child_transition.swipe_direction = direction;
 
   if (self->child_transition.tick_id > 0) {
@@ -1593,7 +1590,7 @@ begin_swipe_cb (AdwSwipeTracker        *tracker,
   } else {
     AdwLeafletPage *page = NULL;
 
-    if ((can_swipe_in_direction (self, direction) || !direct) && self->folded)
+    if (can_swipe_in_direction (self, direction) && self->folded)
       page = find_swipeable_page (self, direction);
 
     if (page) {
@@ -2548,8 +2545,7 @@ adw_leaflet_get_snap_points (AdwSwipeable *swipeable,
   } else {
     AdwLeafletPage *page = NULL;
 
-    if ((can_swipe_in_direction (self, self->child_transition.swipe_direction) ||
-         !self->child_transition.is_direct_swipe) && self->folded)
+    if (can_swipe_in_direction (self, self->child_transition.swipe_direction) && self->folded)
       page = find_swipeable_page (self, self->child_transition.swipe_direction);
 
     lower = MIN (0, page ? self->child_transition.swipe_direction : 0);
diff --git a/src/adw-swipe-tracker-private.h b/src/adw-swipe-tracker-private.h
index 4635774..b07a400 100644
--- a/src/adw-swipe-tracker-private.h
+++ b/src/adw-swipe-tracker-private.h
@@ -17,8 +17,7 @@ G_BEGIN_DECLS
 #define ADW_SWIPE_BORDER 32
 
 void adw_swipe_tracker_emit_begin_swipe (AdwSwipeTracker        *self,
-                                         AdwNavigationDirection  direction,
-                                         gboolean                direct);
+                                         AdwNavigationDirection  direction);
 void adw_swipe_tracker_emit_update_swipe (AdwSwipeTracker *self,
                                           double           progress);
 void adw_swipe_tracker_emit_end_swipe (AdwSwipeTracker *self,
diff --git a/src/adw-swipe-tracker.c b/src/adw-swipe-tracker.c
index 204ed8d..bb30703 100644
--- a/src/adw-swipe-tracker.c
+++ b/src/adw-swipe-tracker.c
@@ -173,7 +173,7 @@ gesture_prepare (AdwSwipeTracker        *self,
     return;
   }
 
-  adw_swipe_tracker_emit_begin_swipe (self, direction, TRUE);
+  adw_swipe_tracker_emit_begin_swipe (self, direction);
 
   self->initial_progress = adw_swipeable_get_progress (self->swipeable);
   self->progress = self->initial_progress;
@@ -1039,8 +1039,6 @@ adw_swipe_tracker_class_init (AdwSwipeTrackerClass *klass)
    * AdwSwipeTracker::begin-swipe:
    * @self: The #AdwSwipeTracker instance
    * @direction: The direction of the swipe
-   * @direct: %TRUE if the swipe is directly triggered by a gesture,
-   *   %FALSE if it's triggered via a #AdwSwipeGroup
    *
    * This signal is emitted when a possible swipe is detected.
    *
@@ -1056,8 +1054,8 @@ adw_swipe_tracker_class_init (AdwSwipeTrackerClass *klass)
                   0,
                   NULL, NULL, NULL,
                   G_TYPE_NONE,
-                  2,
-                  ADW_TYPE_NAVIGATION_DIRECTION, G_TYPE_BOOLEAN);
+                  1,
+                  ADW_TYPE_NAVIGATION_DIRECTION);
 
   /**
    * AdwSwipeTracker::update-swipe:
@@ -1357,12 +1355,11 @@ adw_swipe_tracker_shift_position (AdwSwipeTracker *self,
 
 void
 adw_swipe_tracker_emit_begin_swipe (AdwSwipeTracker        *self,
-                                    AdwNavigationDirection  direction,
-                                    gboolean                direct)
+                                    AdwNavigationDirection  direction)
 {
   g_return_if_fail (ADW_IS_SWIPE_TRACKER (self));
 
-  g_signal_emit (self, signals[SIGNAL_BEGIN_SWIPE], 0, direction, direct);
+  g_signal_emit (self, signals[SIGNAL_BEGIN_SWIPE], 0, direction);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]