[mutter] color: Emit signal when device is updated
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] color: Emit signal when device is updated
- Date: Thu, 1 Sep 2022 17:08:35 +0000 (UTC)
commit ceedc0e5fbcccded3b1ffec1fd9dab7e6f74874e
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Mon Dec 6 11:40:46 2021 +0100
color: Emit signal when device is updated
Will be emitted when a device updated its color state. Will be used by
an X11 color manager implementation, and tests.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
src/backends/meta-color-device.c | 9 +++++++++
src/backends/meta-color-manager.c | 27 +++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
---
diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c
index 3bfe776a27..108efeaafb 100644
--- a/src/backends/meta-color-device.c
+++ b/src/backends/meta-color-device.c
@@ -37,6 +37,7 @@ enum
{
READY,
CHANGED,
+ UPDATED,
N_SIGNALS
};
@@ -322,6 +323,12 @@ meta_color_device_class_init (MetaColorDeviceClass *klass)
G_SIGNAL_RUN_LAST, 0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ signals[UPDATED] =
+ g_signal_new ("updated",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
}
static void
@@ -1133,4 +1140,6 @@ meta_color_device_update (MetaColorDevice *color_device,
lut_size);
meta_monitor_set_gamma_lut (monitor, lut);
+
+ g_signal_emit (color_device, signals[UPDATED], 0);
}
diff --git a/src/backends/meta-color-manager.c b/src/backends/meta-color-manager.c
index 6702e34ffe..b460c7238c 100644
--- a/src/backends/meta-color-manager.c
+++ b/src/backends/meta-color-manager.c
@@ -57,6 +57,15 @@
#define DEFAULT_TEMPERATURE 6500 /* Kelvin */
+enum
+{
+ DEVICE_UPDATED,
+
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS];
+
enum
{
PROP_0,
@@ -122,6 +131,13 @@ on_device_changed (MetaColorDevice *color_device,
meta_color_device_update (color_device, priv->temperature);
}
+static void
+on_device_updated (MetaColorDevice *color_device,
+ MetaColorManager *color_manager)
+{
+ g_signal_emit (color_manager, signals[DEVICE_UPDATED], 0, color_device);
+}
+
static char *
generate_monitor_id (MetaMonitor *monitor)
{
@@ -202,6 +218,9 @@ update_devices (MetaColorManager *color_manager)
g_signal_connect_object (color_device, "changed",
G_CALLBACK (on_device_changed),
color_manager, 0);
+ g_signal_connect_object (color_device, "updated",
+ G_CALLBACK (on_device_updated),
+ color_manager, 0);
}
}
@@ -490,6 +509,14 @@ meta_color_manager_class_init (MetaColorManagerClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
+
+ signals[DEVICE_UPDATED] =
+ g_signal_new ("device-updated",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ META_TYPE_COLOR_DEVICE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]