[gnome-settings-daemon/gnome-3-22] power: Ensure we blank the screen when locked



commit 0f8a828d65da15310437cd8ba9fbb7841e9d4c3e
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Oct 3 16:13:27 2016 +0200

    power: Ensure we blank the screen when locked
    
    When the session is inhibited from going idle e.g. because a media
    player is active, we still want to blank the screen if the session is
    locked (i.e. the "screensaver" is up).
    
    Otherwise, we'd blank the screen when the session gets locked but then
    on user activity we'd go back to NORMAL mode, unblanking the screen,
    and ending up without an idle watch to blank again after a while since
    we clear all watches and exit early if idle is inhibited.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772248

 plugins/power/gsd-power-manager.c |   41 ++++++++++++++----------------------
 1 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index b8d0d63..e55ad3c 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1653,7 +1653,6 @@ idle_configure (GsdPowerManager *manager)
 {
         gboolean is_idle_inhibited;
         GsdPowerActionType action_type;
-        guint timeout_blank;
         guint timeout_sleep;
         guint timeout_dim;
         gboolean on_battery;
@@ -1665,6 +1664,22 @@ idle_configure (GsdPowerManager *manager)
                 return;
         }
 
+        /* set up blank callback only when the screensaver is on,
+         * as it's what will drive the blank */
+        clear_idle_watch (manager->priv->idle_monitor,
+                          &manager->priv->idle_blank_id);
+        if (manager->priv->screensaver_active) {
+                /* The tail is wagging the dog.
+                 * The screensaver coming on will blank the screen.
+                 * If an event occurs while the screensaver is on,
+                 * the aggressive idle watch will handle it */
+                guint timeout_blank = SCREENSAVER_TIMEOUT_BLANK;
+                g_debug ("setting up blank callback for %is", timeout_blank);
+                manager->priv->idle_blank_id = gnome_idle_monitor_add_idle_watch 
(manager->priv->idle_monitor,
+                                                                                  timeout_blank * 1000,
+                                                                                  idle_triggered_idle_cb, 
manager, NULL);
+        }
+
         /* are we inhibited from going idle */
         if (!manager->priv->session_is_active || is_idle_inhibited) {
                 if (is_idle_inhibited)
@@ -1674,8 +1689,6 @@ idle_configure (GsdPowerManager *manager)
                 idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL);
 
                 clear_idle_watch (manager->priv->idle_monitor,
-                                  &manager->priv->idle_blank_id);
-                clear_idle_watch (manager->priv->idle_monitor,
                                   &manager->priv->idle_sleep_id);
                 clear_idle_watch (manager->priv->idle_monitor,
                                   &manager->priv->idle_dim_id);
@@ -1685,28 +1698,6 @@ idle_configure (GsdPowerManager *manager)
                 return;
         }
 
-        /* set up blank callback only when the screensaver is on,
-         * as it's what will drive the blank */
-        timeout_blank = 0;
-        if (manager->priv->screensaver_active) {
-                /* The tail is wagging the dog.
-                 * The screensaver coming on will blank the screen.
-                 * If an event occurs while the screensaver is on,
-                 * the aggressive idle watch will handle it */
-                timeout_blank = SCREENSAVER_TIMEOUT_BLANK;
-        }
-
-        clear_idle_watch (manager->priv->idle_monitor,
-                          &manager->priv->idle_blank_id);
-
-        if (timeout_blank != 0) {
-                g_debug ("setting up blank callback for %is", timeout_blank);
-
-                manager->priv->idle_blank_id = gnome_idle_monitor_add_idle_watch 
(manager->priv->idle_monitor,
-                                                                                  timeout_blank * 1000,
-                                                                                  idle_triggered_idle_cb, 
manager, NULL);
-        }
-
         /* only do the sleep timeout when the session is idle
          * and we aren't inhibited from sleeping (or logging out, etc.) */
         on_battery = up_client_get_on_battery (manager->priv->up_client);


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