[gnome-screensaver] Properly lock even if already active



commit a0acbab231993289c13c735380223fb1cda61678
Author: Marc Deslauriers <marc deslauriers ubuntu com>
Date:   Tue Jan 31 11:28:26 2012 -0500

    Properly lock even if already active
    
    If the screensaver is already active without a lock, and it
    got a request to lock, it would bail out without switching to a locked
    state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668967

 src/gs-monitor.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-monitor.c b/src/gs-monitor.c
index 414982d..f1387fb 100644
--- a/src/gs-monitor.c
+++ b/src/gs-monitor.c
@@ -167,18 +167,24 @@ gs_monitor_lock_screen (GSMonitor *monitor)
 {
         gboolean res;
         gboolean locked;
+        gboolean active;
 
         /* set lock flag before trying to activate screensaver
            in case something tries to react to the ActiveChanged signal */
 
         gs_manager_get_lock_active (monitor->priv->manager, &locked);
         gs_manager_set_lock_active (monitor->priv->manager, TRUE);
-        res = gs_listener_set_active (monitor->priv->listener, TRUE);
-        if (! res) {
-                /* If we've failed then restore lock status */
-                gs_manager_set_lock_active (monitor->priv->manager, locked);
-                gs_debug ("Unable to lock the screen");
+        active = gs_manager_get_active (monitor->priv->manager);
+
+        if (! active) {
+                res = gs_listener_set_active (monitor->priv->listener, TRUE);
+                if (! res) {
+                        /* If we've failed then restore lock status */
+                        gs_manager_set_lock_active (monitor->priv->manager, locked);
+                        gs_debug ("Unable to lock the screen");
+                }
         }
+
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]