meta-monitor-manager: Add API to rotate the current configuration

This will allows us to support the XF86RotateWindows key present on
some laptops directly in mutter.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
This commit is contained in:
Rui Matos 2017-05-04 14:25:47 +02:00
parent 6ae42f3845
commit 7360f51ee8
2 changed files with 31 additions and 0 deletions

View File

@ -554,6 +554,8 @@ gboolean meta_monitor_manager_get_max_screen_size (MetaMonitorManager
MetaLogicalMonitorLayoutMode
meta_monitor_manager_get_default_layout_mode (MetaMonitorManager *manager);
void meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager);
void meta_monitor_manager_clear_output (MetaOutput *output);
void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);

View File

@ -3255,3 +3255,32 @@ meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
return meta_monitor_is_active (laptop_panel);
}
void
meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager)
{
if (!meta_is_monitor_config_manager_enabled ())
{
meta_monitor_config_rotate_monitor (manager->legacy_config);
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use rotate monitor configuration: %s",
error->message);
g_error_free (error);
}
g_object_unref (config);
}
}