minor change: disable debug messages flood from OnDragOver
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -276,7 +276,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GdkAtom format = drop_target->GetMatchingPair();
|
GdkAtom format = drop_target->GetMatchingPair();
|
||||||
wxASSERT( format );
|
wxASSERT( format );
|
||||||
|
|
||||||
/* this should trigger an "drag_data_received" event */
|
/* this should trigger an "drag_data_received" event */
|
||||||
gtk_drag_get_data( widget,
|
gtk_drag_get_data( widget,
|
||||||
@@ -373,8 +373,13 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
|
|||||||
wxCoord WXUNUSED(y),
|
wxCoord WXUNUSED(y),
|
||||||
wxDragResult def )
|
wxDragResult def )
|
||||||
{
|
{
|
||||||
if (!m_dataObject)
|
// GetMatchingPair() checks for m_dataObject too, no need to do it here
|
||||||
return FALSE;
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
@@ -410,14 +415,15 @@ GdkAtom wxDropTarget::GetMatchingPair()
|
|||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
|
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
|
||||||
wxDataFormat format( formatAtom );
|
wxDataFormat format( formatAtom );
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
char *name = gdk_atom_name( formatAtom );
|
char *name = gdk_atom_name( formatAtom );
|
||||||
if (name) wxLogDebug( "Drop target: drag has format: %s", name );
|
wxLogDebug("Drop target: drag has format: %s", name ? name : "unnamed");
|
||||||
#endif
|
#endif // Debug
|
||||||
|
|
||||||
if (m_dataObject->IsSupportedFormat( format ))
|
if (m_dataObject->IsSupportedFormat( format ))
|
||||||
return formatAtom;
|
return formatAtom;
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -442,14 +448,14 @@ bool wxDropTarget::GetData()
|
|||||||
{
|
{
|
||||||
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
|
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
|
||||||
text_object->SetText( (const char*)m_dragData->data );
|
text_object->SetText( (const char*)m_dragData->data );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragFormat.GetType() == wxDF_FILENAME)
|
if (dragFormat.GetType() == wxDF_FILENAME)
|
||||||
{
|
{
|
||||||
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
|
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
|
||||||
file_object->SetData( 0, (const char*)m_dragData->data );
|
file_object->SetData( 0, (const char*)m_dragData->data );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
||||||
@@ -569,19 +575,19 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: no data object") );
|
wxLogDebug( wxT("Drop source: no data object") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data->IsSupportedFormat(format))
|
if (!data->IsSupportedFormat(format))
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: unsupported format") );
|
wxLogDebug( wxT("Drop source: unsupported format") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->GetDataSize(format) == 0)
|
if (data->GetDataSize(format) == 0)
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: empty data") );
|
wxLogDebug( wxT("Drop source: empty data") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = data->GetDataSize(format);
|
size_t size = data->GetDataSize(format);
|
||||||
@@ -593,7 +599,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (!data->GetDataHere( format, (void*)d ))
|
if (!data->GetDataHere( format, (void*)d ))
|
||||||
{
|
{
|
||||||
delete[] d;
|
delete[] d;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
@@ -734,7 +740,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
|
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
|
||||||
{
|
{
|
||||||
GdkAtom atom = array[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 );
|
gtk_target_list_add( target_list, atom, 0, 0 );
|
||||||
}
|
}
|
||||||
delete[] array;
|
delete[] array;
|
||||||
|
@@ -276,7 +276,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GdkAtom format = drop_target->GetMatchingPair();
|
GdkAtom format = drop_target->GetMatchingPair();
|
||||||
wxASSERT( format );
|
wxASSERT( format );
|
||||||
|
|
||||||
/* this should trigger an "drag_data_received" event */
|
/* this should trigger an "drag_data_received" event */
|
||||||
gtk_drag_get_data( widget,
|
gtk_drag_get_data( widget,
|
||||||
@@ -373,8 +373,13 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
|
|||||||
wxCoord WXUNUSED(y),
|
wxCoord WXUNUSED(y),
|
||||||
wxDragResult def )
|
wxDragResult def )
|
||||||
{
|
{
|
||||||
if (!m_dataObject)
|
// GetMatchingPair() checks for m_dataObject too, no need to do it here
|
||||||
return FALSE;
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
@@ -410,14 +415,15 @@ GdkAtom wxDropTarget::GetMatchingPair()
|
|||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
|
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
|
||||||
wxDataFormat format( formatAtom );
|
wxDataFormat format( formatAtom );
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
char *name = gdk_atom_name( formatAtom );
|
char *name = gdk_atom_name( formatAtom );
|
||||||
if (name) wxLogDebug( "Drop target: drag has format: %s", name );
|
wxLogDebug("Drop target: drag has format: %s", name ? name : "unnamed");
|
||||||
#endif
|
#endif // Debug
|
||||||
|
|
||||||
if (m_dataObject->IsSupportedFormat( format ))
|
if (m_dataObject->IsSupportedFormat( format ))
|
||||||
return formatAtom;
|
return formatAtom;
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -442,14 +448,14 @@ bool wxDropTarget::GetData()
|
|||||||
{
|
{
|
||||||
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
|
wxTextDataObject *text_object = (wxTextDataObject*)m_dataObject;
|
||||||
text_object->SetText( (const char*)m_dragData->data );
|
text_object->SetText( (const char*)m_dragData->data );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragFormat.GetType() == wxDF_FILENAME)
|
if (dragFormat.GetType() == wxDF_FILENAME)
|
||||||
{
|
{
|
||||||
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
|
wxFileDataObject *file_object = (wxFileDataObject*)m_dataObject;
|
||||||
file_object->SetData( 0, (const char*)m_dragData->data );
|
file_object->SetData( 0, (const char*)m_dragData->data );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
||||||
@@ -569,19 +575,19 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: no data object") );
|
wxLogDebug( wxT("Drop source: no data object") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data->IsSupportedFormat(format))
|
if (!data->IsSupportedFormat(format))
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: unsupported format") );
|
wxLogDebug( wxT("Drop source: unsupported format") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->GetDataSize(format) == 0)
|
if (data->GetDataSize(format) == 0)
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Drop source: empty data") );
|
wxLogDebug( wxT("Drop source: empty data") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = data->GetDataSize(format);
|
size_t size = data->GetDataSize(format);
|
||||||
@@ -593,7 +599,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (!data->GetDataHere( format, (void*)d ))
|
if (!data->GetDataHere( format, (void*)d ))
|
||||||
{
|
{
|
||||||
delete[] d;
|
delete[] d;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
@@ -734,7 +740,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
|
for (size_t i = 0; i < m_data->GetFormatCount(); i++)
|
||||||
{
|
{
|
||||||
GdkAtom atom = array[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 );
|
gtk_target_list_add( target_list, atom, 0, 0 );
|
||||||
}
|
}
|
||||||
delete[] array;
|
delete[] array;
|
||||||
|
Reference in New Issue
Block a user