monitor-manager: Add API to get monitor from monitor spec

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-12-21 12:41:53 +08:00
parent aaddf44d45
commit 536ae8430b
2 changed files with 22 additions and 0 deletions

View File

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

View File

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