From: Owen Taylor Date: Mon, 16 Dec 2002 00:05:26 +0000 (+0000) Subject: Some fixes for modal hint setting based on a patch from Arvind Samptur X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=6669d0c581baced1feed0c0df587b96d72c386f1;hp=0c9448f07fc197e619eaceee6096c60feebd3c2c;p=~andy%2Fgtk Some fixes for modal hint setting based on a patch from Arvind Samptur Sun Dec 15 18:47:30 2002 Owen Taylor Some fixes for modal hint setting based on a patch from Arvind Samptur (#100416) * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal before showing the window for efficiency. * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH constraint that the transient-for hint must always be set on windows with the modal hint and just always set the modal hint. * gtk/gtkwindow.c (gtk_window_set_modal): Update the modal hint on the GdkWindow when the window is realized. --- diff --git a/ChangeLog b/ChangeLog index e86552998..96fe3e3d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e86552998..96fe3e3d1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e86552998..96fe3e3d1 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e86552998..96fe3e3d1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e86552998..96fe3e3d1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e86552998..96fe3e3d1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,19 @@ +Sun Dec 15 18:47:30 2002 Owen Taylor + + Some fixes for modal hint setting based on a patch + from Arvind Samptur (#100416) + + * gtk/gtkdialog.c (gtk_dialog_run): Call gtk_window_set_modal + before showing the window for efficiency. + + * gtk/gtkwindow.c (gtk_window_realize): Ignore the EWMH + constraint that the transient-for hint must always be + set on windows with the modal hint and just always set + the modal hint. + + * gtk/gtkwindow.c (gtk_window_set_modal): Update the + modal hint on the GdkWindow when the window is realized. + Sun Dec 15 18:39:09 2002 Owen Taylor * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 213ff99d0..7f81f9d83 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -944,13 +944,13 @@ gtk_dialog_run (GtkDialog *dialog) g_object_ref (dialog); - if (!GTK_WIDGET_VISIBLE (dialog)) - gtk_widget_show (GTK_WIDGET (dialog)); - was_modal = GTK_WINDOW (dialog)->modal; if (!was_modal) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + if (!GTK_WIDGET_VISIBLE (dialog)) + gtk_widget_show (GTK_WIDGET (dialog)); + response_handler = g_signal_connect (dialog, "response", diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index fc9f9b154..1d3dfea02 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1582,13 +1582,30 @@ gtk_window_set_modal (GtkWindow *window, { g_return_if_fail (GTK_IS_WINDOW (window)); - window->modal = modal != FALSE; + modal = modal != FALSE; + if (window->modal == modal) + return; + + window->modal = modal; /* adjust desired modality state */ - if (GTK_WIDGET_VISIBLE (window) && window->modal) - gtk_grab_add (GTK_WIDGET (window)); - else - gtk_grab_remove (GTK_WIDGET (window)); + if (GTK_WIDGET_REALIZED (window)) + { + GtkWidget *widget = GTK_WIDGET (window); + + if (window->modal) + gdk_window_set_modal_hint (widget->window, TRUE); + else + gdk_window_set_modal_hint (widget->window, FALSE); + } + + if (GTK_WIDGET_VISIBLE (window)) + { + if (window->modal) + gtk_grab_add (GTK_WIDGET (window)); + else + gtk_grab_remove (GTK_WIDGET (window)); + } g_object_notify (G_OBJECT (window), "modal"); } @@ -3762,8 +3779,7 @@ gtk_window_realize (GtkWidget *widget) if (gtk_window_get_skip_taskbar_hint (window)) gdk_window_set_skip_taskbar_hint (widget->window, TRUE); - /* transient_for must be set to allow the modal hint */ - if (window->transient_parent && window->modal) + if (window->modal) gdk_window_set_modal_hint (widget->window, TRUE); else gdk_window_set_modal_hint (widget->window, FALSE);