From 76797ab9e10967716b941999f72363629713573e Mon Sep 17 00:00:00 2001 From: valid-ptr Date: Tue, 24 May 2022 18:23:19 +0300 Subject: [PATCH] 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. --- src/gtk/dnd.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index 2638a0ccff..542a73bfda 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -373,8 +373,9 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), wxLogTrace(TRACE_DND, wxT( "Drop target: data received event") ); - /* inform the wxDropTarget about the current GtkSelectionData. - this is only valid for the duration of this call */ + /* Inform the wxDropTarget about the current GtkSelectionData and GdkDragContext. + This is only valid for the duration of this call. */ + drop_target->GTKSetDragContext( context ); drop_target->GTKSetDragData( data ); 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 ); } - /* 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->GTKSetDragContext( NULL ); } }