| 2928 return FALSE; |
2928 return FALSE; |
| 2929 #endif |
2929 #endif |
| 2930 #else |
2930 #else |
| 2931 /* This finds the currently active window and makes that the parent window. */ |
2931 /* This finds the currently active window and makes that the parent window. */ |
| 2932 GList *windows = NULL; |
2932 GList *windows = NULL; |
| 2933 GtkWidget *parent = NULL; |
2933 GtkWindow *parent = NULL; |
| 2934 GdkEvent *event = gtk_get_current_event(); |
2934 GdkEvent *event = gtk_get_current_event(); |
| 2935 GdkWindow *menu = NULL; |
2935 GdkWindow *menu = NULL; |
| 2936 |
2936 |
| 2937 if (event == NULL) |
2937 if (event == NULL) |
| 2938 /* The window was not triggered by a user action. */ |
2938 /* The window was not triggered by a user action. */ |
| 2948 } else if (event->type == GDK_KEY_PRESS) |
2948 } else if (event->type == GDK_KEY_PRESS) |
| 2949 menu = event->key.window; |
2949 menu = event->key.window; |
| 2950 |
2950 |
| 2951 windows = gtk_window_list_toplevels(); |
2951 windows = gtk_window_list_toplevels(); |
| 2952 while (windows) { |
2952 while (windows) { |
| 2953 GtkWidget *window = windows->data; |
2953 GtkWindow *window = GTK_WINDOW(windows->data); |
| 2954 windows = g_list_delete_link(windows, windows); |
2954 windows = g_list_delete_link(windows, windows); |
| 2955 |
2955 |
| 2956 if (window == widget || |
2956 if (GTK_WIDGET(window) == widget || |
| 2957 !gtk_widget_get_visible(window)) { |
2957 !gtk_widget_get_visible(GTK_WIDGET(window))) { |
| 2958 continue; |
2958 continue; |
| 2959 } |
2959 } |
| 2960 |
2960 |
| 2961 if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) || |
2961 if (gtk_window_has_toplevel_focus(window) || |
| 2962 (menu && menu == gtk_widget_get_window(window))) { |
2962 (menu && menu == gtk_widget_get_window(GTK_WIDGET(window)))) { |
| 2963 parent = window; |
2963 parent = window; |
| 2964 break; |
2964 break; |
| 2965 } |
2965 } |
| 2966 } |
2966 } |
| 2967 if (windows) |
2967 if (windows) |
| 2968 g_list_free(windows); |
2968 g_list_free(windows); |
| |
2969 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent), |
| |
2970 "pidgin-window-is-closing"))) |
| |
2971 { |
| |
2972 parent = gtk_window_get_transient_for(parent); |
| |
2973 } |
| 2969 if (parent) { |
2974 if (parent) { |
| 2970 gtk_window_set_transient_for(GTK_WINDOW(widget), GTK_WINDOW(parent)); |
2975 gtk_window_set_transient_for(GTK_WINDOW(widget), parent); |
| 2971 return TRUE; |
2976 return TRUE; |
| 2972 } |
2977 } |
| 2973 return FALSE; |
2978 return FALSE; |
| 2974 #endif |
2979 #endif |
| 2975 } |
2980 } |