c676809
diff -Nur -x '*.orig' -x '*~' gnome-screensaver-2.28.0/src/gnome-screensaver-dialog.c gnome-screensaver-2.28.0.new/src/gnome-screensaver-dialog.c
c676809
--- gnome-screensaver-2.28.0/src/gnome-screensaver-dialog.c	2009-08-26 17:06:12.000000000 +0100
c676809
+++ gnome-screensaver-2.28.0.new/src/gnome-screensaver-dialog.c	2009-10-18 22:00:14.563679981 +0100
c676809
@@ -29,6 +29,7 @@
c676809
 #include <sys/types.h>
c676809
 #include <sys/wait.h>
c676809
 #include <unistd.h>
c676809
+#include <signal.h>
c676809
 
c676809
 #include <glib/gi18n.h>
c676809
 #include <gdk/gdkx.h>
c676809
@@ -326,6 +327,21 @@
c676809
 }
c676809
 
c676809
 static gboolean
c676809
+response_request_quit (void)
c676809
+{
c676809
+        printf ("REQUEST QUIT\n");
c676809
+        fflush (stdout);
c676809
+        return FALSE;
c676809
+}
c676809
+
c676809
+static gboolean
c676809
+quit_timeout_cb (gpointer data)
c676809
+{
c676809
+        gtk_main_quit ();
c676809
+        return FALSE;
c676809
+}
c676809
+
c676809
+static gboolean
c676809
 auth_check_idle (GSLockPlug *plug)
c676809
 {
c676809
         gboolean     res;
c676809
@@ -347,7 +363,11 @@
c676809
                 } else {
c676809
                         gs_debug ("Authentication failed, quitting (max failures)");
c676809
                         again = FALSE;
c676809
-                        gtk_main_quit ();
c676809
+                        /* Don't quit immediately, but rather request that gnome-screensaver
c676809
+                         * terminates us after it has finished the dialog shake. Time out
c676809
+                         * after 5 seconds and quit anyway if this doesn't happen though */
c676809
+                        g_idle_add ((GSourceFunc)response_request_quit, NULL);
c676809
+                        g_timeout_add (5000, (GSourceFunc)quit_timeout_cb, NULL);
c676809
                 }
c676809
         }
c676809
 
c676809
diff -Nur -x '*.orig' -x '*~' gnome-screensaver-2.28.0/src/gs-window-x11.c gnome-screensaver-2.28.0.new/src/gs-window-x11.c
c676809
--- gnome-screensaver-2.28.0/src/gs-window-x11.c	2009-10-18 21:53:27.913386916 +0100
c676809
+++ gnome-screensaver-2.28.0.new/src/gs-window-x11.c	2009-10-18 21:53:28.835892015 +0100
c676809
@@ -91,6 +91,8 @@
c676809
         gint       lock_pid;
c676809
         gint       lock_watch_id;
c676809
         gint       dialog_response;
c676809
+        gboolean   dialog_quit_requested;
c676809
+        gboolean   dialog_shake_in_progress;
c676809
 
c676809
         gint       keyboard_pid;
c676809
         gint       keyboard_watch_id;
c676809
@@ -1390,6 +1392,16 @@
c676809
         remove_key_events (window);
c676809
 }
c676809
 
c676809
+static void
c676809
+maybe_kill_dialog (GSWindow *window)
c676809
+{
c676809
+        if (!window->priv->dialog_shake_in_progress
c676809
+            && window->priv->dialog_quit_requested
c676809
+            && window->priv->lock_pid > 0) {
c676809
+                kill (window->priv->lock_pid, SIGTERM);
c676809
+        }
c676809
+}
c676809
+
c676809
 /* very rudimentary animation for indicating an auth failure */
c676809
 static void
c676809
 shake_dialog (GSWindow *window)
c676809
@@ -1398,6 +1410,8 @@
c676809
         guint left;
c676809
         guint right;
c676809
 
c676809
+        window->priv->dialog_shake_in_progress = TRUE;
c676809
+
c676809
         for (i = 0; i < 9; i++) {
c676809
                 if (i % 2 == 0) {
c676809
                         left = 30;
c676809
@@ -1422,6 +1436,9 @@
c676809
 
c676809
                 g_usleep (10000);
c676809
         }
c676809
+
c676809
+        window->priv->dialog_shake_in_progress = FALSE;
c676809
+        maybe_kill_dialog (window);
c676809
 }
c676809
 
c676809
 static gboolean
c676809
@@ -1464,6 +1481,10 @@
c676809
                                         window->priv->dialog_response = DIALOG_RESPONSE_CANCEL;
c676809
                                 }
c676809
                                 finished = TRUE;
c676809
+                        } else if (strstr (line, "REQUEST QUIT") != NULL) {
c676809
+                                gs_debug ("Got request for quit");
c676809
+                                window->priv->dialog_quit_requested = TRUE;
c676809
+                                maybe_kill_dialog (window);
c676809
                         }
c676809
                         break;
c676809
                 case G_IO_STATUS_EOF:
c676809
@@ -1577,6 +1598,9 @@
c676809
 
c676809
         set_invisible_cursor (GTK_WIDGET (window)->window, FALSE);
c676809
 
c676809
+        window->priv->dialog_quit_requested = FALSE;
c676809
+        window->priv->dialog_shake_in_progress = FALSE;
c676809
+
c676809
         result = spawn_on_window (window,
c676809
                                   command->str,
c676809
                                   &window->priv->lock_pid,