[libadwaita/wip/otte/stack: 3/4] viewstack: Index the homogeneous array by orientation




commit 47ff54f07bd97ca89a1f6e14ba78b513c2d6de88
Author: Benjamin Otte <otte redhat com>
Date:   Sun Nov 21 04:51:41 2021 +0100

    viewstack: Index the homogeneous array by orientation

 src/adw-view-stack.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/src/adw-view-stack.c b/src/adw-view-stack.c
index a862dd4f..8cc986e3 100644
--- a/src/adw-view-stack.c
+++ b/src/adw-view-stack.c
@@ -965,9 +965,8 @@ adw_view_stack_measure (GtkWidget      *widget,
     AdwViewStackPage *page = l->data;
     GtkWidget *child = page->widget;
 
-    if (((orientation == GTK_ORIENTATION_VERTICAL && !self->homogeneous[GTK_ORIENTATION_VERTICAL]) ||
-         (orientation == GTK_ORIENTATION_HORIZONTAL && !self->homogeneous[GTK_ORIENTATION_HORIZONTAL])) &&
-         self->visible_child != page)
+    if (!self->homogeneous[orientation] &&
+        self->visible_child != page)
       continue;
 
     if (gtk_widget_get_visible (child)) {
@@ -978,18 +977,10 @@ adw_view_stack_measure (GtkWidget      *widget,
     }
   }
 
-  if (self->last_visible_child) {
-    if (orientation == GTK_ORIENTATION_VERTICAL && !self->homogeneous[GTK_ORIENTATION_VERTICAL]) {
-      double t = self->interpolate_size ? gtk_progress_tracker_get_ease_out_cubic (&self->tracker, FALSE) : 
0.0;
-      *minimum = adw_lerp (*minimum, self->last_visible_widget_size[GTK_ORIENTATION_VERTICAL], 1.0 - t);
-      *natural = adw_lerp (*natural, self->last_visible_widget_size[GTK_ORIENTATION_VERTICAL], 1.0 - t);
-    }
-
-    if (orientation == GTK_ORIENTATION_HORIZONTAL && !self->homogeneous[GTK_ORIENTATION_HORIZONTAL]) {
-      double t = self->interpolate_size ? gtk_progress_tracker_get_ease_out_cubic (&self->tracker, FALSE) : 
0.0;
-      *minimum = adw_lerp (*minimum, self->last_visible_widget_size[GTK_ORIENTATION_HORIZONTAL], 1.0 - t);
-      *natural = adw_lerp (*natural, self->last_visible_widget_size[GTK_ORIENTATION_HORIZONTAL], 1.0 - t);
-    }
+  if (self->last_visible_child && !self->homogeneous[orientation]) {
+    double t = self->interpolate_size ? gtk_progress_tracker_get_ease_out_cubic (&self->tracker, FALSE) : 
0.0;
+    *minimum = adw_lerp (*minimum, self->last_visible_widget_size[orientation], 1.0 - t);
+    *natural = adw_lerp (*natural, self->last_visible_widget_size[orientation], 1.0 - t);
   }
 }
 


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