[mutter] color-manager: Add API to get the color device for a monitor
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] color-manager: Add API to get the color device for a monitor
- Date: Thu, 1 Sep 2022 15:38:14 +0000 (UTC)
commit 6403cfe1700f0516472e08fdcc30727b5fdb63df
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Mon Nov 29 18:17:26 2021 +0100
color-manager: Add API to get the color device for a monitor
There is a 1-on-1 mapping between these two entities, so add a getter.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
src/backends/meta-backend-types.h | 1 +
src/backends/meta-color-manager.c | 12 ++++++++++++
src/backends/meta-color-manager.h | 5 +++++
3 files changed, 18 insertions(+)
---
diff --git a/src/backends/meta-backend-types.h b/src/backends/meta-backend-types.h
index 7b404060d1..0a24734db4 100644
--- a/src/backends/meta-backend-types.h
+++ b/src/backends/meta-backend-types.h
@@ -23,6 +23,7 @@
typedef struct _MetaBackend MetaBackend;
+typedef struct _MetaColorDevice MetaColorDevice;
typedef struct _MetaColorManager MetaColorManager;
typedef struct _MetaMonitorManager MetaMonitorManager;
diff --git a/src/backends/meta-color-manager.c b/src/backends/meta-color-manager.c
index fd1b478142..6f7ac24bfd 100644
--- a/src/backends/meta-color-manager.c
+++ b/src/backends/meta-color-manager.c
@@ -355,3 +355,15 @@ meta_color_manager_get_cd_client (MetaColorManager *color_manager)
return priv->cd_client;
}
+
+MetaColorDevice *
+meta_color_manager_get_color_device (MetaColorManager *color_manager,
+ MetaMonitor *monitor)
+{
+ MetaColorManagerPrivate *priv =
+ meta_color_manager_get_instance_private (color_manager);
+ g_autofree char *monitor_id = NULL;
+
+ monitor_id = generate_monitor_id (monitor);
+ return g_hash_table_lookup (priv->devices, monitor_id);
+}
diff --git a/src/backends/meta-color-manager.h b/src/backends/meta-color-manager.h
index 8053a6b2ae..ca263ac61d 100644
--- a/src/backends/meta-color-manager.h
+++ b/src/backends/meta-color-manager.h
@@ -21,6 +21,7 @@
#include <glib-object.h>
#include "backends/meta-backend-types.h"
+#include "core/util-private.h"
#define META_TYPE_COLOR_MANAGER (meta_color_manager_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaColorManager, meta_color_manager,
@@ -30,4 +31,8 @@ G_DECLARE_DERIVABLE_TYPE (MetaColorManager, meta_color_manager,
MetaBackend *
meta_color_manager_get_backend (MetaColorManager *color_manager);
+META_EXPORT_TEST
+MetaColorDevice * meta_color_manager_get_color_device (MetaColorManager *color_manager,
+ MetaMonitor *monitor);
+
#endif /* META_COLOR_MANAGER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]