forked from AuroraMiddleware/gtk
Better handling of the window group on unsetting transient-for, since the
2006-05-12 Alexander Larsson <alexl@redhat.com> * gtk/gtkwindow.c: Better handling of the window group on unsetting transient-for, since the transient parent might have changed group. * gtk/gtkmenu.c: Combine the handling of transient for the attach-widget and the window group handling by setting transient-to on popup/popdown only. See bug #340401 * gtk/gtkprintunixdialog.c: Remove part of old fix no longer needed.
This commit is contained in:
parent
0d8743ebc9
commit
d8f1ce735c
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2006-05-12 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c:
|
||||
Better handling of the window group on unsetting transient-for, since
|
||||
the transient parent might have changed group.
|
||||
|
||||
* gtk/gtkmenu.c:
|
||||
Combine the handling of transient for the attach-widget and the
|
||||
window group handling by setting transient-to on popup/popdown only.
|
||||
|
||||
See bug #340401
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Remove part of old fix no longer needed.
|
||||
|
||||
2006-05-12 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c (gtk_print_operation_set_n_pages):
|
||||
|
@ -1,3 +1,18 @@
|
||||
2006-05-12 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c:
|
||||
Better handling of the window group on unsetting transient-for, since
|
||||
the transient parent might have changed group.
|
||||
|
||||
* gtk/gtkmenu.c:
|
||||
Combine the handling of transient for the attach-widget and the
|
||||
window group handling by setting transient-to on popup/popdown only.
|
||||
|
||||
See bug #340401
|
||||
|
||||
* gtk/gtkprintunixdialog.c:
|
||||
Remove part of old fix no longer needed.
|
||||
|
||||
2006-05-12 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c (gtk_print_operation_set_n_pages):
|
||||
|
@ -1004,33 +1004,6 @@ attach_widget_screen_changed (GtkWidget *attach_widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
attach_widget_hierarchy_changed (GtkWidget *attach_widget,
|
||||
GtkWidget *previous_toplevel,
|
||||
gpointer data)
|
||||
{
|
||||
GtkMenu *menu = GTK_MENU (data);
|
||||
GtkWidget *new_toplevel = gtk_widget_get_toplevel (attach_widget);
|
||||
|
||||
if (g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
|
||||
{
|
||||
/* If there is an explicit screen set, then don't set WM_TRANSIENT_FOR.
|
||||
* Because, what would happen if the attach widget moved to a different
|
||||
* screen on a different display? The menu wouldn't move along with it,
|
||||
* so we just make it the responsibility of whoever set the screen to
|
||||
* also set WM_TRANSIENT_FOR.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu->toplevel && !g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen") &&
|
||||
(!new_toplevel || GTK_IS_WINDOW (new_toplevel)))
|
||||
{
|
||||
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel),
|
||||
GTK_WINDOW (new_toplevel));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_menu_attach_to_widget (GtkMenu *menu,
|
||||
GtkWidget *attach_widget,
|
||||
@ -1062,10 +1035,6 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
|
||||
G_CALLBACK (attach_widget_screen_changed), menu);
|
||||
attach_widget_screen_changed (attach_widget, NULL, menu);
|
||||
|
||||
g_signal_connect (attach_widget, "hierarchy_changed",
|
||||
G_CALLBACK (attach_widget_hierarchy_changed), menu);
|
||||
attach_widget_hierarchy_changed (attach_widget, NULL, menu);
|
||||
|
||||
data->detacher = detacher;
|
||||
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), data);
|
||||
list = g_object_steal_data (G_OBJECT (attach_widget), ATTACHED_MENUS);
|
||||
@ -1120,10 +1089,6 @@ gtk_menu_detach (GtkMenu *menu)
|
||||
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||
(gpointer) attach_widget_screen_changed,
|
||||
menu);
|
||||
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||
(gpointer) attach_widget_hierarchy_changed,
|
||||
menu);
|
||||
attach_widget_hierarchy_changed (data->attach_widget, NULL, menu);
|
||||
|
||||
if (data->detacher)
|
||||
data->detacher (data->attach_widget, menu);
|
||||
@ -1307,6 +1272,7 @@ gtk_menu_popup (GtkMenu *menu,
|
||||
GtkMenuShell *menu_shell;
|
||||
gboolean grab_keyboard;
|
||||
GtkMenuPrivate *priv;
|
||||
GtkWidget *parent_toplevel;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
@ -1413,16 +1379,21 @@ gtk_menu_popup (GtkMenu *menu,
|
||||
|
||||
gtk_menu_reparent (menu, menu->toplevel, FALSE);
|
||||
}
|
||||
|
||||
if (parent_menu_shell)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (parent_menu_shell);
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
|
||||
GTK_WINDOW (menu->toplevel));
|
||||
parent_toplevel = NULL;
|
||||
if (parent_menu_shell)
|
||||
parent_toplevel = gtk_widget_get_toplevel (parent_menu_shell);
|
||||
else if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
|
||||
{
|
||||
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
|
||||
if (attach_widget)
|
||||
parent_toplevel = gtk_widget_get_toplevel (attach_widget);
|
||||
}
|
||||
|
||||
/* Set transient for to get the right window group and parent relationship */
|
||||
if (parent_toplevel && GTK_IS_WINDOW (parent_toplevel))
|
||||
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel),
|
||||
GTK_WINDOW (parent_toplevel));
|
||||
|
||||
menu->parent_menu_item = parent_menu_item;
|
||||
menu->position_func = func;
|
||||
@ -1473,14 +1444,12 @@ gtk_menu_popdown (GtkMenu *menu)
|
||||
{
|
||||
GtkMenuPrivate *private;
|
||||
GtkMenuShell *menu_shell;
|
||||
gboolean had_parent;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
menu_shell = GTK_MENU_SHELL (menu);
|
||||
private = gtk_menu_get_private (menu);
|
||||
|
||||
had_parent = menu_shell->parent_menu_shell != NULL;
|
||||
menu_shell->parent_menu_shell = NULL;
|
||||
menu_shell->active = FALSE;
|
||||
menu_shell->ignore_enter = FALSE;
|
||||
@ -1504,8 +1473,7 @@ gtk_menu_popdown (GtkMenu *menu)
|
||||
/* The X Grab, if present, will automatically be removed when we hide
|
||||
* the window */
|
||||
gtk_widget_hide (menu->toplevel);
|
||||
if (had_parent)
|
||||
gtk_window_group_add_window (gtk_window_get_group (NULL), GTK_WINDOW (menu->toplevel));
|
||||
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL);
|
||||
|
||||
if (menu->torn_off)
|
||||
{
|
||||
|
@ -58,9 +58,6 @@
|
||||
|
||||
static void gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog);
|
||||
static void gtk_print_unix_dialog_finalize (GObject *object);
|
||||
static GObject* gtk_print_unix_dialog_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_params);
|
||||
static void gtk_print_unix_dialog_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
@ -209,7 +206,6 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
|
||||
object_class->finalize = gtk_print_unix_dialog_finalize;
|
||||
object_class->constructor = gtk_print_unix_dialog_constructor;
|
||||
object_class->set_property = gtk_print_unix_dialog_set_property;
|
||||
object_class->get_property = gtk_print_unix_dialog_get_property;
|
||||
|
||||
@ -279,31 +275,10 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
|
||||
|
||||
populate_dialog (dialog);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gtk_print_unix_dialog_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_params)
|
||||
{
|
||||
GtkPrintUnixDialog *dialog;
|
||||
GObject *object;
|
||||
|
||||
object =
|
||||
G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->constructor (type,
|
||||
n_construct_properties,
|
||||
construct_params);
|
||||
|
||||
/* We need to populate the dialog after the transient-to has been set.
|
||||
* See bug #340401.
|
||||
*/
|
||||
dialog = GTK_PRINT_UNIX_DIALOG (object);
|
||||
populate_dialog (dialog);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog)
|
||||
{
|
||||
|
@ -173,6 +173,7 @@ struct _GtkWindowPrivate
|
||||
guint accept_focus : 1;
|
||||
guint focus_on_map : 1;
|
||||
guint deletable : 1;
|
||||
guint transient_parent_group : 1;
|
||||
|
||||
guint reset_type_hint : 1;
|
||||
GdkWindowTypeHint type_hint;
|
||||
@ -1850,10 +1851,12 @@ gtk_window_transient_parent_screen_changed (GtkWindow *parent,
|
||||
static void
|
||||
gtk_window_unset_transient_for (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
|
||||
|
||||
if (window->transient_parent)
|
||||
{
|
||||
if (window->transient_parent->group)
|
||||
gtk_window_group_remove_window (window->transient_parent->group,
|
||||
if (priv->transient_parent_group)
|
||||
gtk_window_group_remove_window (window->group,
|
||||
window);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (window->transient_parent,
|
||||
@ -1873,6 +1876,7 @@ gtk_window_unset_transient_for (GtkWindow *window)
|
||||
disconnect_parent_destroyed (window);
|
||||
|
||||
window->transient_parent = NULL;
|
||||
priv->transient_parent_group = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1898,6 +1902,8 @@ void
|
||||
gtk_window_set_transient_for (GtkWindow *window,
|
||||
GtkWindow *parent)
|
||||
{
|
||||
GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
|
||||
g_return_if_fail (window != parent);
|
||||
@ -1914,7 +1920,7 @@ gtk_window_set_transient_for (GtkWindow *window,
|
||||
}
|
||||
|
||||
window->transient_parent = parent;
|
||||
|
||||
|
||||
if (parent)
|
||||
{
|
||||
g_signal_connect (parent, "destroy",
|
||||
@ -1941,7 +1947,10 @@ gtk_window_set_transient_for (GtkWindow *window,
|
||||
GTK_WIDGET (window));
|
||||
|
||||
if (parent->group)
|
||||
gtk_window_group_add_window (parent->group, window);
|
||||
{
|
||||
gtk_window_group_add_window (parent->group, window);
|
||||
priv->transient_parent_group = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user