[gnome-settings-daemon] power: Don't restore the brightness if it's never been set
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Don't restore the brightness if it's never been set
- Date: Mon, 26 Sep 2011 08:56:33 +0000 (UTC)
commit 67785fa2b1043bd5397669f92abbd210dbf23f24
Author: Richard Hughes <richard hughsie com>
Date: Fri Sep 23 12:21:51 2011 +0100
power: Don't restore the brightness if it's never been set
plugins/power/gsd-power-manager.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 57d0b27..7c0de2b 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2706,15 +2706,18 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
g_clear_error (&error);
}
- ret = backlight_set_abs (manager,
- manager->priv->pre_dim_brightness,
- &error);
- if (!ret) {
- g_warning ("failed to restore backlight to %i: %s",
- manager->priv->pre_dim_brightness,
- error->message);
- g_error_free (error);
- return;
+ /* reset brightness if we dimmed */
+ if (manager->priv->pre_dim_brightness >= 0) {
+ ret = backlight_set_abs (manager,
+ manager->priv->pre_dim_brightness,
+ &error);
+ if (!ret) {
+ g_warning ("failed to restore backlight to %i: %s",
+ manager->priv->pre_dim_brightness,
+ error->message);
+ g_error_free (error);
+ return;
+ }
}
}
}
@@ -3266,7 +3269,7 @@ gsd_power_manager_start (GsdPowerManager *manager,
manager);
manager->priv->kbd_brightness_old = -1;
- manager->priv->pre_dim_brightness = 100;
+ manager->priv->pre_dim_brightness = -1;
manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA);
g_signal_connect (manager->priv->settings, "changed",
G_CALLBACK (engine_settings_key_changed_cb), manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]