Libadwaita carousel misbehaving when system animations are turned off


I have been trying to test my app on Ubuntu 22.04 running inside Gnome Boxes without 3D acceleration. This is important because in such environment, animations are disabled, including in GTK.

The app uses an AdwCarousel and reorders pages inside the carousel before scrolling to them. In pseudocode, the flow is very simple

adw_carousel_reorder( carousel, next_page, current_page + 1)
adw_carousel_scroll_to( carousel, next_page, true)

However, this does not work as expected. It looks like the scroll_to operation is performed before the reorder one, and I land on the incorrect carousel page. This seems to somehow be related to the fact that animations are disabled on the system. Using the exact distro, but with animations turned on, I could not reproduce the issue.

Any advice on how to try to resolve this issue are welcomed, as well as suggestions for other widget I can try that offer similar functionalities (I am interested mostly in the scrolling animation).

Thank you

At a glance, I would suggest that adw_carousel_reorder() should set is_being_allocated to TRUE, like adw_carousel_insert() does. Otherwise the adw_carousel_scroll_to() may resolve before the widget is reallocated.

I opened a merge request because, well, it seemed silly not to. Anways, to work around this I guess you could put your call to adw_carouself_scroll_to() in an idle callback (e.g. g_idle_add()).

Thank you for the advice and the explication. I got it to work fine with the idle run callback. Cheers!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.