]> Pileus Git - ~andy/gtk/commitdiff
Some fixes for modal hint setting based on a patch from Arvind Samptur
authorOwen Taylor <otaylor@redhat.com>
Mon, 16 Dec 2002 00:05:26 +0000 (00:05 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Mon, 16 Dec 2002 00:05:26 +0000 (00:05 +0000)
Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>

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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkdialog.c
gtk/gtkwindow.c

index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index e865529985bd4c266160666a7b4b04e4dc2306f2..96fe3e3d1302ddd0f3bca652d29bb24e8ffd623a 100644 (file)
@@ -1,3 +1,19 @@
+Sun Dec 15 18:47:30 2002  Owen Taylor  <otaylor@redhat.com>
+
+       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  <otaylor@redhat.com>
 
        * configure.in: Hard-code GTK_BINARY_VERSION=2.2.0 for
index 213ff99d047afbf854a871a7ceafc1e5e1d4333d..7f81f9d83dc205204089369aa6a05eaef208da43 100644 (file)
@@ -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",
index fc9f9b154078fbffeddd8a11ee7a2b7dc46478e1..1d3dfea02395aa8a6caa6f1cfae7e200fd77622a 100644 (file)
@@ -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);