From c676809a41c11fcbfa0935da96a454c6a4ff0491 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Oct 24 2009 03:54:05 +0000 Subject: Ask to die --- diff --git a/ask-to-die.patch b/ask-to-die.patch new file mode 100644 index 0000000..b7346f8 --- /dev/null +++ b/ask-to-die.patch @@ -0,0 +1,115 @@ +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 + #include + #include ++#include + + #include + #include +@@ -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, diff --git a/gnome-screensaver.spec b/gnome-screensaver.spec index 34c1982..1a76ae9 100644 --- a/gnome-screensaver.spec +++ b/gnome-screensaver.spec @@ -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-by-default.patch 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 well integrated with the desktop. %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 2.28.0-5 +- Make the dialog ask to be killed after 5 attempts + * Fri Oct 23 2009 Matthias Clasen 2.28.0-4 - Fix crashes and malfunctions in dynamic multihead situations