From b44ebcfb6a71f3dfbbfee3a8781d551995609cd0 Mon Sep 17 00:00:00 2001 From: Sayan Bhattacharjee Date: Fri, 7 Apr 2023 19:16:15 +0000 Subject: sidebar: Prevent auto folder opening on hover when re-ordering bookmarks In the sidebar, when dragging to re-order bookmarks, other bookmarked folders are automatically opening while hovering over them as it happens during a drag-and-drop operation. This action should not be permitted because it is inconceivable to drag-and-drop a bookmark into another bookmark. Implement a check to prevent automatically navigating into the bookmarked folders if they are hovered on while dragging a bookmark with the intent to just re-order them. It achieves this behavior by not adding a navigation hover timeout if we are dragging a row (bookmark) in the sidebar. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2820 --- src/gtk/nautilusgtkplacessidebar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c index d7e6e97d3..193c50d72 100644 --- a/src/gtk/nautilusgtkplacessidebar.c +++ b/src/gtk/nautilusgtkplacessidebar.c @@ -1656,8 +1656,9 @@ drag_motion_callback (GtkDropTarget *target, row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (sidebar->list_box), y); start = sidebar->hover_start_point; - if (row != sidebar->hover_row || - gtk_drag_check_threshold (GTK_WIDGET (sidebar), start.x, start.y, x, y)) + if (sidebar->drag_row == NULL && + (row != sidebar->hover_row || + gtk_drag_check_threshold (GTK_WIDGET (sidebar), start.x, start.y, x, y))) { g_clear_handle_id (&sidebar->hover_timer_id, g_source_remove); sidebar->hover_row = row; -- cgit v1.2.1