color-device: Maybe update brightness from profile when updating
Some profiles have brightness metadata that also needs to be applied. Make sure this happens. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
This commit is contained in:
parent
71009779c8
commit
b7d3c9e3c5
@ -1087,8 +1087,8 @@ meta_color_device_get_assigned_profile (MetaColorDevice *color_device)
|
||||
}
|
||||
|
||||
void
|
||||
meta_color_device_update_gamma (MetaColorDevice *color_device,
|
||||
unsigned int temperature)
|
||||
meta_color_device_update (MetaColorDevice *color_device,
|
||||
unsigned int temperature)
|
||||
{
|
||||
MetaColorProfile *color_profile;
|
||||
MetaMonitor *monitor;
|
||||
@ -1111,6 +1111,22 @@ meta_color_device_update_gamma (MetaColorDevice *color_device,
|
||||
meta_color_profile_get_id (color_profile),
|
||||
temperature);
|
||||
|
||||
if (meta_monitor_is_laptop_panel (monitor))
|
||||
{
|
||||
const char *brightness_profile;
|
||||
|
||||
brightness_profile =
|
||||
meta_color_profile_get_brightness_profile (color_profile);
|
||||
if (brightness_profile)
|
||||
{
|
||||
meta_topic (META_DEBUG_COLOR,
|
||||
"Setting brightness to %s%% from brightness profile",
|
||||
brightness_profile);
|
||||
meta_color_manager_set_brightness (color_device->color_manager,
|
||||
atoi (brightness_profile));
|
||||
}
|
||||
}
|
||||
|
||||
lut_size = meta_monitor_get_gamma_lut_size (monitor);
|
||||
lut = meta_color_profile_generate_gamma_lut (color_profile,
|
||||
temperature,
|
||||
|
@ -62,7 +62,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_gamma (MetaColorDevice *color_device,
|
||||
unsigned int temperature);
|
||||
void meta_color_device_update (MetaColorDevice *color_device,
|
||||
unsigned int temperature);
|
||||
|
||||
#endif /* META_COLOR_DEVICE_H */
|
||||
|
@ -109,7 +109,7 @@ on_device_ready (MetaColorDevice *color_device,
|
||||
return;
|
||||
}
|
||||
|
||||
meta_color_device_update_gamma (color_device, priv->temperature);
|
||||
meta_color_device_update (color_device, priv->temperature);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -119,7 +119,7 @@ on_device_changed (MetaColorDevice *color_device,
|
||||
MetaColorManagerPrivate *priv =
|
||||
meta_color_manager_get_instance_private (color_manager);
|
||||
|
||||
meta_color_device_update_gamma (color_device, priv->temperature);
|
||||
meta_color_device_update (color_device, priv->temperature);
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -282,7 +282,7 @@ update_all_gamma (MetaColorManager *color_manager)
|
||||
if (!meta_color_device_is_ready (color_device))
|
||||
continue;
|
||||
|
||||
meta_color_device_update_gamma (color_device, priv->temperature);
|
||||
meta_color_device_update (color_device, priv->temperature);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user