--- gnome-session-2.5.2.orig/gnome-session/logout.c	2003-12-02 11:32:48.000000000 -0500
+++ gnome-session-2.5.2/gnome-session/logout.c	2003-12-13 08:51:32.555724672 -0500
@@ -3,6 +3,8 @@
    Written by Owen Taylor <otaylor@redhat.com>
    Copyright (C) Red Hat
 
+   2003 Carlos Romero <kidcrash@bellsouth.net>
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
@@ -17,6 +19,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
+
 #include <config.h>
 #include <stdio.h>
 #include <string.h>
@@ -201,7 +204,7 @@
   fadeout->area.height = gsm_screen_get_height (screen, monitor);
 
   fadeout->root_window = gdk_screen_get_root_window (screen);
-  attr.window_type = GDK_WINDOW_CHILD;
+  attr.window_type = GDK_WINDOW_TEMP;
   attr.x = fadeout->area.x;
   attr.y = fadeout->area.y;
   attr.width = fadeout->area.width;
@@ -209,10 +212,11 @@
   attr.wclass = GDK_INPUT_OUTPUT;
   attr.visual = gdk_screen_get_system_visual (fadeout->screen);
   attr.colormap = gdk_screen_get_default_colormap (fadeout->screen);
-  attr.override_redirect = TRUE;
-  attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_NOREDIR;
+  attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP ;
 
   fadeout->draw_window = gdk_window_new (NULL, &attr, attr_mask);
+  gdk_window_set_back_pixmap (fadeout->draw_window, NULL, FALSE);
+
   fadeout_windows = g_list_prepend (fadeout_windows, fadeout->draw_window);
   
   fadeout->start_pb = gdk_pixbuf_get_from_drawable (NULL,
@@ -238,8 +242,8 @@
 
   fadeout->gc = gdk_gc_new_with_values (fadeout->root_window, &values, GDK_GC_SUBWINDOW);
 
-  gdk_window_set_back_pixmap (fadeout->draw_window, NULL, FALSE);
   gdk_window_show (fadeout->draw_window);
+
   gdk_draw_pixbuf (fadeout->draw_window,
 		   fadeout->gc,
 		   fadeout->frame,
@@ -270,6 +274,7 @@
   fadeout_windows = NULL;
 }
 
+#if 0
 /* FIXME:
  * 	Hackaround for Pango opening a separate display
  * connection and doing a server grab while we have a grab
@@ -295,6 +300,7 @@
 	pango_font_metrics_unref (metrics);
 	pango_font_description_free (font_desc);
 }
+#endif
 
 static GtkWidget *
 make_title_label (const char *text)
@@ -342,7 +348,7 @@
    * to an offscreen window, and then once we have the
    * server grabbed, move that to our dialog.
    */
-  gtk_rc_reparse_all ();
+//  gtk_rc_reparse_all ();
 
   screen = gsm_locate_screen_with_pointer (&monitor);
   if (!screen)
@@ -362,12 +368,18 @@
 	    break;
 	  gdk_pointer_ungrab (GDK_CURRENT_TIME);
 	}
-      sleep (1);
+        while (gtk_events_pending())
+            gtk_main_iteration();
     }
 
-  force_pango_cache_init ();
+  gsm_foreach_screen (fadeout_screen);
+
+//  force_pango_cache_init ();
+
+  box = gtk_dialog_new();
+
+  GTK_WINDOW(box)->type = GTK_WINDOW_POPUP;
 
-  box = gtk_dialog_new ();
   gtk_dialog_set_has_separator (GTK_DIALOG (box), FALSE);
 
   vbox = gtk_vbox_new (FALSE, 12);
@@ -380,7 +392,7 @@
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
-  image = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_DIALOG);
+  image = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_DIALOG);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 	
@@ -389,23 +401,10 @@
   gtk_misc_set_alignment (GTK_MISC (title), 0, 0.5);
   gtk_widget_show (title);
   
-  a11y_enabled = GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (box));
-
-  /* Grabbing the Xserver when accessibility is enabled will cause
-   * a hang. See #93103 for details.
-   */
-  if (!a11y_enabled)
-    {
-      XGrabServer (GDK_DISPLAY ());
-      gsm_foreach_screen (fadeout_screen);
-    }
-
   gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
   gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
   gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_OK, GTK_RESPONSE_OK);
 
-  g_object_set (G_OBJECT (box), "type", GTK_WINDOW_POPUP, NULL);
-
   gtk_dialog_set_default_response (GTK_DIALOG (box), GTK_RESPONSE_OK);
   gtk_window_set_screen (GTK_WINDOW (box), screen);
   gtk_window_set_policy (GTK_WINDOW (box), FALSE, FALSE, TRUE);
@@ -425,8 +424,10 @@
    * good chance of being able to shutdown the system,
    * and if so, give them that option
    */
+
   s = g_strconcat ("/var/lock/console/", g_get_user_name (), NULL);
   t = g_strconcat ("/var/run/console/", g_get_user_name (), NULL);
+
   if (((geteuid () == 0) || g_file_exists (t) || g_file_exists(s)) &&
       access (halt_command[0], X_OK) == 0)
     {
@@ -473,16 +474,23 @@
 
   gsm_center_window_on_screen (GTK_WINDOW (box), screen, monitor);
 
-  gtk_widget_show_all (box);
+  gtk_widget_show (box);
 
   /* Move the grabs to our message box */
-  gdk_pointer_grab (box->window, TRUE, 0,
-		    NULL, NULL, GDK_CURRENT_TIME);
-  gdk_keyboard_grab (box->window, FALSE, GDK_CURRENT_TIME);
-  XSetInputFocus (GDK_DISPLAY (),
-		  GDK_WINDOW_XWINDOW (box->window),
-		  RevertToParent,
-		  CurrentTime);
+
+  while (1)
+    {
+      if (gdk_pointer_grab (box->window, TRUE, 0,
+			    NULL, NULL, GDK_CURRENT_TIME) == Success)
+	{
+	  if (gdk_keyboard_grab (box->window, FALSE, GDK_CURRENT_TIME)
+	      == Success)
+	    break;
+	  gdk_pointer_ungrab (GDK_CURRENT_TIME);
+	}
+     while (gtk_events_pending())
+        gtk_main_iteration();
+    }
 
   response = gtk_dialog_run (GTK_DIALOG (box));
 
@@ -497,11 +505,7 @@
 
   gtk_widget_destroy (box);
 
-  if (!a11y_enabled)
-    {
-      hide_fadeout_windows ();
-      XUngrabServer (GDK_DISPLAY ());
-    }
+  hide_fadeout_windows ();
 
   gdk_pointer_ungrab (GDK_CURRENT_TIME);
   gdk_keyboard_ungrab (GDK_CURRENT_TIME);
