[nautilus/wip/corey/dnd_features: 4/6] list-base: Fix hotspot for DnD drag icon
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/dnd_features: 4/6] list-base: Fix hotspot for DnD drag icon
- Date: Thu, 18 Aug 2022 19:31:08 +0000 (UTC)
commit 2e72e91fe74780da471ab477dc3b87d37209d618
Author: Corey Berla <corey berla me>
Date: Thu Aug 18 10:23:31 2022 -0700
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.
src/nautilus-list-base.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c
index 7eefc8849..e2995db30 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -513,6 +513,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;
@@ -545,6 +546,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 if (GTK_IS_COLUMN_VIEW (view_ui))
+ {
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]