[libadwaita/wip/exalm/view-switcher-cleanup: 3/12] squeezer: Fix child switch threshold in vertical orientation




commit e5d3b14c5e3092ed4aa07ee9a059f3f790a58e51
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Aug 31 15:21:40 2021 +0500

    squeezer: Fix child switch threshold in vertical orientation
    
    We were comparing height against width.

 src/adw-squeezer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-squeezer.c b/src/adw-squeezer.c
index f3635e82..18674a7b 100644
--- a/src/adw-squeezer.c
+++ b/src/adw-squeezer.c
@@ -848,6 +848,7 @@ adw_squeezer_size_allocate (GtkWidget *widget,
     GtkWidget *child = NULL;
     int child_min;
     int for_size = -1;
+    int compare_size;
 
     page = l->data;
     child = page->widget;
@@ -859,6 +860,8 @@ adw_squeezer_size_allocate (GtkWidget *widget,
       continue;
 
     if (self->orientation == GTK_ORIENTATION_VERTICAL) {
+      compare_size = height;
+
       if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
         for_size = width;
 
@@ -868,13 +871,15 @@ adw_squeezer_size_allocate (GtkWidget *widget,
       if (child_min <= height)
         break;
     } else {
+      compare_size = width;
+
       if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT)
         for_size = height;
 
       gtk_widget_measure (child, self->orientation, for_size,
                           &child_min, NULL, NULL, NULL);
 
-      if (child_min <= width)
+      if (child_min <= compare_size)
         break;
     }
   }


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