mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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
This commit is contained in:
parent
0177ab45af
commit
e3b9fe7e58
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user