diff --git a/build-aux/flatpak/libadwaita-issue-597.patch b/build-aux/flatpak/libadwaita-issue-597.patch new file mode 100644 index 0000000..ba6b804 --- /dev/null +++ b/build-aux/flatpak/libadwaita-issue-597.patch @@ -0,0 +1,59 @@ +From b2c52f258757e37a74a95c109431f6af8cda8f91 Mon Sep 17 00:00:00 2001 +From: Sophie Herold +Date: Wed, 7 Dec 2022 17:42:06 +0100 +Subject: [PATCH] carousel: give new child a snap_point immediately + +Fixes #457, #597 +--- + src/adw-carousel.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/src/adw-carousel.c b/src/adw-carousel.c +index 47ea9475..5a9816f9 100644 +--- a/src/adw-carousel.c ++++ b/src/adw-carousel.c +@@ -1207,6 +1207,8 @@ adw_carousel_insert (AdwCarousel *self, + { + ChildInfo *info; + GList *next_link = NULL; ++ double snap_point = 0; ++ GList *children; + + g_return_if_fail (ADW_IS_CAROUSEL (self)); + g_return_if_fail (GTK_IS_WIDGET (widget)); +@@ -1214,7 +1216,8 @@ adw_carousel_insert (AdwCarousel *self, + + info = g_new0 (ChildInfo, 1); + info->widget = widget; +- info->size = 0; ++ // set a minimal size to give child it's own snap_point from the beginning ++ info->size = 0.00001; + info->adding = TRUE; + + if (position >= 0) +@@ -1230,6 +1233,22 @@ adw_carousel_insert (AdwCarousel *self, + gtk_widget_set_parent (widget, GTK_WIDGET (self)); + } + ++ // work around this usually happening in measure which can be too late ++ for (children = self->children; children; children = children->next) { ++ ChildInfo *child_info = children->data; ++ ++ child_info->snap_point = snap_point + child_info->size - 1; ++ ++ snap_point += child_info->size; ++ ++ if (child_info == self->animation_target_child) ++ adw_spring_animation_set_value_to (ADW_SPRING_ANIMATION (self->animation), ++ child_info->snap_point); ++ } ++ ++ // start animation from correct size ++ info->size = 0; ++ + gtk_widget_queue_allocate (GTK_WIDGET (self)); + + animate_child_resize (self, info, 1, self->reveal_duration); +-- +GitLab + diff --git a/build-aux/flatpak/org.gnome.Loupe.Devel.json b/build-aux/flatpak/org.gnome.Loupe.Devel.json index 0db1f54..03ac589 100644 --- a/build-aux/flatpak/org.gnome.Loupe.Devel.json +++ b/build-aux/flatpak/org.gnome.Loupe.Devel.json @@ -91,6 +91,22 @@ } ] }, + /* Use patched libadwaita version to test the fix */ + { + "name": "libadwaita", + "buildsystem": "meson", + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/libadwaita.git", + "branch": "main" + }, + { + "type": "patch", + "path": "libadwaita-issue-597.patch" + } + ] + }, { "name" : "loupe", "builddir" : true,