wayland: Add fake mimetype for local DnD cases
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 26 Oct 2016 19:31:58 +0000 (21:31 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 9 Jan 2017 18:04:23 +0000 (19:04 +0100)
If there are no targets, DnD is probably intended to be local,
add a mimetype for matching then. The wayland protocol requires
at least one wl_data_offer.target call with the mimetype selected
for transfer.

gdk/wayland/gdkdnd-wayland.c

index adc33a4bc27ebcd911dd3f9d5381fdeb7ce93043..ff3ed53c3de049a03fafd38420a97aeb83dfc48b 100644 (file)
@@ -549,6 +549,15 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
       g_free (mimetype);
     }
 
+  /* If there's no targets this is local DnD, ensure we create a target for it */
+  if (!context->targets)
+    {
+      gchar *local_dnd_mime;
+      local_dnd_mime = g_strdup_printf ("application/gtk+-local-dnd-%x", getpid());
+      wl_data_source_offer (context_wayland->data_source, local_dnd_mime);
+      g_free (local_dnd_mime);
+    }
+
   return context;
 }