+static gboolean
+gtk_drag_begin_idle (gpointer arg)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ GdkDragContext* context = (GdkDragContext*) arg;
+ GtkDragSourceInfo* info = gtk_drag_get_source_info (context, FALSE);
+ NSWindow *nswindow;
+ NSPasteboard *pasteboard;
+ GtkDragSourceOwner *owner;
+ NSPoint point;
+ NSSet *types;
+ NSImage *drag_image;
+
+ g_assert (info != NULL);
+
+ pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+ owner = [[GtkDragSourceOwner alloc] initWithInfo:info];
+
+ types = _gtk_quartz_target_list_to_pasteboard_types (info->target_list);
+
+ [pasteboard declareTypes:[types allObjects] owner:owner];
+
+ [owner release];
+ [types release];
+
+ if ((nswindow = get_toplevel_nswindow (info->source_widget)) == NULL)
+ return G_SOURCE_REMOVE;
+
+ /* Ref the context. It's unreffed when the drag has been aborted */
+ g_object_ref (info->context);
+
+ /* FIXME: If the event isn't a mouse event, use the global cursor position instead */
+ point = [info->nsevent locationInWindow];
+
+ drag_image = _gtk_quartz_create_image_from_pixbuf (info->icon_pixbuf);
+ if (drag_image == NULL)
+ {
+ g_object_unref (info->context);
+ return G_SOURCE_REMOVE;
+ }
+
+ point.x -= info->hot_x;
+ point.y -= info->hot_y;
+
+ [nswindow dragImage:drag_image
+ at:point
+ offset:NSZeroSize
+ event:info->nsevent
+ pasteboard:pasteboard
+ source:nswindow
+ slideBack:YES];
+
+ [info->nsevent release];
+ [drag_image release];
+
+ [pool release];
+
+ return G_SOURCE_REMOVE;
+}
+/* Fake protocol to let us call GdkNSView gdkWindow without including
+ * gdk/GdkNSView.h (which we can't because it pulls in the internal-only
+ * gdkwindow.h).
+ */
+@protocol GdkNSView
+- (GdkWindow *)gdkWindow;
+@end
+