authPrompt: Handle Escape key to cancel ongoing verification

Escape key is supposed to cancel a verification, however if the user
already hit Enter to begin the authentication the Escape key won't work
until the verification completed.

This may be quite inconvenient when an user did a typo while writing and
wants to cancel the already started auth.

So, while authenticating (or in general while the entry is unsensitive)
give the key focus to the authpromt itself so that we can still get the
input events and cancel an user action.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1622>
This commit is contained in:
Marco Trevisan (Treviño) 2021-02-01 12:52:01 +01:00 committed by Marge Bot
parent 3e96952fde
commit 7e77881717

View File

@ -432,11 +432,15 @@ var AuthPrompt = GObject.registerClass({
this._entry.reactive = sensitive;
if (sensitive)
if (sensitive) {
this._entry.grab_key_focus();
else if (this._entry === this._passwordEntry)
} else {
this.grab_key_focus();
if (this._entry === this._passwordEntry)
this._entry.password_visible = false;
}
}
vfunc_hide() {
this.setActorInDefaultButtonWell(null, true);