X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/91fca3d2bd12f507d3b3c4f026752e94b88784bf..dd9f8b6bb6935360a8271dc3e8749fb026b601a8:/src/gtk1/dnd.cpp?ds=inline diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index 2295ecef46..47ce58b017 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -56,10 +56,11 @@ static long gs_flagsForDrag = 0; // the trace mask we use with wxLogTrace() - call // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here // (there are quite a few of them, so don't enable this by default) -static const wxChar *TRACE_DND = _T("dnd"); +#define TRACE_DND _T("dnd") +// global variables because GTK+ DnD want to have the +// mouse event that caused it extern GdkEvent *g_lastMouseEvent; - extern int g_lastButtonNumber; //---------------------------------------------------------------------------- @@ -676,7 +677,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), extern "C" { static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), - GdkDragContext *context, + GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) { if (g_isIdle) @@ -855,6 +856,14 @@ wxDragResult wxDropSource::DoDragDrop(int flags) if (g_blockEventsOnDrag) return wxDragNone; + // don't start dragging if no button is down + if (g_lastButtonNumber == 0) + return wxDragNone; + + // we can only start a drag after a mouse event + if (g_lastMouseEvent == NULL) + return wxDragNone; + // disabled for now g_blockEventsOnDrag = true; @@ -875,9 +884,6 @@ wxDragResult wxDropSource::DoDragDrop(int flags) } delete[] array; - /* don't start dragging if no button is down */ - if (g_lastButtonNumber) - { int action = GDK_ACTION_COPY; if ( flags & wxDrag_AllowMove ) action |= GDK_ACTION_MOVE; @@ -903,7 +909,6 @@ wxDragResult wxDropSource::DoDragDrop(int flags) m_retValue = ConvertFromGTK(context->action); if ( m_retValue == wxDragNone ) m_retValue = wxDragCancel; - } g_blockEventsOnDrag = false;