summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-02-15 21:04:57 +0100
committerBenjamin Otte <otte@redhat.com>2020-02-15 22:33:57 +0100
commit46bbb397e19adb71917f2d6ea581e44ab041aad3 (patch)
tree0d1b66b48482ca6f1cf3f9198ada630e4b3a4c95 /gdk/wayland
parent894ac6c126cf30181f95b8feaa039274c0da4167 (diff)
downloadgtk+-46bbb397e19adb71917f2d6ea581e44ab041aad3.tar.gz
wayland: Use a magic mime type for local DND
Otherwise the compositor gets all confused when it's trying to make drag happen but we know it's not going to happen. After all, we exchange data behind its back, we just need to keep it informed.
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdevice-wayland.c4
-rw-r--r--gdk/wayland/gdkdrag-wayland.c1
-rw-r--r--gdk/wayland/gdkdrop-wayland.c7
-rw-r--r--gdk/wayland/gdkprivate-wayland.h7
4 files changed, 19 insertions, 0 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 4bc5a55b04..8ef0a3ae03 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1127,6 +1127,10 @@ data_offer_offer (void *data,
return;
}
+ /* skip magic mime types */
+ if (g_str_equal (type, GDK_WAYLAND_LOCAL_DND_MIME_TYPE))
+ return;
+
gdk_content_formats_builder_add_mime_type (seat->pending_builder, type);
}
diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c
index fd4dc9ec98..f7c2925c60 100644
--- a/gdk/wayland/gdkdrag-wayland.c
+++ b/gdk/wayland/gdkdrag-wayland.c
@@ -358,6 +358,7 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag)
g_message ("create data source, mime types=%s", s);
g_free (s);});
+ wl_data_source_offer (drag_wayland->data_source, GDK_WAYLAND_LOCAL_DND_MIME_TYPE);
for (i = 0; i < n_mimetypes; i++)
wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c
index b7f74e8743..a638b6314f 100644
--- a/gdk/wayland/gdkdrop-wayland.c
+++ b/gdk/wayland/gdkdrop-wayland.c
@@ -97,6 +97,13 @@ gdk_wayland_drop_drop_set_status (GdkWaylandDrop *drop_wayland,
const char *const *mimetypes;
gsize i, n_mimetypes;
+ /* This is a local drag, treat it like that */
+ if (gdk_drop_get_drag (GDK_DROP (drop_wayland)))
+ {
+ wl_data_offer_accept (drop_wayland->offer, drop_wayland->serial, GDK_WAYLAND_LOCAL_DND_MIME_TYPE);
+ return;
+ }
+
mimetypes = gdk_content_formats_get_mime_types (gdk_drop_get_formats (GDK_DROP (drop_wayland)), &n_mimetypes);
for (i = 0; i < n_mimetypes; i++)
{
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 8130a323a1..233e972cc4 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -44,6 +44,13 @@
#define WL_SURFACE_HAS_BUFFER_SCALE 3
#define WL_POINTER_HAS_FRAME 5
+/* the magic mime type we use for local DND operations.
+ * We offer it to every dnd operation, but will strip it out on the drop
+ * site unless we can prove it's a local DND - then we will use only
+ * this type
+ */
+#define GDK_WAYLAND_LOCAL_DND_MIME_TYPE "application/x-gtk-local-dnd"
+
GdkKeymap *_gdk_wayland_keymap_new (GdkDisplay *display);
void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
uint32_t format,