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