From c123178f1c31e15153c5a47bd3bc2d5a4d5896f4 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 25 Jul 2024 16:10:25 +0200 Subject: [PATCH] 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: --- src/backends/meta-color-device.c | 21 +++++++++++++++++---- src/backends/meta-color-manager.c | 17 +++++++++-------- src/backends/x11/meta-color-manager-x11.c | 8 ++++---- src/tests/color-management-tests.c | 14 +++++++------- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c index 5f8c1968f..5b9502cd6 100644 --- a/src/backends/meta-color-device.c +++ b/src/backends/meta-color-device.c @@ -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); } diff --git a/src/backends/meta-color-manager.c b/src/backends/meta-color-manager.c index 463d1ba46..6d6f5dc77 100644 --- a/src/backends/meta-color-manager.c +++ b/src/backends/meta-color-manager.c @@ -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, diff --git a/src/backends/x11/meta-color-manager-x11.c b/src/backends/x11/meta-color-manager-x11.c index 64ecfc849..6826e178b 100644 --- a/src/backends/x11/meta-color-manager-x11.c +++ b/src/backends/x11/meta-color-manager-x11.c @@ -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); } diff --git a/src/tests/color-management-tests.c b/src/tests/color-management-tests.c index f47122e4b..1039ec8ba 100644 --- a/src/tests/color-management-tests.c +++ b/src/tests/color-management-tests.c @@ -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);