From 3005a400ca7a85f3931444c1bbba360dc3059984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 21 Jun 2017 13:44:06 +0800 Subject: [PATCH] monitor-manager: Add helper for getting monitor from connector This will be used later. https://bugzilla.gnome.org/show_bug.cgi?id=784199 --- src/backends/meta-monitor-manager-private.h | 3 +++ src/backends/meta-monitor-manager.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index 4d079bec7..563bf92e2 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -449,6 +449,9 @@ MetaMonitor * meta_monitor_manager_get_laptop_panel (MetaMonitorManager *m MetaMonitor * meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager, MetaMonitorSpec *monitor_spec); +MetaMonitor * meta_monitor_manager_get_monitor_from_connector (MetaMonitorManager *manager, + const char *connector); + 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 253b83aec..1dd7c2081 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -2313,6 +2313,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_connector (MetaMonitorManager *manager, + const char *connector) +{ + GList *l; + + for (l = manager->monitors; l; l = l->next) + { + MetaMonitor *monitor = l->data; + + if (g_str_equal (meta_monitor_get_connector (monitor), + connector)) + return monitor; + } + + return NULL; +} + MetaMonitor * meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager, MetaMonitorSpec *monitor_spec)