1
0
Fork 0

color-device: Rename signal "updated" to "calibration-changed"

The generic term updated can mean anything. This is specifically about
calibration related updates like changing the sink colorimetry
(Colorspace, HDR metadata) and changes to the white point for night
light etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
This commit is contained in:
Sebastian Wick 2024-07-25 16:10:25 +02:00
parent f5ce2ddf3c
commit c123178f1c
4 changed files with 37 additions and 23 deletions

View file

@ -36,7 +36,7 @@
enum
{
READY,
UPDATED,
CALIBRATION_CHANGED,
N_SIGNALS
};
@ -315,6 +315,10 @@ meta_color_device_class_init (MetaColorDeviceClass *klass)
object_class->dispose = meta_color_device_dispose;
/**
* MetaColorDevice::ready:
* @device: the #MetaColorDevice which became ready
*/
signals[READY] =
g_signal_new ("ready",
G_TYPE_FROM_CLASS (klass),
@ -322,8 +326,17 @@ meta_color_device_class_init (MetaColorDeviceClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
signals[UPDATED] =
g_signal_new ("updated",
/**
* MetaColorDevice::calibration-changed:
* @device: the #MetaColorDevice which emitted the signal
*
* The signal notifies that the color calibration of the device has changed.
* Calibration is anything that changes the monitors behavior when given
* a signal. Changes to the white point from the source are also considered
* calibration even though they are technically not on the monitor.
*/
signals[CALIBRATION_CHANGED] =
g_signal_new ("calibration-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL, NULL,
@ -1300,5 +1313,5 @@ meta_color_device_update (MetaColorDevice *color_device)
meta_monitor_set_gamma_lut (monitor, lut);
}
g_signal_emit (color_device, signals[UPDATED], 0);
g_signal_emit (color_device, signals[CALIBRATION_CHANGED], 0);
}

View file

@ -59,7 +59,7 @@
enum
{
DEVICE_UPDATED,
DEVICE_CALIBRATION_CHANGED,
READY,
N_SIGNALS
@ -120,10 +120,11 @@ on_device_ready (MetaColorDevice *color_device,
}
static void
on_device_updated (MetaColorDevice *color_device,
MetaColorManager *color_manager)
on_device_calibration_changed (MetaColorDevice *color_device,
MetaColorManager *color_manager)
{
g_signal_emit (color_manager, signals[DEVICE_UPDATED], 0, color_device);
g_signal_emit (color_manager, signals[DEVICE_CALIBRATION_CHANGED], 0,
color_device);
}
static char *
@ -204,8 +205,8 @@ update_devices (MetaColorManager *color_manager)
g_signal_connect_object (color_device, "ready",
G_CALLBACK (on_device_ready),
color_manager, 0);
g_signal_connect_object (color_device, "updated",
G_CALLBACK (on_device_updated),
g_signal_connect_object (color_device, "calibration-changed",
G_CALLBACK (on_device_calibration_changed),
color_manager, 0);
}
}
@ -499,8 +500,8 @@ meta_color_manager_class_init (MetaColorManagerClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
signals[DEVICE_UPDATED] =
g_signal_new ("device-updated",
signals[DEVICE_CALIBRATION_CHANGED] =
g_signal_new ("device-calibration-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL, NULL,

View file

@ -169,8 +169,8 @@ update_device_ctm (MetaColorDevice *color_device)
}
static void
on_color_device_updated (MetaColorManager *color_manager,
MetaColorDevice *color_device)
on_color_device_calibration_changed (MetaColorManager *color_manager,
MetaColorDevice *color_device)
{
update_root_window_atom (color_manager, color_device);
update_device_ctm (color_device);
@ -181,8 +181,8 @@ meta_color_manager_x11_constructed (GObject *object)
{
MetaColorManager *color_manager = META_COLOR_MANAGER (object);
g_signal_connect (color_manager, "device-updated",
G_CALLBACK (on_color_device_updated), NULL);
g_signal_connect (color_manager, "device-calibration-changed",
G_CALLBACK (on_color_device_calibration_changed), NULL);
G_OBJECT_CLASS (meta_color_manager_x11_parent_class)->constructed (object);
}

View file

@ -165,20 +165,20 @@ wait_for_profile_assigned (MetaColorDevice *color_device,
}
static void
on_device_updated (MetaColorDevice *color_device,
gboolean *run)
on_device_calibration_changed (MetaColorDevice *color_device,
gboolean *run)
{
*run = FALSE;
}
static void
wait_for_device_updated (MetaColorDevice *color_device)
wait_for_device_calibration_changed (MetaColorDevice *color_device)
{
gulong handler_id;
gboolean run = TRUE;
handler_id = g_signal_connect (color_device, "updated",
G_CALLBACK (on_device_updated),
handler_id = g_signal_connect (color_device, "calibration-changed",
G_CALLBACK (on_device_calibration_changed),
&run);
while (run)
g_main_context_iteration (NULL, TRUE);
@ -1101,7 +1101,7 @@ meta_test_color_management_night_light_calibrated (void)
set_night_light_temperature (temperature);
set_night_light_active (TRUE);
wait_for_device_updated (color_device);
wait_for_device_calibration_changed (color_device);
assert_gamma_array (night_light_on_red, crtc_test->gamma.red,
crtc_test->gamma.size);
@ -1352,7 +1352,7 @@ meta_test_color_management_night_light_uncalibrated (void)
set_night_light_temperature (temperature);
set_night_light_active (TRUE);
wait_for_device_updated (color_device);
wait_for_device_calibration_changed (color_device);
assert_gamma_array (night_light_on_red, crtc_test->gamma.red,
crtc_test->gamma.size);