Commit 1caa7f76 authored by Jonas Ådahl's avatar Jonas Ådahl

monitor-manager: Add public API to get logical monitor from connector

This adds a function to be used by gnome-shell to get the logical
monitor given a connector name. For now, use the same index integer
method to reference a logical monitor, but this should be revisited by
providing a better API later.
parent 5b4a96e3
......@@ -2909,6 +2909,35 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
return -1;
* meta_monitor_manager_get_monitor_for_connector:
* @manager: A #MetaMonitorManager
* @connector: A valid connector name
* Returns: The monitor index or -1 if @id isn't valid or the connector
* isn't associated with a logical monitor.
meta_monitor_manager_get_monitor_for_connector (MetaMonitorManager *manager,
const char *connector)
GList *l;
for (l = manager->monitors; l; l = l->next)
MetaMonitor *monitor = l->data;
if (g_str_equal (connector, meta_monitor_get_connector (monitor)))
MetaOutput *main_output = meta_monitor_get_main_output (monitor);
return main_output->crtc->logical_monitor->number;
return -1;
meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
......@@ -34,6 +34,9 @@ MetaMonitorManager *meta_monitor_manager_get (void);
gint meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
guint id);
gint meta_monitor_manager_get_monitor_for_connector (MetaMonitorManager *manager,
const char *connector);
gboolean meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment