On Sat, 30 Mar 2013 at 21:18:20 +0100, Guido Günther wrote:
> since the update frpm 3.6 supending does not work anymore
...
> It seems systemd is too old in Debian to handle this.

Replacing revert-suspend-break.patch with the one here seems to work
(under both systemd from unstable, and sysvinit+consolekit from unstable).
GNOME team, would you like me to upload this? Debdiff also attached.

    S
diffstat for gnome-shell-3.8.1 gnome-shell-3.8.1

 changelog                          |   11 ++++
 patches/revert-suspend-break.patch |   83 +++++++++++++++++++++++++++++--------
 2 files changed, 78 insertions(+), 16 deletions(-)

diff -Nru gnome-shell-3.8.1/debian/changelog gnome-shell-3.8.1/debian/changelog
--- gnome-shell-3.8.1/debian/changelog	2013-04-19 22:45:31.000000000 +0100
+++ gnome-shell-3.8.1/debian/changelog	2013-04-21 12:45:10.000000000 +0100
@@ -1,3 +1,14 @@
+gnome-shell (3.8.1-1smcv1) UNRELEASED; urgency=low
+
+  * Local build.
+  * Reinstate support for suspend via UPower using the user-menu, until
+    our logind is new enough to take over (Closes: #704272)
+  * Delay suspend for 1 second in the hope that that's long enough to lock
+    the screen (works around #645716, but only if you suspend via the
+    user-menu)
+
+ -- Simon McVittie <s...@debian.org>  Sun, 21 Apr 2013 12:42:57 +0100
+
 gnome-shell (3.8.1-1) experimental; urgency=low
 
   * New upstream release
diff -Nru gnome-shell-3.8.1/debian/patches/revert-suspend-break.patch gnome-shell-3.8.1/debian/patches/revert-suspend-break.patch
--- gnome-shell-3.8.1/debian/patches/revert-suspend-break.patch	2013-02-23 22:44:58.000000000 +0000
+++ gnome-shell-3.8.1/debian/patches/revert-suspend-break.patch	2013-04-21 12:42:35.000000000 +0100
@@ -1,18 +1,25 @@
-From b91d9c2867952520e685d689f75bc019befcaaf3 Mon Sep 17 00:00:00 2001
-From: Florian Müllner <fmuell...@gnome.org>
-Date: Sun, 03 Feb 2013 20:53:33 +0000
-Subject: loginManager: Make suspend() a NOP in the ConsoleKit path
+From 23a65607b011582e11be1ed4be5c309da14bf4d6 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvit...@collabora.co.uk>
+Date: Sun, 21 Apr 2013 12:42:31 +0100
+Subject: [PATCH] Reinstate support for suspending via UPower
 
-UPower will remove its suspend support eventually, and g-s-d already
-depends on logind for power management.
+Debian's logind is currently too old to know how to suspend
+(Debian #704272).
 
-https://bugzilla.gnome.org/show_bug.cgi?id=693162
+Also delay suspend by 1 second, in the hope that this will avoid showing
+the old screen contents after resume (Debian #645716). With a newer
+logind, inhibiting suspend will fix this properly.
 
-Index: gnome-shell-3.7.90/js/misc/loginManager.js
-===================================================================
---- gnome-shell-3.7.90.orig/js/misc/loginManager.js	2013-02-23 15:17:56.532244380 -0500
-+++ gnome-shell-3.7.90/js/misc/loginManager.js	2013-02-23 15:19:29.800240480 -0500
-@@ -5,6 +5,7 @@
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704272
+---
+ js/misc/loginManager.js |   33 +++++++++++++++++++++++++--------
+ 1 file changed, 25 insertions(+), 8 deletions(-)
+
+diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
+index ce4af41..280e478 100644
+--- a/js/misc/loginManager.js
++++ b/js/misc/loginManager.js
+@@ -5,6 +5,7 @@ const Gio = imports.gi.Gio;
  const Lang = imports.lang;
  const Mainloop = imports.mainloop;
  const Shell = imports.gi.Shell;
@@ -20,7 +27,15 @@
  const Signals = imports.signals;
  
  const SystemdLoginManagerIface = <interface name='org.freedesktop.login1.Manager'>
-@@ -137,12 +138,10 @@
+@@ -135,6 +136,7 @@ const LoginManagerSystemd = new Lang.Class({
+                                               '/org/freedesktop/login1');
+         this._proxy.connectSignal('PrepareForSleep',
+                                   Lang.bind(this, this._prepareForSleep));
++        this._upClient = new UPowerGlib.Client();
+     },
+ 
+     // Having this function is a bit of a hack since the Systemd and ConsoleKit
+@@ -178,12 +180,10 @@ const LoginManagerSystemd = new Lang.Class({
      },
  
      canSuspend: function(asyncCallback) {
@@ -37,7 +52,23 @@
      },
  
      listSessions: function(asyncCallback) {
-@@ -199,6 +198,7 @@
+@@ -204,7 +204,14 @@ const LoginManagerSystemd = new Lang.Class({
+     },
+ 
+     suspend: function() {
+-        this._proxy.SuspendRemote(true);
++        this.emit('prepare-for-sleep', true);
++        this.emit('prepare-for-sleep', false);
++	// hack: wait 1 second, by which time the screen will hopefully
++	// have finished locking
++        Mainloop.timeout_add(1000, Lang.bind(this, function() {
++            this._upClient.suspend_sync(null);
++            return false;
++        }));
+     },
+ 
+     inhibit: function(reason, callback) {
+@@ -240,6 +247,7 @@ const LoginManagerConsoleKit = new Lang.Class({
          this._proxy = new ConsoleKitManager(Gio.DBus.system,
                                              'org.freedesktop.ConsoleKit',
                                              '/org/freedesktop/ConsoleKit/Manager');
@@ -45,11 +76,31 @@
      },
  
      // Having this function is a bit of a hack since the Systemd and ConsoleKit
-@@ -252,6 +252,7 @@
+@@ -283,7 +291,10 @@ const LoginManagerConsoleKit = new Lang.Class({
+     },
+ 
+     canSuspend: function(asyncCallback) {
+-        asyncCallback(false);
++        Mainloop.idle_add(Lang.bind(this, function() {
++            asyncCallback(this._upClient.get_can_suspend());
++            return false;
++        }));
+     },
+ 
+     listSessions: function(asyncCallback) {
+@@ -301,6 +312,12 @@ const LoginManagerConsoleKit = new Lang.Class({
      suspend: function() {
          this.emit('prepare-for-sleep', true);
          this.emit('prepare-for-sleep', false);
-+        this._upClient.suspend_sync(null);
++	// hack: wait 1 second, by which time the screen will hopefully
++	// have finished locking
++        Mainloop.timeout_add(1000, Lang.bind(this, function() {
++            this._upClient.suspend_sync(null);
++            return false;
++        }));
      },
  
      inhibit: function(reason, callback) {
+-- 
+1.7.10.4
+
>From 23a65607b011582e11be1ed4be5c309da14bf4d6 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvit...@collabora.co.uk>
Date: Sun, 21 Apr 2013 12:42:31 +0100
Subject: [PATCH] Reinstate support for suspending via UPower

Debian's logind is currently too old to know how to suspend
(Debian #704272).

Also delay suspend by 1 second, in the hope that this will avoid showing
the old screen contents after resume (Debian #645716). With a newer
logind, inhibiting suspend will fix this properly.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704272
---
 js/misc/loginManager.js |   33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index ce4af41..280e478 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -5,6 +5,7 @@ const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Shell = imports.gi.Shell;
+const UPowerGlib = imports.gi.UPowerGlib;
 const Signals = imports.signals;
 
 const SystemdLoginManagerIface = <interface name='org.freedesktop.login1.Manager'>
@@ -135,6 +136,7 @@ const LoginManagerSystemd = new Lang.Class({
                                               '/org/freedesktop/login1');
         this._proxy.connectSignal('PrepareForSleep',
                                   Lang.bind(this, this._prepareForSleep));
+        this._upClient = new UPowerGlib.Client();
     },
 
     // Having this function is a bit of a hack since the Systemd and ConsoleKit
@@ -178,12 +180,10 @@ const LoginManagerSystemd = new Lang.Class({
     },
 
     canSuspend: function(asyncCallback) {
-        this._proxy.CanSuspendRemote(function(result, error) {
-            if (error)
-                asyncCallback(false);
-            else
-                asyncCallback(result[0] != 'no');
-        });
+        Mainloop.idle_add(Lang.bind(this, function() {
+            asyncCallback(this._upClient.get_can_suspend());
+            return false;
+        }));
     },
 
     listSessions: function(asyncCallback) {
@@ -204,7 +204,14 @@ const LoginManagerSystemd = new Lang.Class({
     },
 
     suspend: function() {
-        this._proxy.SuspendRemote(true);
+        this.emit('prepare-for-sleep', true);
+        this.emit('prepare-for-sleep', false);
+	// hack: wait 1 second, by which time the screen will hopefully
+	// have finished locking
+        Mainloop.timeout_add(1000, Lang.bind(this, function() {
+            this._upClient.suspend_sync(null);
+            return false;
+        }));
     },
 
     inhibit: function(reason, callback) {
@@ -240,6 +247,7 @@ const LoginManagerConsoleKit = new Lang.Class({
         this._proxy = new ConsoleKitManager(Gio.DBus.system,
                                             'org.freedesktop.ConsoleKit',
                                             '/org/freedesktop/ConsoleKit/Manager');
+        this._upClient = new UPowerGlib.Client();
     },
 
     // Having this function is a bit of a hack since the Systemd and ConsoleKit
@@ -283,7 +291,10 @@ const LoginManagerConsoleKit = new Lang.Class({
     },
 
     canSuspend: function(asyncCallback) {
-        asyncCallback(false);
+        Mainloop.idle_add(Lang.bind(this, function() {
+            asyncCallback(this._upClient.get_can_suspend());
+            return false;
+        }));
     },
 
     listSessions: function(asyncCallback) {
@@ -301,6 +312,12 @@ const LoginManagerConsoleKit = new Lang.Class({
     suspend: function() {
         this.emit('prepare-for-sleep', true);
         this.emit('prepare-for-sleep', false);
+	// hack: wait 1 second, by which time the screen will hopefully
+	// have finished locking
+        Mainloop.timeout_add(1000, Lang.bind(this, function() {
+            this._upClient.suspend_sync(null);
+            return false;
+        }));
     },
 
     inhibit: function(reason, callback) {
-- 
1.7.10.4

Reply via email to