/pidgin/main: be0d28873c0b: Pidgin: don't parent on windows bein...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Sep 13 07:06:38 EDT 2013


Changeset: be0d28873c0bfef7b7414ebd44f40a01d4264245
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2013-09-13 13:06 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/be0d28873c0b

Description:

Pidgin: don't parent on windows being destroyed

diffstat:

 pidgin/gtkrequest.c |   3 +++
 pidgin/gtkutils.c   |  19 ++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diffs (61 lines):

diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -124,6 +124,9 @@ generic_response_start(PidginRequestData
 
 	/* Tell the user we're doing something. */
 	pidgin_set_cursor(GTK_WIDGET(data->dialog), GDK_WATCH);
+
+	g_object_set_data(G_OBJECT(data->dialog),
+		"pidgin-window-is-closing", GINT_TO_POINTER(TRUE));
 }
 
 static void
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -2930,7 +2930,7 @@ gboolean pidgin_auto_parent_window(GtkWi
 #else
 	/* This finds the currently active window and makes that the parent window. */
 	GList *windows = NULL;
-	GtkWidget *parent = NULL;
+	GtkWindow *parent = NULL;
 	GdkEvent *event = gtk_get_current_event();
 	GdkWindow *menu = NULL;
 
@@ -2950,24 +2950,29 @@ gboolean pidgin_auto_parent_window(GtkWi
 
 	windows = gtk_window_list_toplevels();
 	while (windows) {
-		GtkWidget *window = windows->data;
+		GtkWindow *window = GTK_WINDOW(windows->data);
 		windows = g_list_delete_link(windows, windows);
 
-		if (window == widget ||
-				!gtk_widget_get_visible(window)) {
+		if (GTK_WIDGET(window) == widget ||
+				!gtk_widget_get_visible(GTK_WIDGET(window))) {
 			continue;
 		}
 
-		if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) ||
-				(menu && menu == gtk_widget_get_window(window))) {
+		if (gtk_window_has_toplevel_focus(window) ||
+				(menu && menu == gtk_widget_get_window(GTK_WIDGET(window)))) {
 			parent = window;
 			break;
 		}
 	}
 	if (windows)
 		g_list_free(windows);
+	if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent),
+		"pidgin-window-is-closing")))
+	{
+		parent = gtk_window_get_transient_for(parent);
+	}
 	if (parent) {
-		gtk_window_set_transient_for(GTK_WINDOW(widget), GTK_WINDOW(parent));
+		gtk_window_set_transient_for(GTK_WINDOW(widget), parent);
 		return TRUE;
 	}
 	return FALSE;



More information about the Commits mailing list