rpms/gnome-screensaver/F-12 ask-to-die.patch, NONE, 1.1 gnome-screensaver.spec, 1.231, 1.232

Matthias Clasen mclasen at fedoraproject.org
Sat Oct 24 03:54:05 UTC 2009


Author: mclasen

Update of /cvs/pkgs/rpms/gnome-screensaver/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29400

Modified Files:
	gnome-screensaver.spec 
Added Files:
	ask-to-die.patch 
Log Message:
Ask to die


ask-to-die.patch:
 gnome-screensaver-dialog.c |   22 +++++++++++++++++++++-
 gs-window-x11.c            |   24 ++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

--- NEW FILE ask-to-die.patch ---
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,


Index: gnome-screensaver.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-screensaver/F-12/gnome-screensaver.spec,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -p -r1.231 -r1.232
--- gnome-screensaver.spec	23 Oct 2009 23:55:22 -0000	1.231
+++ gnome-screensaver.spec	24 Oct 2009 03:54:05 -0000	1.232
@@ -14,7 +14,7 @@
 Summary: GNOME Screensaver
 Name: gnome-screensaver
 Version: 2.28.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv2+
 Group: Amusements/Graphics
 Source0: http://download.gnome.org/sources/gnome-screensaver/2.28/%{name}-%{version}.tar.bz2
@@ -27,6 +27,7 @@ Patch7: gnome-screensaver-2.20.0-blank-b
 Patch8: gnome-screensaver-2.20.0-selinux-permit.patch
 Patch9: xrandr-gamma.patch
 Patch10: multihead-issues.patch
+Patch11: ask-to-die.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 URL: http://www.gnome.org
@@ -81,6 +82,7 @@ simple, sane, secure defaults and be wel
 %patch8 -p1 -b .selinux-permit
 %patch9 -p1 -b .xrandr-gamma
 %patch10 -p1 -b .multihead-issues
+%patch11 -p1 -b .ask-to-die
 
 libtoolize --force --copy
 
@@ -155,6 +157,9 @@ fi
 %doc %{_mandir}/man1/*.1.gz
 
 %changelog
+* Fri Oct 23 2009 Matthias Clasen <mclasen at redhat.com> 2.28.0-5
+- Make the dialog ask to be killed after 5 attempts
+
 * Fri Oct 23 2009 Matthias Clasen <mclasen at redhat.com> 2.28.0-4
 - Fix crashes and malfunctions in dynamic multihead situations
 




More information about the scm-commits mailing list