[mutter] monitor-manager: Add API to get monitor from monitor spec



commit 536ae8430b0d3b6674587d8529b369d6feba8d1c
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Dec 21 12:41:53 2016 +0800

    monitor-manager: Add API to get monitor from monitor spec
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/backends/meta-monitor-manager-private.h |    4 ++++
 src/backends/meta-monitor-manager.c         |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 00bbfc5..f579b97 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -52,6 +52,7 @@ typedef struct _MetaMonitorConfig MetaMonitorConfig;
 typedef struct _MetaMonitor MetaMonitor;
 typedef struct _MetaMonitorNormal MetaMonitorNormal;
 typedef struct _MetaMonitorTiled MetaMonitorTiled;
+typedef struct _MetaMonitorSpec MetaMonitorSpec;
 typedef struct _MetaLogicalMonitor MetaLogicalMonitor;
 
 typedef struct _MetaCrtc MetaCrtc;
@@ -357,6 +358,9 @@ MetaMonitor *       meta_monitor_manager_get_primary_monitor (MetaMonitorManager
 
 MetaMonitor *       meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager);
 
+MetaMonitor *       meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
+                                                                MetaMonitorSpec    *monitor_spec);
+
 GList *             meta_monitor_manager_get_monitors      (MetaMonitorManager *manager);
 
 MetaOutput         *meta_monitor_manager_get_outputs       (MetaMonitorManager *manager,
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 17b81b9..d1f35e3 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -1264,6 +1264,24 @@ meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager)
   return find_monitor (manager, meta_monitor_is_laptop_panel);
 }
 
+MetaMonitor *
+meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
+                                            MetaMonitorSpec    *monitor_spec)
+{
+  GList *l;
+
+  for (l = manager->monitors; l; l = l->next)
+    {
+      MetaMonitor *monitor = l->data;
+
+      if (meta_monitor_spec_equals (meta_monitor_get_spec (monitor),
+                                    monitor_spec))
+        return monitor;
+    }
+
+  return NULL;
+}
+
 MetaLogicalMonitor *
 meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
                                              float               x,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]