From bf9309b1933f1acfb72e39d3e3839e1c8da1a38c Mon Sep 17 00:00:00 2001 From: Nicolas Berbiche Date: Thu, 23 Dec 2021 16:10:19 -0500 Subject: [PATCH] Smooth scroll to new animation in notification center (#41) If the user has disabled animations in GTK, then there will be no animations. This is all handled internally by GTK. --- src/controlCenter/controlCenter.vala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/controlCenter/controlCenter.vala b/src/controlCenter/controlCenter.vala index c7ed21d..a214fbf 100644 --- a/src/controlCenter/controlCenter.vala +++ b/src/controlCenter/controlCenter.vala @@ -194,17 +194,12 @@ namespace SwayNotificatonCenter { } private void scroll_to_start (bool reverse) { - var adj = viewport.vadjustment; - double val = adj.get_lower (); - list_position = 0; + const bool horizontal_scroll = false; + Gtk.ScrollType scroll_type = Gtk.ScrollType.START; if (reverse) { - val = adj.get_upper (); - list_position = list_reverse ? - (list_box.get_children ().length () - 1) : 0; - if (list_position == uint.MAX) list_position = -1; + scroll_type = Gtk.ScrollType.END; } - adj.set_value (val); - navigate_list (list_position); + scrolled_window.scroll_child (scroll_type, horizontal_scroll); } public uint notification_count () {