summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-08-18 10:23:31 -0700
committerAntónio Fernandes <antoniof@gnome.org>2022-09-01 21:42:41 +0000
commit2bed5adac49dcf05f7d320df9b6faefc1931cc04 (patch)
tree78e6c949ba883dab5ccfae5c86dd848d4f53c03c
parent0a9f185593350fb73ec07bd0f0e09cdb81398432 (diff)
downloadnautilus-2bed5adac49dcf05f7d320df9b6faefc1931cc04.tar.gz
list-base: Fix hotspot for DnD drag icon
We use a fixed size drag icon so we need to scale the drag icon accordingly. The hotspot doesn't make sense for listview, and can produce very strange results, so simply set to 0,0.
-rw-r--r--src/nautilus-list-base.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c
index db0ff2df7..f5955ea89 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -545,6 +545,7 @@ on_item_drag_prepare (GtkDragSource *source,
{
NautilusViewCell *cell = user_data;
NautilusListBase *self = NAUTILUS_LIST_BASE (nautilus_view_cell_get_view (cell));
+ GtkWidget *view_ui;
g_autolist (NautilusFile) selection = NULL;
g_autoslist (GFile) file_list = NULL;
g_autoptr (GdkPaintable) paintable = NULL;
@@ -577,6 +578,19 @@ on_item_drag_prepare (GtkDragSource *source,
scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (self));
paintable = get_paintable_for_drag_selection (selection, scale_factor);
+
+ view_ui = NAUTILUS_LIST_BASE_CLASS (G_OBJECT_GET_CLASS (self))->get_view_ui (self);
+ if (GTK_IS_GRID_VIEW (view_ui))
+ {
+ x = x * NAUTILUS_DRAG_SURFACE_ICON_SIZE / nautilus_list_base_get_icon_size (self);
+ y = y * NAUTILUS_DRAG_SURFACE_ICON_SIZE / nautilus_list_base_get_icon_size (self);
+ }
+ else
+ {
+ x = 0;
+ y = 0;
+ }
+
gtk_drag_source_set_icon (source, paintable, x, y);
return gdk_content_provider_new_typed (GDK_TYPE_FILE_LIST, file_list);