diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 09:00:09 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 11:46:55 -0500 |
commit | 0b7518859820d6682f70f2f1822df7e9c3595277 (patch) | |
tree | b32814d1a44b5530aaedb1804b3d941adb06ce1b | |
parent | 384f2686e67b10388702eed110952de2ae5e3aa5 (diff) | |
download | gtk+-0b7518859820d6682f70f2f1822df7e9c3595277.tar.gz |
x11: More dnd fixes
Whenever we communicate targets, we need to the union, otherwise
we don't tell the other side about our serialization. This makes
drops of images from gtk4-icon-browser to gimp and libreoffice
succeed in transferring data.
Fixes: #3654
-rw-r--r-- | gdk/x11/gdkdrag-x11.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 05e1c58377..d8c9ac28b8 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -296,15 +296,20 @@ gdk_x11_drag_find (GdkDisplay *display, static void precache_target_list (GdkDrag *drag) { - GdkContentFormats *formats = gdk_drag_get_formats (drag); + GdkContentFormats *formats; const char * const *atoms; gsize n_atoms; + formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); + formats = gdk_content_formats_union_serialize_mime_types (formats); + atoms = gdk_content_formats_get_mime_types (formats, &n_atoms); _gdk_x11_precache_atoms (gdk_drag_get_display (drag), (const char **) atoms, n_atoms); + + gdk_content_formats_unref (formats); } /* Utility functions */ @@ -917,8 +922,12 @@ xdnd_set_targets (GdkX11Drag *drag_x11) const char * const *atoms; gsize i, n_atoms; GdkDisplay *display = gdk_drag_get_display (drag); + GdkContentFormats *formats; - atoms = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_atoms); + formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); + formats = gdk_content_formats_union_serialize_mime_types (formats); + + atoms = gdk_content_formats_get_mime_types (formats, &n_atoms); atomlist = g_new (Atom, n_atoms); for (i = 0; i < n_atoms; i++) atomlist[i] = gdk_x11_get_xatom_by_name_for_display (display, atoms[i]); @@ -932,6 +941,8 @@ xdnd_set_targets (GdkX11Drag *drag_x11) g_free (atomlist); drag_x11->xdnd_targets_set = 1; + + gdk_content_formats_unref (formats); } static void |