[nautilus] list-base: Temporary workaround for rubberband during dnd
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] list-base: Temporary workaround for rubberband during dnd
- Date: Wed, 29 Jun 2022 01:25:55 +0000 (UTC)
commit b4d45b3876718dd43d1cc74f5c06fb28d54f9be7
Author: Corey Berla <corey berla me>
Date: Tue Jun 28 11:52:25 2022 -0700
list-base: Temporary workaround for rubberband during dnd
While performing a DnD operation, the rubberband begins and is not
correctly cancelled in GTK causing unexpected behavior. This is
fixed in: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4831
Until the issue is fixed in GTK, use temporary workaround to disable
rubberbanding on item click and reenable rubberbanding on
stop/release or view change.
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 a585127c6..e40019629 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -285,6 +285,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
+ * rubberbnad on item release/stop. The permanent solution for this is
+ * https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4831 */
+
+ 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,
@@ -310,6 +332,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)
@@ -368,6 +392,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;
}
@@ -380,6 +405,7 @@ on_item_click_stopped (GtkGestureClick *gesture,
NautilusListBase *self = NAUTILUS_LIST_BASE (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;
}
@@ -565,6 +591,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? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]