diff options
author | Ondrej Holy <oholy@redhat.com> | 2023-03-14 13:21:46 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2023-03-16 10:18:42 +0100 |
commit | 4dd135e751374a5e2b2d88ae4c60db4084999837 (patch) | |
tree | 3f3ab82a2b5233dc730b49b4eccc7298df9fdd02 | |
parent | d90b200f5f220af156925d6a9de583ae1b83d22b (diff) | |
download | nautilus-4dd135e751374a5e2b2d88ae4c60db4084999837.tar.gz |
Revert "list-base: Remove rubberband hack"
This reverts commit c1c7ccb0e23772d8cfb509eb133d7e522706c697 as it
turned out that the workaround is still needed. I've only updated the
obsolete comment a bit. The issue was initially fixed by the
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4831 merge request,
but it has been broken later.
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/5670
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2844
-rw-r--r-- | src/nautilus-list-base.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c index 827a3e1de..8d16c682e 100644 --- a/src/nautilus-list-base.c +++ b/src/nautilus-list-base.c @@ -313,6 +313,28 @@ open_context_menu_on_press (NautilusListBase *self, } static void +rubberband_set_state (NautilusListBase *self, + gboolean enabled) +{ + /* This is a temporary workaround to deal with the rubberbanding issues + * during a drag and drop. Disable rubberband on item press and enable + * rubberband on item release/stop. See: + * https://gitlab.gnome.org/GNOME/gtk/-/issues/5670 */ + + GtkWidget *view; + + view = NAUTILUS_LIST_BASE_CLASS (G_OBJECT_GET_CLASS (self))->get_view_ui (self); + if (GTK_IS_GRID_VIEW (view)) + { + gtk_grid_view_set_enable_rubberband (GTK_GRID_VIEW (view), enabled); + } + else if (GTK_IS_COLUMN_VIEW (view)) + { + gtk_column_view_set_enable_rubberband (GTK_COLUMN_VIEW (view), enabled); + } +} + +static void on_item_click_pressed (GtkGestureClick *gesture, gint n_press, gdouble x, @@ -337,6 +359,8 @@ on_item_click_pressed (GtkGestureClick *gesture, n_press == 1 && !selection_mode); + rubberband_set_state (self, FALSE); + /* It's safe to claim event sequence on press in the following cases because * they don't interfere with touch scrolling. */ if (button == GDK_BUTTON_PRIMARY && n_press == 2 && !priv->single_click_mode) @@ -395,6 +419,7 @@ on_item_click_released (GtkGestureClick *gesture, activate_selection_on_click (self, FALSE); } + rubberband_set_state (self, TRUE); priv->activate_on_release = FALSE; priv->deny_background_click = FALSE; } @@ -407,6 +432,7 @@ on_item_click_stopped (GtkGestureClick *gesture, g_autoptr (NautilusListBase) self = nautilus_view_cell_get_view (cell); NautilusListBasePrivate *priv = nautilus_list_base_get_instance_private (self); + rubberband_set_state (self, TRUE); priv->activate_on_release = FALSE; priv->deny_background_click = FALSE; } @@ -978,6 +1004,9 @@ real_begin_loading (NautilusFilesView *files_view) NautilusListBase *self = NAUTILUS_LIST_BASE (files_view); NautilusListBasePrivate *priv = nautilus_list_base_get_instance_private (self); + /* Temporary workaround */ + rubberband_set_state (self, TRUE); + /*TODO move this to the files view class begin_loading and hook up? */ |