[mutter] monitor-manager: Add `get_vendor_name` API
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-manager: Add `get_vendor_name` API
- Date: Fri, 28 Jun 2019 09:27:19 +0000 (UTC)
commit c3c6668343624d7ac2fdf70fc1fd2f63ec12ecc4
Author: Olivier Fourdan <ofourdan redhat com>
Date: Wed Jun 26 12:29:22 2019 +0200
monitor-manager: Add `get_vendor_name` API
The monitor manager keeps the list of PnP Ids, add a new API to get the
vendor name from a given PnP ID.
https://gitlab.gnome.org/GNOME/mutter/issues/645
src/backends/meta-monitor-manager-private.h | 3 +++
src/backends/meta-monitor-manager.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index f34c01ae1..20bb6b679 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -385,4 +385,7 @@ void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
gboolean meta_monitor_has_aspect_as_size (MetaMonitor *monitor);
+char * meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
+ const char *vendor);
+
#endif /* META_MONITOR_MANAGER_PRIVATE_H */
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 35ae2c736..6ac7544c0 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -3189,3 +3189,23 @@ meta_monitor_manager_get_config_manager (MetaMonitorManager *manager)
{
return manager->config_manager;
}
+
+/**
+ * meta_monitor_manager_get_vendor_name:
+ * @manager: A #MetaMonitorManager object
+ * @vendor: the PNP ID of the monitor
+ *
+ * Find the full vendor name from the given monitor PNP ID.
+ *
+ * Returns: (transfer full): A string containing the vendor name,
+ * or NULL when not found.
+ */
+char *
+meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
+ const char *vendor)
+{
+ if (!manager->pnp_ids)
+ manager->pnp_ids = gnome_pnp_ids_new ();
+
+ return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]