[gtk/wip/chergert/gdk-macos-gdkdrag: 1/8] macos: register known clipboard types for drag destination
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/gdk-macos-gdkdrag: 1/8] macos: register known clipboard types for drag destination
- Date: Sat, 19 Jun 2021 02:29:04 +0000 (UTC)
commit daa4263965bb0650f15889fc12b4fedbc21e9220
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 17 13:23:18 2021 -0700
macos: register known clipboard types for drag destination
gdk/macos/GdkMacosWindow.c | 4 ++++
gdk/macos/gdkmacosclipboard-private.h | 1 +
gdk/macos/gdkmacosclipboard.c | 13 +++++++++++++
3 files changed, 18 insertions(+)
---
diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c
index 3afcdeb826..8f3817ee6a 100644
--- a/gdk/macos/GdkMacosWindow.c
+++ b/gdk/macos/GdkMacosWindow.c
@@ -28,6 +28,7 @@
#import "GdkMacosGLView.h"
#import "GdkMacosWindow.h"
+#include "gdkmacosclipboard-private.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacosmonitor-private.h"
#include "gdkmacossurface-private.h"
@@ -287,6 +288,9 @@ typedef NSString *CALayerContentsGravity;
[self setContentView:view];
[view release];
+ /* TODO: We might want to make this more extensible at some point */
+ _gdk_macos_clipboard_register_drag_types (self);
+
return self;
}
diff --git a/gdk/macos/gdkmacosclipboard-private.h b/gdk/macos/gdkmacosclipboard-private.h
index 01a562c2b8..e612f73edd 100644
--- a/gdk/macos/gdkmacosclipboard-private.h
+++ b/gdk/macos/gdkmacosclipboard-private.h
@@ -40,6 +40,7 @@ void _gdk_macos_clipboard_check_externally_modified (GdkMacosClipbo
NSPasteboardType _gdk_macos_clipboard_to_ns_type (const char *mime_type,
NSPasteboardType *alternate);
const char *_gdk_macos_clipboard_from_ns_type (NSPasteboardType ns_type);
+void _gdk_macos_clipboard_register_drag_types (NSWindow *window);
@interface GdkMacosClipboardDataProvider : NSObject <NSPasteboardItemDataProvider>
{
diff --git a/gdk/macos/gdkmacosclipboard.c b/gdk/macos/gdkmacosclipboard.c
index 7ddf47d83b..ea0d19f923 100644
--- a/gdk/macos/gdkmacosclipboard.c
+++ b/gdk/macos/gdkmacosclipboard.c
@@ -622,4 +622,17 @@ on_data_ready_cb (GObject *object,
write_request_free (wr);
}
+void
+_gdk_macos_clipboard_register_drag_types (NSWindow *window)
+{
+ [window registerForDraggedTypes:[NSArray arrayWithObjects:PTYPE(STRING),
+ PTYPE(PBOARD),
+ PTYPE(URL),
+ PTYPE(FILE_URL),
+ PTYPE(COLOR),
+ PTYPE(TIFF),
+ PTYPE(PNG),
+ nil]];
+}
+
@end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]