diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c index 0d6cf40db..0df0ab86c 100644 --- a/src/backends/meta-color-device.c +++ b/src/backends/meta-color-device.c @@ -1226,12 +1226,13 @@ meta_color_device_get_assigned_profile (MetaColorDevice *color_device) } void -meta_color_device_update (MetaColorDevice *color_device, - unsigned int temperature) +meta_color_device_update (MetaColorDevice *color_device) { + MetaColorManager *color_manager = color_device->color_manager; MetaColorProfile *color_profile; MetaMonitor *monitor; size_t lut_size; + unsigned int temperature; color_profile = meta_color_device_get_assigned_profile (color_device); if (!color_profile) @@ -1241,6 +1242,8 @@ meta_color_device_update (MetaColorDevice *color_device, if (!meta_monitor_is_active (monitor)) return; + temperature = meta_color_manager_get_temperature (color_manager); + meta_topic (META_DEBUG_COLOR, "Updating device '%s' (%s) using color profile '%s' " "and temperature %uK", @@ -1260,7 +1263,7 @@ meta_color_device_update (MetaColorDevice *color_device, meta_topic (META_DEBUG_COLOR, "Setting brightness to %s%% from brightness profile", brightness_profile); - meta_color_manager_set_brightness (color_device->color_manager, + meta_color_manager_set_brightness (color_manager, atoi (brightness_profile)); } } diff --git a/src/backends/meta-color-device.h b/src/backends/meta-color-device.h index 326595263..1f0172025 100644 --- a/src/backends/meta-color-device.h +++ b/src/backends/meta-color-device.h @@ -61,8 +61,7 @@ MetaColorProfile * meta_color_device_generate_profile_finish (MetaColorDevice * META_EXPORT_TEST gboolean meta_color_device_is_ready (MetaColorDevice *color_device); -void meta_color_device_update (MetaColorDevice *color_device, - unsigned int temperature); +void meta_color_device_update (MetaColorDevice *color_device); META_EXPORT_TEST void meta_set_color_efivar_test_path (const char *path); diff --git a/src/backends/meta-color-manager-private.h b/src/backends/meta-color-manager-private.h index a1e8a3d32..ed6105bcb 100644 --- a/src/backends/meta-color-manager-private.h +++ b/src/backends/meta-color-manager-private.h @@ -40,3 +40,5 @@ META_EXPORT_TEST int meta_color_manager_get_num_color_devices (MetaColorManager *color_manager); cmsContext meta_color_manager_get_lcms_context (MetaColorManager *color_manager); + +unsigned int meta_color_manager_get_temperature (MetaColorManager *color_manager); diff --git a/src/backends/meta-color-manager.c b/src/backends/meta-color-manager.c index 6458346e4..df74f7a3f 100644 --- a/src/backends/meta-color-manager.c +++ b/src/backends/meta-color-manager.c @@ -108,9 +108,6 @@ on_device_ready (MetaColorDevice *color_device, gboolean success, MetaColorManager *color_manager) { - MetaColorManagerPrivate *priv = - meta_color_manager_get_instance_private (color_manager); - if (!success) { meta_topic (META_DEBUG_COLOR, "Color device '%s' failed to become ready", @@ -118,17 +115,14 @@ on_device_ready (MetaColorDevice *color_device, return; } - meta_color_device_update (color_device, priv->temperature); + meta_color_device_update (color_device); } static void on_device_changed (MetaColorDevice *color_device, MetaColorManager *color_manager) { - MetaColorManagerPrivate *priv = - meta_color_manager_get_instance_private (color_manager); - - meta_color_device_update (color_device, priv->temperature); + meta_color_device_update (color_device); } static void @@ -261,7 +255,7 @@ update_device_properties (MetaColorManager *color_manager) if (!meta_color_device_is_ready (color_device)) continue; - meta_color_device_update (color_device, priv->temperature); + meta_color_device_update (color_device); } } @@ -598,6 +592,15 @@ meta_color_manager_get_lcms_context (MetaColorManager *color_manager) return priv->lcms_context; } +unsigned int +meta_color_manager_get_temperature (MetaColorManager *color_manager) +{ + MetaColorManagerPrivate *priv = + meta_color_manager_get_instance_private (color_manager); + + return priv->temperature; +} + void meta_color_manager_set_brightness (MetaColorManager *color_manager, int brightness)