notebook: Stop using gtk_drag_get_source

This commit is contained in:
Matthias Clasen 2020-01-06 20:02:33 -05:00
parent bd20ae4fa5
commit df050c51bb

View File

@ -2901,6 +2901,8 @@ gtk_notebook_motion (GtkEventController *controller,
priv->operation = DRAG_OPERATION_DETACH; priv->operation = DRAG_OPERATION_DETACH;
tab_drag_end (notebook, priv->cur_page); tab_drag_end (notebook, priv->cur_page);
g_object_set_data (G_OBJECT (drag), "gtk-notebook-drag-origin", notebook);
g_object_unref (drag); g_object_unref (drag);
return; return;
@ -3229,8 +3231,7 @@ gtk_notebook_drag_motion (GtkDropTarget *dest,
} }
else else
{ {
GtkDragSource *drag_source = gtk_drag_get_source (drag); GtkNotebook *source = GTK_NOTEBOOK (g_object_get_data (G_OBJECT (drag), "gtk-notebook-drag-origin"));
GtkNotebook *source = GTK_NOTEBOOK (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (drag_source)));
g_assert (source->priv->cur_page != NULL); g_assert (source->priv->cur_page != NULL);
source_child = source->priv->cur_page->child; source_child = source->priv->cur_page->child;
@ -7092,13 +7093,11 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
* gpointer user_data) * gpointer user_data)
* { * {
* GtkDrag *drag; * GtkDrag *drag;
* GtkDragSource *source;
* GtkWidget *notebook; * GtkWidget *notebook;
* GtkWidget **child; * GtkWidget **child;
* *
* drag = gtk_drop_get_drag (drop); * drag = gtk_drop_get_drag (drop);
* source = gtk_drag_get_source (drag); * notebook = g_object_get_data (drag, "gtk-notebook-drag-origin");
* notebook = gtk_event_controller_get_widge (GTK_EVENT_CONTROLLER (source));
* child = (void*) gtk_selection_data_get_data (data); * child = (void*) gtk_selection_data_get_data (data);
* *
* // process_widget (*child); * // process_widget (*child);