mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
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:
parent
2709f6c102
commit
7419674bd3
12 changed files with 87 additions and 52 deletions
|
|
@ -181,9 +181,13 @@ var GrabHelper = class GrabHelper {
|
|||
_takeModalGrab() {
|
||||
let firstGrab = this._modalCount == 0;
|
||||
if (firstGrab) {
|
||||
if (!Main.pushModal(this._owner, this._modalParams))
|
||||
let grab = Main.pushModal(this._owner, this._modalParams);
|
||||
if (grab.get_seat_state() === Clutter.GrabState.NONE) {
|
||||
Main.popModal(grab);
|
||||
return false;
|
||||
}
|
||||
|
||||
this._grab = grab;
|
||||
this._capturedEventId = this._owner.connect('captured-event',
|
||||
(actor, event) => {
|
||||
return this.onCapturedEvent(event);
|
||||
|
|
@ -202,7 +206,8 @@ var GrabHelper = class GrabHelper {
|
|||
this._owner.disconnect(this._capturedEventId);
|
||||
this._ignoreUntilRelease = false;
|
||||
|
||||
Main.popModal(this._owner);
|
||||
Main.popModal(this._grab);
|
||||
this._grab = null;
|
||||
}
|
||||
|
||||
// ignoreRelease:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue