[gnome-settings-daemon/gnome-3-28] color: Cancel old smooth transition on color temperature change



commit 377ff27661c142f3a29a6159683131533cc9a8bf
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Mar 16 17:58:40 2018 +0100

    color: Cancel old smooth transition on color temperature change
    
    A smooth transition between two color temperatures might still be active
    when the next color temperature is set. Cancel any pending transitions
    in this case.
    
    This possibly fixes issues where the colour temperature is stuck in
    night mode even though it is daytime.

 plugins/color/gsd-night-light.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/plugins/color/gsd-night-light.c b/plugins/color/gsd-night-light.c
index d91cdbbb..d98570d9 100644
--- a/plugins/color/gsd-night-light.c
+++ b/plugins/color/gsd-night-light.c
@@ -199,7 +199,7 @@ gsd_night_light_smooth_cb (gpointer user_data)
 static void
 poll_smooth_create (GsdNightLight *self, gdouble temperature)
 {
-        poll_smooth_destroy (self);
+        g_assert (self->smooth_id == 0);
         self->smooth_target_temperature = temperature;
         self->smooth_timer = g_timer_new ();
         self->smooth_id = g_timeout_add (50, gsd_night_light_smooth_cb, self);
@@ -214,6 +214,9 @@ gsd_night_light_set_temperature (GsdNightLight *self, gdouble temperature)
                 return;
         }
 
+        /* Destroy any smooth transition, it will be recreated if neccessary */
+        poll_smooth_destroy (self);
+
         /* small jump */
         if (ABS (temperature - self->cached_temperature) < GSD_TEMPERATURE_MAX_DELTA) {
                 gsd_night_light_set_temperature_internal (self, temperature);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]