From e659b07c39eb40ad10cf5cb401956d1f7e5216cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 29 Nov 2016 11:46:41 +0800 Subject: [PATCH] MetaMonitorManager: Add API turning monitor index into logical monitor This is the current equivalent of looking up the logical monitor in the logical monitor array using the number, but eventually that will be deprecated, and before that done differently, so add a temporary helper for the places that has not been ported yet. https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/backends/meta-monitor-manager-private.h | 3 +++ src/backends/meta-monitor-manager.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index f36a7a5d7..d57645080 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -368,6 +368,9 @@ int meta_monitor_manager_get_num_logical_monitors (MetaMonitorMa MetaLogicalMonitor *meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager, unsigned int *n_logical_monitors); +MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager, + int number); + MetaLogicalMonitor *meta_monitor_manager_get_primary_logical_monitor (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 e81eb7e6e..d2cafb1c9 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -1314,6 +1314,15 @@ meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager, return manager->logical_monitors; } +MetaLogicalMonitor * +meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager, + int number) +{ + g_assert (number < (int) manager->n_logical_monitors); + + return &manager->logical_monitors[number]; +} + MetaLogicalMonitor * meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager) {