monitor-manager: Add get_is_builtin_display_on()

Wrap the existing laptop_display_is_on() method in a public function
that gnome-shell can use to query whether a builtin output is present
and enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
This commit is contained in:
Florian Müllner 2016-04-20 20:00:45 +02:00
parent b6f11fa8b8
commit ed5c3b39ee
4 changed files with 23 additions and 0 deletions

View File

@ -1041,6 +1041,17 @@ apply_configuration_with_lid (MetaMonitorConfig *self,
return apply_configuration (self, config, manager); return apply_configuration (self, config, manager);
} }
gboolean
meta_monitor_config_get_is_builtin_display_on (MetaMonitorConfig *self)
{
g_return_val_if_fail (META_IS_MONITOR_CONFIG (self), FALSE);
if (self->current)
return laptop_display_is_on (self->current);
return FALSE;
}
gboolean gboolean
meta_monitor_config_apply_stored (MetaMonitorConfig *self, meta_monitor_config_apply_stored (MetaMonitorConfig *self,
MetaMonitorManager *manager) MetaMonitorManager *manager)

View File

@ -49,4 +49,6 @@ void meta_monitor_config_make_persistent (MetaMonitorConfig *confi
void meta_monitor_config_restore_previous (MetaMonitorConfig *config, void meta_monitor_config_restore_previous (MetaMonitorConfig *config,
MetaMonitorManager *manager); MetaMonitorManager *manager);
gboolean meta_monitor_config_get_is_builtin_display_on (MetaMonitorConfig *config);
#endif /* META_MONITOR_CONFIG_H */ #endif /* META_MONITOR_CONFIG_H */

View File

@ -1599,3 +1599,11 @@ meta_monitor_manager_get_monitor_at_point (MetaMonitorManager *manager,
return -1; return -1;
} }
gboolean
meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
{
g_return_val_if_fail (META_IS_MONITOR_MANAGER (manager), FALSE);
return meta_monitor_config_get_is_builtin_display_on (manager->config);
}

View File

@ -34,4 +34,6 @@ MetaMonitorManager *meta_monitor_manager_get (void);
gint meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager, gint meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
guint id); guint id);
gboolean meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager);
#endif /* META_MONITOR_MANAGER_H */ #endif /* META_MONITOR_MANAGER_H */