[libadwaita/wip/exalm/carousel-fix: 9/13] carousel: Account for shifts in get_range()




commit ccbf85802f7cb595a88c3c0ae9f1d40f16bb1970
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Dec 28 18:24:15 2021 +0500

    carousel: Account for shifts in get_range()
    
    When shifting position, it's necessary to set position to essentially
    outside the range. Since this happens during allocation, we know that it
    will be within the range once allocation is done. So - allow that. Make
    sure we don't end up with upper < lower though.

 src/adw-carousel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index 3384c6f9..93b294e5 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -218,7 +218,7 @@ get_range (AdwCarousel *self,
     *lower = 0;
 
   if (upper)
-    *upper = child ? child->snap_point : 0;
+    *upper = MAX (0, self->position_shift + (child ? child->snap_point : 0));
 }
 
 static GtkWidget *


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