monitor-manager: Don't apply unneeded orientation changes

There's no need to ensure monitor orientation changes if the wanted
orientation is matching the current one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1233>
This commit is contained in:
Marco Trevisan (Treviño) 2020-05-01 15:34:25 +02:00 committed by Jonas Ådahl
parent e976137d97
commit 2289f56112

View File

@ -811,6 +811,14 @@ handle_orientation_change (MetaOrientationManager *orientation_manager,
MetaMonitorTransform transform; MetaMonitorTransform transform;
GError *error = NULL; GError *error = NULL;
MetaMonitorsConfig *config; MetaMonitorsConfig *config;
MetaMonitor *laptop_panel;
MetaLogicalMonitor *laptop_logical_monitor;
laptop_panel = meta_monitor_manager_get_laptop_panel (manager);
g_return_if_fail (laptop_panel);
if (!meta_monitor_is_active (laptop_panel))
return;
switch (meta_orientation_manager_get_orientation (orientation_manager)) switch (meta_orientation_manager_get_orientation (orientation_manager))
{ {
@ -832,6 +840,10 @@ handle_orientation_change (MetaOrientationManager *orientation_manager,
return; return;
} }
laptop_logical_monitor = meta_monitor_get_logical_monitor (laptop_panel);
if (meta_logical_monitor_get_transform (laptop_logical_monitor) == transform)
return;
config = config =
meta_monitor_config_manager_create_for_orientation (manager->config_manager, meta_monitor_config_manager_create_for_orientation (manager->config_manager,
transform); transform);