From 1e3dd9c8a5510144676ac1df4c4a21ca88a69bf5 Mon Sep 17 00:00:00 2001 From: Stefan Berzl Date: Sat, 16 Sep 2017 02:00:17 +0200 Subject: settings-dialog: Fix drag and drop of buttons Bug: 13861 Drag and Drop inside GtkSocket and GtkPlug doesn't work correctly. The drag_end handler isn't called when a button from "Button layout" is dragged. Fortunately, this only happens when the button is dragged onto the specified drag area. All we need to do is move the gtk_widget_show() function at the end of the drag-data-received handler. --- settings-dialogs/xfwm4-settings.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'settings-dialogs') diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c index 8d789722c..939d71a04 100644 --- a/settings-dialogs/xfwm4-settings.c +++ b/settings-dialogs/xfwm4-settings.c @@ -1103,6 +1103,7 @@ xfwm_settings_active_frame_drag_data (GtkWidget *widget, gtk_box_reorder_child (GTK_BOX (active_box), source, i); xfwm_settings_save_button_layout (settings, GTK_CONTAINER (active_box)); + gtk_widget_show (source); } @@ -1193,15 +1194,17 @@ xfwm_settings_hidden_frame_drag_data (GtkWidget *widget, hidden_box = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, "hidden-box")); active_box = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, "active-box")); - if (G_UNLIKELY (parent == hidden_box)) - return; + if (G_LIKELY (parent != hidden_box)) + { + g_object_ref (source); + gtk_container_remove (GTK_CONTAINER (parent), source); + gtk_box_pack_start (GTK_BOX (hidden_box), source, FALSE, FALSE, 0); + g_object_unref (source); - g_object_ref (source); - gtk_container_remove (GTK_CONTAINER (parent), source); - gtk_box_pack_start (GTK_BOX (hidden_box), source, FALSE, FALSE, 0); - g_object_unref (source); + xfwm_settings_save_button_layout (settings, GTK_CONTAINER (active_box)); + } - xfwm_settings_save_button_layout (settings, GTK_CONTAINER (active_box)); + gtk_widget_show (source); } @@ -1236,7 +1239,6 @@ xfwm_settings_title_button_drag_data (GtkWidget *widget, name = gtk_buildable_get_name (GTK_BUILDABLE (widget)); - gtk_widget_hide (widget); gtk_selection_data_set (data, gdk_atom_intern ("_xfwm4_button_layout", FALSE), 8, (const guchar *)name, strlen (name)); } -- cgit v1.2.1