- case wxDF_TEXT:
- if (i > 0) formats += ";";
- formats += "text/plain";
- valid++;
- break;
- case wxDF_FILENAME:
- if (i > 0) formats += ";";
- formats += "url:any";
- valid++;
- break;
- default:
- break;
- };
- }
-
- char *str = WXSTRINGCAST formats;
-
- gtk_widget_dnd_drop_set( widget, TRUE, &str, valid, FALSE );
-};
+ // cancel the whole thing
+ gtk_drag_finish( context,
+ FALSE, // no success
+ FALSE, // don't delete data on dropping side
+ time );
+
+ drop_target->GTKSetDragContext( NULL );
+
+ drop_target->m_firstMotion = true;
+
+ return FALSE;
+ }
+
+ /* inform the wxDropTarget about the current drag widget.
+ this is only valid for the duration of this call */
+ drop_target->GTKSetDragWidget( widget );
+
+ /* inform the wxDropTarget about the current drag time.
+ this is only valid for the duration of this call */
+ drop_target->GTKSetDragTime( time );
+
+ /* reset the block here as someone might very well
+ show a dialog as a reaction to a drop and this
+ wouldn't work without events */
+ g_blockEventsOnDrag = false;
+
+ bool ret = drop_target->OnDrop( x, y );
+
+ if (!ret)
+ {
+ wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned FALSE") );
+
+ /* cancel the whole thing */
+ gtk_drag_finish( context,
+ FALSE, /* no success */
+ FALSE, /* don't delete data on dropping side */
+ time );
+ }
+ else
+ {
+ wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned true") );
+
+ GdkAtom format = drop_target->GTKGetMatchingPair();
+
+ // this does happen somehow, see bug 555111
+ wxCHECK_MSG( format, FALSE, wxT("no matching GdkAtom for format?") );
+
+ /* this should trigger an "drag_data_received" event */
+ gtk_drag_get_data( widget,
+ context,
+ format,
+ time );
+ }
+
+ /* after this, invalidate the drop_target's GdkDragContext */
+ drop_target->GTKSetDragContext( NULL );
+
+ /* after this, invalidate the drop_target's drag widget */
+ drop_target->GTKSetDragWidget( NULL );
+
+ /* this has to be done because GDK has no "drag_enter" event */
+ drop_target->m_firstMotion = true;
+
+ return ret;
+}
+}