[mutter] monitor-config-manager: Adjust accelerometer rotation for panel-orientation



commit f12e6ad4f18c34c30777f91903ea891216468b88
Author: Hans de Goede <hdegoede redhat com>
Date:   Mon Oct 23 11:50:18 2017 +0200

    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

 src/backends/meta-monitor-config-manager.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index 41d6b4b..197892b 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -754,6 +754,20 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
 
   if (rotate)
     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)
     return NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]