[gnome-settings-daemon/benzea/night-light-570: 2/2] night-light: Move disable-until-tomorrow check to after active check
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/night-light-570: 2/2] night-light: Move disable-until-tomorrow check to after active check
- Date: Mon, 23 Nov 2020 13:11:27 +0000 (UTC)
commit 52fa0d1adab5946be7d8ecaa8c0248bfa26fea13
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]