Fix calling wxGTK wxDropTarget::GetMatchingPair() from OnData()

This function didn't work at all in this case because the drag context
wasn't set in target_drag_data_received(), unlike in all the other
callbacks.

Do set it here too to fix it, this notably makes dropping data on
generic wxDataViewCtrl work correctly in wxGTK.

Closes #22453.
This commit is contained in:
valid-ptr 2022-05-24 18:23:19 +03:00 committed by Vadim Zeitlin
parent 01c8978690
commit 76797ab9e1

View File

@ -373,8 +373,9 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
wxLogTrace(TRACE_DND, wxT( "Drop target: data received event") ); wxLogTrace(TRACE_DND, wxT( "Drop target: data received event") );
/* inform the wxDropTarget about the current GtkSelectionData. /* Inform the wxDropTarget about the current GtkSelectionData and GdkDragContext.
this is only valid for the duration of this call */ This is only valid for the duration of this call. */
drop_target->GTKSetDragContext( context );
drop_target->GTKSetDragData( data ); drop_target->GTKSetDragData( data );
wxDragResult result = ConvertFromGTK(gdk_drag_context_get_selected_action(context)); wxDragResult result = ConvertFromGTK(gdk_drag_context_get_selected_action(context));
@ -394,8 +395,9 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
gtk_drag_finish( context, FALSE, FALSE, time ); gtk_drag_finish( context, FALSE, FALSE, time );
} }
/* after this, invalidate the drop_target's drag data */ /* after this, invalidate the drop_target's GtkSelectionData and GdkDragContext */
drop_target->GTKSetDragData( NULL ); drop_target->GTKSetDragData( NULL );
drop_target->GTKSetDragContext( NULL );
} }
} }