[mutter] monitor-manager: Use MetaMonitor to check laptop panel status
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-manager: Use MetaMonitor to check laptop panel status
- Date: Wed, 25 Jan 2017 08:35:55 +0000 (UTC)
commit e3b9fe7e58af09d1f3a8fdd5c78a2dd4b938cc16
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Dec 19 14:58:44 2016 +0800
monitor-manager: Use MetaMonitor to check laptop panel status
Instead of looking at the current configuration, just find the
MetaMonitor of the laptop display panel and check the currest status
directly.
https://bugzilla.gnome.org/show_bug.cgi?id=777732
src/backends/meta-monitor-manager-private.h | 2 +
src/backends/meta-monitor-manager.c | 33 ++++++++++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 0de68a0..641071e 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -348,6 +348,8 @@ MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_neighbor (MetaMonit
MetaLogicalMonitor *logical_monitor,
MetaScreenDirection direction);
+MetaMonitor * meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager);
+
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 951cba1..12854ad 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -1198,6 +1198,31 @@ meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager)
return manager->primary_logical_monitor;
}
+static MetaMonitor *
+find_monitor (MetaMonitorManager *monitor_manager,
+ gboolean (*match_func) (MetaMonitor *monitor))
+{
+ GList *monitors;
+ GList *l;
+
+ monitors = meta_monitor_manager_get_monitors (monitor_manager);
+ for (l = monitors; l; l = l->next)
+ {
+ MetaMonitor *monitor = l->data;
+
+ if (match_func (monitor))
+ return monitor;
+ }
+
+ return NULL;
+}
+
+MetaMonitor *
+meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager)
+{
+ return find_monitor (manager, meta_monitor_is_laptop_panel);
+}
+
MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
float x,
@@ -1644,7 +1669,13 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
gboolean
meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
{
+ MetaMonitor *laptop_panel;
+
g_return_val_if_fail (META_IS_MONITOR_MANAGER (manager), FALSE);
- return meta_monitor_config_get_is_builtin_display_on (manager->config);
+ laptop_panel = meta_monitor_manager_get_laptop_panel (manager);
+ if (!laptop_panel)
+ return FALSE;
+
+ return meta_monitor_is_active (laptop_panel);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]