[gnome-settings-daemon/benzea/night-light-570: 10/10] night-light: Move disable-until-tomorrow check to after active check
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/night-light-570: 10/10] night-light: Move disable-until-tomorrow check to after active check
- Date: Mon, 11 Jan 2021 21:05:04 +0000 (UTC)
commit 58f7e05f5ade806a23ed8328e2bf9d465962469e
Author: Benjamin Berg <bberg redhat com>
Date: Mon Nov 23 13:33:09 2020 +0100
night-light: Move disable-until-tomorrow check to after active check
When DUT is active (i.e. night light is effectively off), we should
still report the correct active state depending on whether we have
detected night-time or not.
So always run the code to update the active state, and instead only skip
the color temperature calculation that happens later.
Closes: #570
plugins/color/gsd-night-light.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/plugins/color/gsd-night-light.c b/plugins/color/gsd-night-light.c
index 635f1608..f0eb2d5c 100644
--- a/plugins/color/gsd-night-light.c
+++ b/plugins/color/gsd-night-light.c
@@ -322,11 +322,6 @@ night_light_recheck (GsdNightLight *self)
self->disabled_until_tmw = FALSE;
g_clear_pointer(&self->disabled_until_tmw_dt, g_date_time_unref);
g_object_notify (G_OBJECT (self), "disabled-until-tmw");
- } else {
- g_debug ("night light still day-disabled, resetting");
- gsd_night_light_set_temperature (self,
- GSD_COLOR_TEMPERATURE_DEFAULT);
- return;
}
}
@@ -343,6 +338,14 @@ night_light_recheck (GsdNightLight *self)
return;
}
+ gsd_night_light_set_active (self, TRUE);
+
+ if (self->disabled_until_tmw) {
+ g_debug ("night light still day-disabled");
+ gsd_night_light_set_temperature (self, GSD_COLOR_TEMPERATURE_DEFAULT);
+ return;
+ }
+
/* smear the temperature for a short duration before the set limits
*
* |----------------------| = from->to
@@ -372,9 +375,9 @@ night_light_recheck (GsdNightLight *self)
} else {
temp_smeared = temperature;
}
+
g_debug ("night light mode on, using temperature of %uK (aiming for %uK)",
temp_smeared, temperature);
- gsd_night_light_set_active (self, TRUE);
gsd_night_light_set_temperature (self, temp_smeared);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]