Commit 3fd78264 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

power: Use session's idle-delay to blank the screen

The blanking will only work as designed if:
session.idle-delay ==
	power.sleep-display-ac ==
	power.sleep-display-battery

So nuke the sleep-display* configuration keys, and rely solely
on the idle-delay to blank the screen.

https://bugzilla.gnome.org/show_bug.cgi?id=691002
parent e3c9fbc7
......@@ -30,16 +30,6 @@
<summary>The default amount of time to dim the screen after idle</summary>
<description>The default amount of time to dim the screen after idle.</description>
</key>
<key name="sleep-display-ac" type="i">
<default>600</default>
<summary>Sleep timeout display when on AC</summary>
<description>The amount of time in seconds before the display turns off when the computer is on AC power.</description>
</key>
<key name="sleep-display-battery" type="i">
<default>600</default>
<summary>Sleep timeout display when on battery</summary>
<description>The amount of time in seconds before the display turns off when the computer is on battery power.</description>
</key>
<key name="sleep-inactive-ac-timeout" type="i">
<default>0</default>
<summary>Sleep timeout computer when on AC</summary>
......
......@@ -141,6 +141,7 @@ struct GsdPowerManagerPrivate
guint name_id;
gboolean lid_is_closed;
GSettings *settings;
GSettings *settings_session;
GSettings *settings_screensaver;
GSettings *settings_xrandr;
UpClient *up_client;
......@@ -2695,14 +2696,9 @@ idle_configure (GsdPowerManager *manager)
on_battery = up_client_get_on_battery (manager->priv->up_client);
if (manager->priv->screensaver_active) {
timeout_blank = 30;
} else if (on_battery) {
timeout_blank = g_settings_get_int (manager->priv->settings,
"sleep-display-battery");
if (timeout_blank != 0)
timeout_blank += SCREENSAVER_FADE_TIME;
} else {
timeout_blank = g_settings_get_int (manager->priv->settings,
"sleep-display-ac");
timeout_blank = g_settings_get_int (manager->priv->settings_session,
"idle-delay");
if (timeout_blank != 0)
timeout_blank += SCREENSAVER_FADE_TIME;
}
......@@ -3097,8 +3093,8 @@ engine_settings_key_changed_cb (GSettings *settings,
return;
}
if (g_str_has_prefix (key, "sleep-inactive") ||
g_str_has_prefix (key, "sleep-display") ||
g_strcmp0 (key, "idle-dim-time") == 0) {
g_strcmp0 (key, "idle-dim-time") == 0 ||
g_str_equal (key, "idle-delay")) {
idle_configure (manager);
return;
}
......@@ -3431,6 +3427,9 @@ gsd_power_manager_start (GsdPowerManager *manager,
g_signal_connect (manager->priv->settings, "changed",
G_CALLBACK (engine_settings_key_changed_cb), manager);
manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver");
manager->priv->settings_session = g_settings_new ("org.gnome.desktop.session");
g_signal_connect (manager->priv->settings_session, "changed",
G_CALLBACK (engine_settings_key_changed_cb), manager);
manager->priv->settings_xrandr = g_settings_new (GSD_XRANDR_SETTINGS_SCHEMA);
manager->priv->up_client = up_client_new ();
manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client);
......@@ -3590,6 +3589,7 @@ gsd_power_manager_stop (GsdPowerManager *manager)
g_clear_object (&manager->priv->session);
g_clear_object (&manager->priv->settings);
g_clear_object (&manager->priv->settings_screensaver);
g_clear_object (&manager->priv->settings_session);
g_clear_object (&manager->priv->up_client);
if (manager->priv->inhibit_lid_switch_fd != -1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment