monitor-manager: Add helper for getting monitor from connector

This will be used later.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
This commit is contained in:
Jonas Ådahl 2017-06-21 13:44:06 +08:00
parent 34e7134db2
commit 3005a400ca
2 changed files with 21 additions and 0 deletions

View File

@ -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,

View File

@ -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)