mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
backends: Avoid orientation changes around suspend/resume if locked
We currently lock the capability of the MetaOrientationManager to emit the ::orientation-changed signal, but otherwise keep reading the current orientation and returning it if we are asked politely through meta_orientation_manager_get_orientation(). This may bring issues e.g. around suspend/resume, since there may be other parts of the code trying to get the current orientation without receiving ::orientation-changed signals, this may result in the display orientation being effectively rotated, then stay locked after that. In order to fix this, make the MetaOrientationManager return a fixed orientation while locked, only updated after changes in the lock state. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2600 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3021>
This commit is contained in:
parent
410c08e1e2
commit
b5900dd97a
@ -56,6 +56,7 @@ struct _MetaOrientationManager
|
||||
GDBusProxy *iio_proxy;
|
||||
MetaOrientation prev_orientation;
|
||||
MetaOrientation curr_orientation;
|
||||
MetaOrientation effective_orientation;
|
||||
guint has_accel : 1;
|
||||
|
||||
GSettings *settings;
|
||||
@ -130,6 +131,7 @@ sync_state (MetaOrientationManager *self)
|
||||
return;
|
||||
|
||||
self->prev_orientation = self->curr_orientation;
|
||||
self->effective_orientation = self->curr_orientation;
|
||||
|
||||
if (self->curr_orientation == META_ORIENTATION_UNDEFINED)
|
||||
return;
|
||||
@ -293,6 +295,8 @@ meta_orientation_manager_init (MetaOrientationManager *self)
|
||||
G_CALLBACK (orientation_lock_changed), self, 0);
|
||||
sync_state (self);
|
||||
}
|
||||
|
||||
self->effective_orientation = META_ORIENTATION_UNDEFINED;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -361,7 +365,7 @@ meta_orientation_manager_class_init (MetaOrientationManagerClass *klass)
|
||||
MetaOrientation
|
||||
meta_orientation_manager_get_orientation (MetaOrientationManager *self)
|
||||
{
|
||||
return self->curr_orientation;
|
||||
return self->effective_orientation;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user