diff options
author | Arjan Molenaar <gaphor@gmail.com> | 2023-01-11 23:17:24 +0100 |
---|---|---|
committer | Arjan Molenaar <gaphor@gmail.com> | 2023-01-15 10:03:47 +0100 |
commit | 1d8a23e97bb1e34c6e99fe77e7b3fb5a33d720a7 (patch) | |
tree | cdb863b638279d21aa78154dd82aa8ca23f703f1 | |
parent | 422b4b6561b0a258b0ea58ca8d5c0295fb8bff26 (diff) | |
download | gtk+-1d8a23e97bb1e34c6e99fe77e7b3fb5a33d720a7.tar.gz |
macos: Provide fallback pasteboard for gtype Dnd
The Drag data should pass through the macos pasteboard system.
We need to provide some pasteboard type. Let's make it a "URL",
which is a pretty generic type anyway.
-rw-r--r-- | gdk/macos/gdkmacospasteboard.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gdk/macos/gdkmacospasteboard.c b/gdk/macos/gdkmacospasteboard.c index f74f9818cd..66b3c9f03b 100644 --- a/gdk/macos/gdkmacospasteboard.c +++ b/gdk/macos/gdkmacospasteboard.c @@ -372,7 +372,7 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window) serializable = gdk_content_formats_union_serialize_mime_types (serializable); mime_types = gdk_content_formats_get_mime_types (serializable, &n_mime_types); - for (guint i = 0; mime_types[i]; i++) + for (gsize i = 0; i < n_mime_types; i++) { const char *mime_type = mime_types[i]; NSPasteboardType type; @@ -386,6 +386,25 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window) } } + gdk_content_formats_unref (serializable); + + /* Default to an url type (think gobject://internal) + * to support internal, GType-based DnD. + */ + if (n_mime_types == 0) + { + GdkContentFormats *formats; + gsize n_gtypes; + + formats = gdk_content_provider_ref_formats (self->_contentProvider); + gdk_content_formats_get_gtypes (formats, &n_gtypes); + + if (n_gtypes) + [ret addObject:NSPasteboardTypeURL]; + + gdk_content_formats_unref (formats); + } + return g_steal_pointer (&ret); } |