Require both mouse and keyboard grabs for some grabs to be successful

Commit 7419674b changed some grabs from requiring both mouse and
keyboard grabs to be considered successful to only requiring either of
them.

Due to this it was possible for example to open the overview or the
screenshot UI with a client (such as Chrome when opening a menu) holding
the mouse grab. This then made it impossible to interact with the UI
using the mouse (or keyboard) and if attempted could result in an
unresponsive UI.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2287>
This commit is contained in:
Sebastian Keller 2022-04-30 08:18:39 +02:00 committed by Marge Bot
parent 3e8164cc36
commit 23b4eb459e
4 changed files with 8 additions and 8 deletions

View File

@ -154,7 +154,7 @@ var GrabHelper = class GrabHelper {
let firstGrab = this._modalCount == 0;
if (firstGrab) {
let grab = Main.pushModal(this._owner, this._modalParams);
if (grab.get_seat_state() === Clutter.GrabState.NONE) {
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
Main.popModal(grab);
return false;
}

View File

@ -453,7 +453,7 @@ class ObjInspector extends St.ScrollView {
return;
const grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
if (grab.get_seat_state() === Clutter.GrabState.NONE) {
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
Main.popModal(grab);
return;
}
@ -1612,7 +1612,7 @@ class LookingGlass extends St.BoxLayout {
return;
let grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
if (grab.get_seat_state() === Clutter.GrabState.NONE) {
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
Main.popModal(grab);
return;
}

View File

@ -237,7 +237,7 @@ var ModalDialog = GObject.registerClass({
if (timestamp)
params['timestamp'] = timestamp;
let grab = Main.pushModal(this, params);
if (grab.get_seat_state() === Clutter.GrabState.NONE) {
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
Main.popModal(grab);
return false;
}

View File

@ -456,14 +456,14 @@ var Overview = class {
const grab = Main.pushModal(global.stage, {
actionMode: Shell.ActionMode.OVERVIEW,
});
if (grab.get_seat_state() !== Clutter.GrabState.NONE) {
this._grab = grab;
this._modal = true;
} else {
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
Main.popModal(grab);
this.hide();
return false;
}
this._grab = grab;
this._modal = true;
}
} else {
// eslint-disable-next-line no-lonely-if