Index: gtk/drag_and_drop.c =================================================================== --- gtk/drag_and_drop.c (revision 35427) +++ gtk/drag_and_drop.c (working copy) @@ -52,6 +52,9 @@ #include "gtk/capture_globals.h" #endif +#ifdef HAVE_GTKOSXAPPLICATION +#include +#endif enum { DND_TARGET_STRING, DND_TARGET_ROOTWIN, DND_TARGET_URL }; @@ -361,6 +364,28 @@ } } +#ifdef HAVE_GTKOSXAPPLICATION +gboolean gtk_osx_openFile (GtkOSXApplication *app, gchar *path, gpointer user_data) +{ + GtkSelectionData selection_data; + int length = strlen(path); + + selection_data.length = length + 3; + selection_data.data = g_malloc(length + 3); + memcpy(selection_data.data, path, length); + + selection_data.data[length] = '\r'; + selection_data.data[length + 1] = '\n'; + selection_data.data[length + 2] = '\0'; + + dnd_data_received(NULL,NULL,0,0,&selection_data,DND_TARGET_URL,0,0); + + g_free(selection_data.data); + + return TRUE; +} +#endif + /* init the drag and drop functionality */ void dnd_init(GtkWidget *w) @@ -380,6 +405,9 @@ /* get notified, if some dnd coming in */ g_signal_connect(w, "drag_data_received", G_CALLBACK(dnd_data_received), NULL); +#ifdef HAVE_GTKOSXAPPLICATION + g_signal_connect(g_object_new(GTK_TYPE_OSX_APPLICATION, NULL), "NSApplicationOpenFile", G_CALLBACK(gtk_osx_openFile), NULL); +#endif }