monitor-config-manager: Adjust accelerometer rotation for panel-orientation

The device orientation coming out of iio-sensor-proxy defines upright/normal
as the direction in which the picture is displayed on the LCD panel without
any rotation. This is necessary for accelerometer rotation to work properly
in desktop environments which are not aware of panel-orientation issues.

This means that we need to correct the logical-monitor-config / user-visible
rotation for the panel-orientation when we get rotation info from
iio-sensor-proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
This commit is contained in:
Hans de Goede 2017-10-23 11:50:18 +02:00 committed by Jonas Ådahl
parent 0bbda3ad87
commit f12e6ad4f1

View File

@ -754,6 +754,20 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
if (rotate) if (rotate)
transform = (current_logical_monitor_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED; transform = (current_logical_monitor_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED;
else
{
/*
* The transform coming from the accelerometer should be applied to
* the crtc as is, without taking panel-orientation into account, this
* is done so that non panel-orientation aware desktop environments do the
* right thing. Mutter corrects for panel-orientation when applying the
* transform from a logical-monitor-config, so we must convert here.
*/
MetaMonitor *panel =
meta_monitor_manager_get_laptop_panel (config_manager->monitor_manager);
transform = meta_monitor_crtc_to_logical_transform (panel, transform);
}
if (current_logical_monitor_config->transform == transform) if (current_logical_monitor_config->transform == transform)
return NULL; return NULL;