[libhandy/wip/exalm/leaflet-transltions: 21/32] stackable-box: Remove NONE transition type



commit ac55e69fbab971cf7f3fcda7bd06df43edc74335
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Jun 4 18:26:45 2020 +0500

    stackable-box: Remove NONE transition type
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/280
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-stackable-box-private.h |  1 -
 src/hdy-stackable-box.c         | 19 ++++---------------
 2 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/hdy-stackable-box-private.h b/src/hdy-stackable-box-private.h
index 423fa5b1..e9a19aa3 100644
--- a/src/hdy-stackable-box-private.h
+++ b/src/hdy-stackable-box-private.h
@@ -20,7 +20,6 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (HdyStackableBox, hdy_stackable_box, HDY, STACKABLE_BOX, GObject)
 
 typedef enum {
-  HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE,
   HDY_STACKABLE_BOX_TRANSITION_TYPE_OVER,
   HDY_STACKABLE_BOX_TRANSITION_TYPE_UNDER,
   HDY_STACKABLE_BOX_TRANSITION_TYPE_SLIDE,
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index c7a78d3c..46a2dc7a 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -40,7 +40,6 @@
 
 /**
  * HdyStackableBoxTransitionType:
- * @HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE: No transition
  * @HDY_STACKABLE_BOX_TRANSITION_TYPE_OVER: Cover the old page or uncover the new page, sliding from or 
towards the end according to orientation, text direction and children order
  * @HDY_STACKABLE_BOX_TRANSITION_TYPE_UNDER: Uncover the new page or cover the old page, sliding from or 
towards the start according to orientation, text direction and children order
  * @HDY_STACKABLE_BOX_TRANSITION_TYPE_SLIDE: Slide from left, right, up or down according to the 
orientation, text direction and the children order
@@ -263,8 +262,6 @@ is_window_moving_child_transition (HdyStackableBox *self)
   right_or_left = is_rtl ? GTK_PAN_DIRECTION_LEFT : GTK_PAN_DIRECTION_RIGHT;
 
   switch (self->transition_type) {
-  case HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE:
-    return FALSE;
   case HDY_STACKABLE_BOX_TRANSITION_TYPE_OVER:
     return direction == GTK_PAN_DIRECTION_UP || direction == left_or_right;
   case HDY_STACKABLE_BOX_TRANSITION_TYPE_UNDER:
@@ -505,7 +502,6 @@ hdy_stackable_box_start_child_transition (HdyStackableBox               *self,
       ((hdy_get_enable_animations (widget) &&
         transition_duration != 0) ||
        self->child_transition.is_gesture_active) &&
-      transition_type != HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE &&
       self->last_visible_child != NULL &&
       /* Don't animate child transition when a mode transition is ongoing. */
       self->mode_transition.tick_id == 0) {
@@ -787,7 +783,6 @@ hdy_stackable_box_start_mode_transition (HdyStackableBox *self,
 
   if (gtk_widget_get_mapped (widget) &&
       self->mode_transition.duration != 0 &&
-      self->transition_type != HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE &&
       hdy_get_enable_animations (widget) &&
       self->can_unfold) {
     self->mode_transition.source_pos = self->mode_transition.current_pos;
@@ -940,7 +935,7 @@ hdy_stackable_box_get_homogeneous (HdyStackableBox *self,
 HdyStackableBoxTransitionType
 hdy_stackable_box_get_transition_type (HdyStackableBox *self)
 {
-  g_return_val_if_fail (HDY_IS_STACKABLE_BOX (self), HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE);
+  g_return_val_if_fail (HDY_IS_STACKABLE_BOX (self), HDY_STACKABLE_BOX_TRANSITION_TYPE_OVER);
 
   return self->transition_type;
 }
@@ -1562,8 +1557,7 @@ hdy_stackable_box_size_allocate_folded (HdyStackableBox *self,
   mode_transition_type = self->transition_type;
 
   /* Avoid useless computations and allow visible child transitions. */
-  if (self->mode_transition.current_pos <= 0.0 ||
-      mode_transition_type == HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE) {
+  if (self->mode_transition.current_pos <= 0.0) {
     /* Child transitions should be applied only when folded and when no mode
      * transition is ongoing.
      */
@@ -2360,7 +2354,6 @@ hdy_stackable_box_draw_over_or_under (HdyStackableBox *self,
     else
       g_assert_not_reached ();
     break;
-  case HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE:
   case HDY_STACKABLE_BOX_TRANSITION_TYPE_SLIDE:
   default:
     g_assert_not_reached ();
@@ -2649,8 +2642,7 @@ hdy_stackable_box_draw (HdyStackableBox *self,
                                       self->visible_child->widget,
                                       cr);
     }
-    else if ((self->child_transition.is_gesture_active &&
-              self->transition_type != HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE) ||
+    else if (self->child_transition.is_gesture_active ||
              gtk_progress_tracker_get_state (&self->child_transition.tracker) != GTK_PROGRESS_STATE_AFTER) {
       if (self->child_transition.last_visible_surface == NULL &&
           self->last_visible_child != NULL) {
@@ -2684,7 +2676,6 @@ hdy_stackable_box_draw (HdyStackableBox *self,
       case HDY_STACKABLE_BOX_TRANSITION_TYPE_SLIDE:
         hdy_stackable_box_draw_slide (self, cr);
         break;
-      case HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE:
       default:
         g_assert_not_reached ();
       }
@@ -3241,9 +3232,7 @@ hdy_stackable_box_end_swipe (HdyStackableBox *self,
   self->child_transition.first_frame_skipped = TRUE;
 
   hdy_stackable_box_schedule_child_ticks (self);
-  if (hdy_get_enable_animations (GTK_WIDGET (self->container)) &&
-      duration != 0 &&
-      self->transition_type != HDY_STACKABLE_BOX_TRANSITION_TYPE_NONE) {
+  if (hdy_get_enable_animations (GTK_WIDGET (self->container)) && duration != 0) {
     gtk_progress_tracker_start (&self->child_transition.tracker,
                                 duration * 1000,
                                 0,


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