js: Change main.pushModal to return the Clutter.Grab handle
All callers have been updated to keep this handle to identify their own grab. Also, optionally use the windowing state to determine whether the grab is suitable for the specific uses. This removes the need to trying to grab twice in the places where we settle for a keyboard grab. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
This commit is contained in:
@ -492,9 +492,12 @@ var Overview = class {
|
||||
let shouldBeModal = !this._inXdndDrag;
|
||||
if (shouldBeModal && !this._modal) {
|
||||
let actionMode = Shell.ActionMode.OVERVIEW;
|
||||
if (Main.pushModal(global.stage, { actionMode })) {
|
||||
let grab = Main.pushModal(global.stage, { actionMode });
|
||||
if (grab.get_seat_state() !== Clutter.GrabState.NONE) {
|
||||
this._grab = grab;
|
||||
this._modal = true;
|
||||
} else {
|
||||
Main.popModal(grab);
|
||||
this.hide();
|
||||
return false;
|
||||
}
|
||||
@ -502,7 +505,8 @@ var Overview = class {
|
||||
} else {
|
||||
// eslint-disable-next-line no-lonely-if
|
||||
if (this._modal) {
|
||||
Main.popModal(global.stage);
|
||||
Main.popModal(this._grab);
|
||||
this._grab = false;
|
||||
this._modal = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user