From d4d9bda4a1868a94ab40e3a9ef352301f30e4992 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 16 Mar 2023 15:55:10 -0700 Subject: [PATCH] Backport MR #1151 to fix drag-and-drop (#2176766) --- ...ert-list-base-Remove-rubberband-hack.patch | 88 +++++++++++++++++++ nautilus.spec | 10 ++- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 0001-Revert-list-base-Remove-rubberband-hack.patch diff --git a/0001-Revert-list-base-Remove-rubberband-hack.patch b/0001-Revert-list-base-Remove-rubberband-hack.patch new file mode 100644 index 0000000..85cd0a3 --- /dev/null +++ b/0001-Revert-list-base-Remove-rubberband-hack.patch @@ -0,0 +1,88 @@ +From 4dd135e751374a5e2b2d88ae4c60db4084999837 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Tue, 14 Mar 2023 13:21:46 +0100 +Subject: [PATCH] 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 +--- + src/nautilus-list-base.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +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 +@@ -312,6 +312,28 @@ open_context_menu_on_press (NautilusListBase *self, + view_x, view_y); + } + ++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, +@@ -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? */ + + +-- +2.40.0 + diff --git a/nautilus.spec b/nautilus.spec index 0904996..b1b2b75 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -7,12 +7,17 @@ Name: nautilus Version: 44~rc -Release: 1%{?dist} +Release: 2%{?dist} Summary: File manager for GNOME License: GPL-3.0-or-later URL: https://wiki.gnome.org/Apps/Nautilus Source0: https://download.gnome.org/sources/%{name}/44/%{name}-%{tarball_version}.tar.xz +# https://bugzilla.redhat.com/show_bug.cgi?id=2176766 +# https://gitlab.gnome.org/GNOME/nautilus/-/issues/2844 +# https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1151 +# Restore the 'rubberband hack' that makes drag-and-drop reliable +Patch0: 0001-Revert-list-base-Remove-rubberband-hack.patch BuildRequires: desktop-file-utils BuildRequires: gcc @@ -139,6 +144,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %doc %{_datadir}/doc/nautilus/ %changelog +* Thu Mar 16 2023 Adam Williamson - 44~rc-2 +- Backport MR #1151 to fix drag-and-drop (#2176766) + * Sun Mar 05 2023 David King - 44~rc-1 - Update to 44.rc