diff options
author | Marc Deslauriers <[email protected]> | 2012-01-31 20:28:26 +0400 |
---|---|---|
committer | Sorokin Alexei <[email protected]> | 2016-06-18 23:40:51 +0300 |
commit | 156f1b626cdd4e22beea0fbdba5869e2f693020a (patch) | |
tree | 161857199f2f32806de00afc8085c13da878167c | |
parent | 7c08aca1346391fc884a71a02cfc1d51593a227a (diff) | |
download | mate-screensaver-156f1b626cdd4e22beea0fbdba5869e2f693020a.tar.bz2 mate-screensaver-156f1b626cdd4e22beea0fbdba5869e2f693020a.tar.xz |
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
-rw-r--r-- | src/gs-monitor.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gs-monitor.c b/src/gs-monitor.c index 56ef901..42dead3 100644 --- a/src/gs-monitor.c +++ b/src/gs-monitor.c @@ -174,18 +174,23 @@ static void 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); + active = gs_manager_get_active(monitor->priv->manager); - 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"); + 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"); + } } } |