authPrompt: Consume cancel key event

The auth prompt currently propagates all key presses, even the
Escape press that is used to cancel it.

On the lock screen that means that the same event that cancels
the prompt (and switches back to the clock) is *also* propagated
to the handler that activates the prompt on key press.

That handler doesn't do anything when the prompt is already visible,
which is the case when the transition to the clock is animated.

However when animations are disabled, canceling the prompt will
result in a new prompt getting created immediately, and the login
screen is stuck on the prompt.

Fix this by not propagating key events that are used to cancel
the prompt.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3317>
(cherry picked from commit e7dc0de75e)
This commit is contained in:
Florian Müllner 2024-05-15 01:55:40 +02:00
parent bdf981b171
commit 6f4529e44d
No known key found for this signature in database

View file

@ -134,8 +134,10 @@ export const AuthPrompt = GObject.registerClass({
}
on_key_press_event(event) {
if (event.get_key_symbol() === Clutter.KEY_Escape)
if (event.get_key_symbol() === Clutter.KEY_Escape) {
this.cancel();
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
}