summaryrefslogtreecommitdiff
path: root/plugins/power
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2016-10-03 16:13:27 +0200
committerRui Matos <tiagomatos@gmail.com>2016-10-04 10:50:20 +0200
commit05304f253f2642f7b8fbfee6b76c100b730d38a0 (patch)
tree619abe0f4461a6cb9136d93904c1885976c51012 /plugins/power
parent071031ef7cbaecb8595f8efd7464430f73bf07f9 (diff)
downloadgnome-settings-daemon-05304f253f2642f7b8fbfee6b76c100b730d38a0.tar.gz
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
Diffstat (limited to 'plugins/power')
-rw-r--r--plugins/power/gsd-power-manager.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 5594320f..777352d6 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);