[gtk/4.0-backports: 52/53] x11: Pass mimetypes when creating output stream




commit 384f2686e67b10388702eed110952de2ae5e3aa5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 7 01:32:39 2021 -0500

    x11: Pass mimetypes when creating output stream
    
    When creating the output stream for a drop, we must
    pass the mimetypes we support, otherwise the picking
    of the right handler does not work.
    
    Fixes: #3652

 gdk/x11/gdkdrag-x11.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 00e9a104ab..05e1c58377 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -1687,6 +1687,7 @@ gdk_x11_drag_xevent (GdkDisplay   *display,
 
     case SelectionRequest:
       {
+        GdkContentFormats *formats;
 #ifdef G_ENABLE_DEBUG
         const char *target, *property;
 #endif
@@ -1705,23 +1706,30 @@ gdk_x11_drag_xevent (GdkDisplay   *display,
         if (xevent->xselectionrequest.requestor == None)
           {
             GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s with NULL 
window, ignoring\n",
-                                            target, property));
+                              target, property));
             return TRUE;
           }
         
         GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s\n",
-                                        target, property));
+                          target, property));
+
+        formats = gdk_content_formats_ref (gdk_drag_get_formats (drag));
+        formats = gdk_content_formats_union_serialize_mime_types (formats);
 
         gdk_x11_selection_output_streams_create (display,
-                                                 gdk_drag_get_formats (drag),
+                                                 formats,
                                                  xevent->xselectionrequest.requestor,
                                                  xevent->xselectionrequest.selection,
                                                  xevent->xselectionrequest.target,
-                                                 xevent->xselectionrequest.property ? 
xevent->xselectionrequest.property
-                                                                                    : 
xevent->xselectionrequest.target,
+                                                 xevent->xselectionrequest.property
+                                                   ? xevent->xselectionrequest.property
+                                                   : xevent->xselectionrequest.target,
                                                  xevent->xselectionrequest.time,
                                                  gdk_x11_drag_default_output_handler,
                                                  drag);
+
+        gdk_content_formats_unref (formats);
+
         return TRUE;
       }
 


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