git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4114
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
if (!ret)
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
if (!ret)
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
/* cancel the whole thing */
gtk_drag_finish( context,
FALSE, /* no success */
/* cancel the whole thing */
gtk_drag_finish( context,
FALSE, /* no success */
else
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
else
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
#if wxUSE_THREADS
/* disable GUI threads */
wxapp_uninstall_thread_wakeup();
#endif
GdkAtom format = drop_target->GetMatchingPair();
#if wxUSE_THREADS
/* disable GUI threads */
wxapp_uninstall_thread_wakeup();
#endif
GdkAtom format = drop_target->GetMatchingPair();
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( widget,
context,
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( widget,
context,
if (drop_target->OnData( x, y ))
{
wxLogDebug( wxT( "Drop target: OnData returned TRUE") );
if (drop_target->OnData( x, y ))
{
wxLogDebug( wxT( "Drop target: OnData returned TRUE") );
/* tell GTK that data transfer was successfull */
gtk_drag_finish( context, TRUE, FALSE, time );
}
else
{
wxLogDebug( wxT( "Drop target: OnData returned FALSE") );
/* tell GTK that data transfer was successfull */
gtk_drag_finish( context, TRUE, FALSE, time );
}
else
{
wxLogDebug( wxT( "Drop target: OnData returned FALSE") );
/* tell GTK that data transfer was not successfull */
gtk_drag_finish( context, FALSE, FALSE, time );
}
/* tell GTK that data transfer was not successfull */
gtk_drag_finish( context, FALSE, FALSE, time );
}
wxCoord WXUNUSED(y),
wxDragResult def )
{
wxCoord WXUNUSED(y),
wxDragResult def )
{
- if (!m_dataObject)
- return FALSE;
-
+ // GetMatchingPair() checks for m_dataObject too, no need to do it here
+
+ // disable the debug message from GetMatchingPair() - there are too many
+ // of them otherwise
+#ifdef __WXDEBUG__
+ wxLogNull noLog;
+#endif // Debug
+
return (GetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
}
return (GetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
}
{
if (!m_dataObject)
return FALSE;
{
if (!m_dataObject)
return FALSE;
return (GetMatchingPair() != (GdkAtom) 0);
}
return (GetMatchingPair() != (GdkAtom) 0);
}
{
if (!m_dataObject)
return FALSE;
{
if (!m_dataObject)
return FALSE;
if (GetMatchingPair() == (GdkAtom) 0)
return FALSE;
if (GetMatchingPair() == (GdkAtom) 0)
return FALSE;
while (child)
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
while (child)
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
- wxDataFormat format( formatAtom );
+ wxDataFormat format( formatAtom );
#ifdef __WXDEBUG__
char *name = gdk_atom_name( formatAtom );
#ifdef __WXDEBUG__
char *name = gdk_atom_name( formatAtom );
- if (name) wxLogDebug( "Drop target: drag has format: %s", name );
-#endif
+ wxLogDebug("Drop target: drag has format: %s", name ? name : "unnamed");
+#endif // Debug
+
if (m_dataObject->IsSupportedFormat( format ))
if (m_dataObject->IsSupportedFormat( format ))
{
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
text_object->SetText( (const char*)m_dragData->data );
{
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
text_object->SetText( (const char*)m_dragData->data );
}
if (dragFormat.GetType() == wxDF_FILENAME)
{
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
file_object->SetData( 0, (const char*)m_dragData->data );
}
if (dragFormat.GetType() == wxDF_FILENAME)
{
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
file_object->SetData( 0, (const char*)m_dragData->data );
}
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
}
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
if (!data)
{
wxLogDebug( wxT("Drop source: no data object") );
if (!data)
{
wxLogDebug( wxT("Drop source: no data object") );
}
if (!data->IsSupportedFormat(format))
{
wxLogDebug( wxT("Drop source: unsupported format") );
}
if (!data->IsSupportedFormat(format))
{
wxLogDebug( wxT("Drop source: unsupported format") );
}
if (data->GetDataSize(format) == 0)
{
wxLogDebug( wxT("Drop source: empty data") );
}
if (data->GetDataSize(format) == 0)
{
wxLogDebug( wxT("Drop source: empty data") );
}
size_t size = data->GetDataSize(format);
}
size_t size = data->GetDataSize(format);
if (!data->GetDataHere( format, (void*)d ))
{
delete[] d;
if (!data->GetDataHere( format, (void*)d ))
{
delete[] d;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
g_blockEventsOnDrag = TRUE;
RegisterWindow();
g_blockEventsOnDrag = TRUE;
RegisterWindow();
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
{
GdkAtom atom = array[i];
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
{
GdkAtom atom = array[i];
- wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
+ wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
gtk_target_list_add( target_list, atom, 0, 0 );
}
delete[] array;
gtk_target_list_add( target_list, atom, 0, 0 );
}
delete[] array;
if (!ret)
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
if (!ret)
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
/* cancel the whole thing */
gtk_drag_finish( context,
FALSE, /* no success */
/* cancel the whole thing */
gtk_drag_finish( context,
FALSE, /* no success */
else
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
else
{
wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") );
#if wxUSE_THREADS
/* disable GUI threads */
wxapp_uninstall_thread_wakeup();
#endif
GdkAtom format = drop_target->GetMatchingPair();
#if wxUSE_THREADS
/* disable GUI threads */
wxapp_uninstall_thread_wakeup();
#endif
GdkAtom format = drop_target->GetMatchingPair();
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( widget,
context,
/* this should trigger an "drag_data_received" event */
gtk_drag_get_data( widget,
context,
if (drop_target->OnData( x, y ))
{
wxLogDebug( wxT( "Drop target: OnData returned TRUE") );
if (drop_target->OnData( x, y ))
{
wxLogDebug( wxT( "Drop target: OnData returned TRUE") );
/* tell GTK that data transfer was successfull */
gtk_drag_finish( context, TRUE, FALSE, time );
}
else
{
wxLogDebug( wxT( "Drop target: OnData returned FALSE") );
/* tell GTK that data transfer was successfull */
gtk_drag_finish( context, TRUE, FALSE, time );
}
else
{
wxLogDebug( wxT( "Drop target: OnData returned FALSE") );
/* tell GTK that data transfer was not successfull */
gtk_drag_finish( context, FALSE, FALSE, time );
}
/* tell GTK that data transfer was not successfull */
gtk_drag_finish( context, FALSE, FALSE, time );
}
wxCoord WXUNUSED(y),
wxDragResult def )
{
wxCoord WXUNUSED(y),
wxDragResult def )
{
- if (!m_dataObject)
- return FALSE;
-
+ // GetMatchingPair() checks for m_dataObject too, no need to do it here
+
+ // disable the debug message from GetMatchingPair() - there are too many
+ // of them otherwise
+#ifdef __WXDEBUG__
+ wxLogNull noLog;
+#endif // Debug
+
return (GetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
}
return (GetMatchingPair() != (GdkAtom) 0) ? def : wxDragNone;
}
{
if (!m_dataObject)
return FALSE;
{
if (!m_dataObject)
return FALSE;
return (GetMatchingPair() != (GdkAtom) 0);
}
return (GetMatchingPair() != (GdkAtom) 0);
}
{
if (!m_dataObject)
return FALSE;
{
if (!m_dataObject)
return FALSE;
if (GetMatchingPair() == (GdkAtom) 0)
return FALSE;
if (GetMatchingPair() == (GdkAtom) 0)
return FALSE;
while (child)
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
while (child)
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
- wxDataFormat format( formatAtom );
+ wxDataFormat format( formatAtom );
#ifdef __WXDEBUG__
char *name = gdk_atom_name( formatAtom );
#ifdef __WXDEBUG__
char *name = gdk_atom_name( formatAtom );
- if (name) wxLogDebug( "Drop target: drag has format: %s", name );
-#endif
+ wxLogDebug("Drop target: drag has format: %s", name ? name : "unnamed");
+#endif // Debug
+
if (m_dataObject->IsSupportedFormat( format ))
if (m_dataObject->IsSupportedFormat( format ))
{
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
text_object->SetText( (const char*)m_dragData->data );
{
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
text_object->SetText( (const char*)m_dragData->data );
}
if (dragFormat.GetType() == wxDF_FILENAME)
{
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
file_object->SetData( 0, (const char*)m_dragData->data );
}
if (dragFormat.GetType() == wxDF_FILENAME)
{
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
file_object->SetData( 0, (const char*)m_dragData->data );
}
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
}
m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
if (!data)
{
wxLogDebug( wxT("Drop source: no data object") );
if (!data)
{
wxLogDebug( wxT("Drop source: no data object") );
}
if (!data->IsSupportedFormat(format))
{
wxLogDebug( wxT("Drop source: unsupported format") );
}
if (!data->IsSupportedFormat(format))
{
wxLogDebug( wxT("Drop source: unsupported format") );
}
if (data->GetDataSize(format) == 0)
{
wxLogDebug( wxT("Drop source: empty data") );
}
if (data->GetDataSize(format) == 0)
{
wxLogDebug( wxT("Drop source: empty data") );
}
size_t size = data->GetDataSize(format);
}
size_t size = data->GetDataSize(format);
if (!data->GetDataHere( format, (void*)d ))
{
delete[] d;
if (!data->GetDataHere( format, (void*)d ))
{
delete[] d;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
g_blockEventsOnDrag = TRUE;
RegisterWindow();
g_blockEventsOnDrag = TRUE;
RegisterWindow();
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
{
GdkAtom atom = array[i];
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
{
GdkAtom atom = array[i];
- wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
+ wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
gtk_target_list_add( target_list, atom, 0, 0 );
}
delete[] array;
gtk_target_list_add( target_list, atom, 0, 0 );
}
delete[] array;