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
This commit is contained in:
parent
c4f8b93357
commit
c37e2523ac
@ -100,6 +100,9 @@ read_iio_proxy (MetaOrientationManager *self)
|
|||||||
static void
|
static void
|
||||||
sync_state (MetaOrientationManager *self)
|
sync_state (MetaOrientationManager *self)
|
||||||
{
|
{
|
||||||
|
if (g_settings_get_boolean (self->settings, ORIENTATION_LOCK_KEY))
|
||||||
|
return;
|
||||||
|
|
||||||
read_iio_proxy (self);
|
read_iio_proxy (self);
|
||||||
|
|
||||||
if (self->prev_orientation == self->curr_orientation)
|
if (self->prev_orientation == self->curr_orientation)
|
||||||
@ -110,9 +113,6 @@ sync_state (MetaOrientationManager *self)
|
|||||||
if (self->curr_orientation == META_ORIENTATION_UNDEFINED)
|
if (self->curr_orientation == META_ORIENTATION_UNDEFINED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_settings_get_boolean (self->settings, ORIENTATION_LOCK_KEY))
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_signal_emit (self, signals[ORIENTATION_CHANGED], 0);
|
g_signal_emit (self, signals[ORIENTATION_CHANGED], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user