Merge branch 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface

* 'drag-n-drop-fix' of git://github.com/dirkhh/subsurface:
  Fix drag and drop error
This commit is contained in:
Linus Torvalds 2011-11-02 14:43:07 -07:00
commit 81f013f3f1

View file

@ -694,23 +694,21 @@ static GtkNotebook *create_new_notebook_window(GtkNotebook *source,
return GTK_NOTEBOOK(notebook); return GTK_NOTEBOOK(notebook);
} }
static void drag_cb(GtkWidget *widget, GdkDragContext *context, static gboolean drag_cb(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time, gint x, gint y, guint time,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *source; GtkWidget *source;
notebook_data_t *nbdp; notebook_data_t *nbdp;
gtk_drag_finish(context, TRUE, TRUE, time);
source = gtk_drag_get_source_widget(context); source = gtk_drag_get_source_widget(context);
if (nbd[0].name && ! strcmp(nbd[0].name,gtk_widget_get_name(source))) if (nbd[0].name && ! strcmp(nbd[0].name,gtk_widget_get_name(source)))
nbdp = nbd; nbdp = nbd;
else if (nbd[1].name && ! strcmp(nbd[1].name,gtk_widget_get_name(source))) else if (nbd[1].name && ! strcmp(nbd[1].name,gtk_widget_get_name(source)))
nbdp = nbd + 1; nbdp = nbd + 1;
else else /* just on ourselves */
/* HU? */ return TRUE;
return;
gtk_drag_finish(context, TRUE, TRUE, time);
/* we no longer need the widget - but getting rid of this is hard; /* we no longer need the widget - but getting rid of this is hard;
* remove the signal handler, remove the notebook from the box * remove the signal handler, remove the notebook from the box
@ -722,6 +720,8 @@ static void drag_cb(GtkWidget *widget, GdkDragContext *context,
nbdp->widget = NULL; nbdp->widget = NULL;
free(nbdp->name); free(nbdp->name);
nbdp->name = NULL; nbdp->name = NULL;
return TRUE;
} }
#ifdef WIN32 #ifdef WIN32