[mutter] orientation-manager: Do not change current orientation when locked



commit c37e2523ace072a7fd556b0c7fb29fc6387836b3
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Dec 4 14:36:17 2019 +0100

    orientation-manager: Do not change current orientation when locked
    
    Bail out of sync_state() immediately if the orientation is locked, before
    calling read_iio_prox() which updates the curr_orientation value.
    
    There are 2 reasons for this change:
    
    1. Currently meta-monitor-config-manager.c always assumes normal / upright
    orientation when generating a new config. This means that e.g. when an
    external monitor gets plugged in the builtin panel's transform will be reset
    to normal / upright even if the device is not in an upright orientation.
    
    To fix this meta-monitor-config-manager.c needs to call
    meta_orientation_manager_get_orientation() to get the current orientation
    when generating a new config. Without this change locking the orientation
    would stop the emitting of "orientation-changed" signals but we would
    still update the curr_orientation value. So when a new config needs to
    be generated the latest orientation would be used, effectively ignoring
    the "orientation-lock" setting, not updating curr_orientation when
    locked fixes this.
    
    2. This ensures we properly emit an an "orientation-changed" signal when
    the orientation has changed between when it was locked and it was
    unlocked. Before this change if the user locked the orientation, changed it
    and then unlocked it, no signal would be raised as we would already have
    updated the curr_orientation value turning the sync_state() call in
    orientation_lock_changed() into a no-op.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/959

 src/backends/meta-orientation-manager.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-orientation-manager.c b/src/backends/meta-orientation-manager.c
index 4f57248eb..9bf9e41da 100644
--- a/src/backends/meta-orientation-manager.c
+++ b/src/backends/meta-orientation-manager.c
@@ -100,6 +100,9 @@ read_iio_proxy (MetaOrientationManager *self)
 static void
 sync_state (MetaOrientationManager *self)
 {
+  if (g_settings_get_boolean (self->settings, ORIENTATION_LOCK_KEY))
+    return;
+
   read_iio_proxy (self);
 
   if (self->prev_orientation == self->curr_orientation)
@@ -110,9 +113,6 @@ sync_state (MetaOrientationManager *self)
   if (self->curr_orientation == META_ORIENTATION_UNDEFINED)
     return;
 
-  if (g_settings_get_boolean (self->settings, ORIENTATION_LOCK_KEY))
-    return;
-
   g_signal_emit (self, signals[ORIENTATION_CHANGED], 0);
 }
 


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