1
0
Fork 0

color-manager: Apply temperature after gsd.Color proxy has been created

Previously, restarting mutter in an X11 session resulted in
the previously set color temperature not being applied.
Fix that by applying the color temperature right after
the org.gnome.SettingsDaemon.Color proxy has been created.

Furthermore, only call `update_all_gamma()` from `on_gsd_color_ready()`
when the temperature has actually changed. Otherwise there is no need
since the current temperature has already been (or will soon be) applied
to all ready color devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3008>
This commit is contained in:
Barnabás Pőcze 2023-05-18 00:38:03 +02:00 committed by Marge Bot
parent 4aeb051e9b
commit ab4c415d6e

View file

@ -306,16 +306,14 @@ update_all_gamma (MetaColorManager *color_manager)
}
static void
on_temperature_changed (MetaDBusSettingsDaemonColor *gsd_color,
GParamSpec *pspec,
MetaColorManager *color_manager)
update_temperature (MetaColorManager *color_manager)
{
MetaColorManagerPrivate *priv =
meta_color_manager_get_instance_private (color_manager);
unsigned int temperature;
temperature = meta_dbus_settings_daemon_color_get_temperature (gsd_color);
if (priv->temperature == temperature)
temperature = meta_dbus_settings_daemon_color_get_temperature (priv->gsd_color);
if (temperature == 0 || priv->temperature == temperature)
return;
if (temperature < 1000 || temperature > 10000)
@ -329,6 +327,14 @@ on_temperature_changed (MetaDBusSettingsDaemonColor *gsd_color,
update_all_gamma (color_manager);
}
static void
on_temperature_changed (MetaDBusSettingsDaemonColor *gsd_color,
GParamSpec *pspec,
MetaColorManager *color_manager)
{
update_temperature (color_manager);
}
static void
on_gsd_color_ready (GObject *source_object,
GAsyncResult *res,
@ -359,7 +365,7 @@ on_gsd_color_ready (GObject *source_object,
G_CALLBACK (on_temperature_changed),
color_manager);
update_all_gamma (color_manager);
update_temperature (color_manager);
}
static void