[gtk+/gtk-3-22] wayland: Add fake mimetype for local DnD cases



commit c4f1545c5e0782f3be39f91316282ea10c495a39
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 26 21:31:58 2016 +0200

    wayland: Add fake mimetype for local DnD cases
    
    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 |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index adc33a4..ff3ed53 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]