mirror of
https://github.com/brl/mutter.git
synced 2025-02-26 09:44:10 +00:00
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>
This commit is contained in:
parent
99d0c37d32
commit
ceedc0e5fb
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user