[nautilus/gnome-3-36] files-view: Cancel kinetic deceleration on loading
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-36] files-view: Cancel kinetic deceleration on loading
- Date: Tue, 21 Apr 2020 08:28:46 +0000 (UTC)
commit e3f0a3ccb1c6ecf5468b68409ce4bc41514eed25
Author: António Fernandes <antoniof gnome org>
Date: Sat Apr 18 22:43:54 2020 +0000
files-view: Cancel kinetic deceleration on loading
If we change location while the view is still scrolling due to
kinetic deceleration, we get a sudden jump to the same scrolling
position as the previous location, as well as residual scrolling
movement in the new location.
This is both undesirable and unexpected from a user POV.
Workaround that by canceling deceleration when switching locations.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1452
(cherry picked from commit a4d7148210970c5eb874df736b900f577684a13b)
src/nautilus-files-view.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 86472df87..dbfb39c34 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8516,6 +8516,26 @@ load_directory (NautilusFilesView *view,
setup_loading_floating_bar (view);
+ /* HACK: Fix for https://gitlab.gnome.org/GNOME/nautilus/-/issues/1452 */
+ {
+ GtkScrolledWindow *content = GTK_SCROLLED_WINDOW (priv->scrolled_window);
+
+ /* If we load a new location while the view is still scrolling due to
+ * kinetic deceleration, we get a sudden jump to the same scrolling
+ * position as the previous location, as well as residual scrolling
+ * movement in the new location.
+ *
+ * This is both undesirable and unexpected from a user POV, so we want
+ * to abort deceleration when switching locations.
+ *
+ * However, gtk_scrolled_window_cancel_deceleration() is private. So,
+ * we make use of an undocumented behavior of ::set_kinetic_scrolling(),
+ * which calls ::cancel_deceleration() when set to FALSE.
+ */
+ gtk_scrolled_window_set_kinetic_scrolling (content, FALSE);
+ gtk_scrolled_window_set_kinetic_scrolling (content, TRUE);
+ }
+
/* Update menus when directory is empty, before going to new
* location, so they won't have any false lingering knowledge
* of old selection.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]