screenshot: Still remove select/pick actor if grab promise was rejected
If the grab promise is rejected due to for example on X another app already having the grab, an error is thrown and the code that would revert the cursor and hide the actor is not run. This actor then prevents all mouse interactions with the shell and the windows beneath it. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2869 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1600>
This commit is contained in:
parent
9f0e7632a6
commit
0882074ecc
@ -322,14 +322,16 @@ class SelectArea extends St.Widget {
|
|||||||
Main.uiGroup.set_child_above_sibling(this, null);
|
Main.uiGroup.set_child_above_sibling(this, null);
|
||||||
this.show();
|
this.show();
|
||||||
|
|
||||||
|
try {
|
||||||
await this._grabHelper.grabAsync({ actor: this });
|
await this._grabHelper.grabAsync({ actor: this });
|
||||||
|
} finally {
|
||||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||||
|
|
||||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this._result;
|
return this._result;
|
||||||
}
|
}
|
||||||
@ -561,8 +563,9 @@ class PickPixel extends St.Widget {
|
|||||||
|
|
||||||
this._pickColor(...global.get_pointer());
|
this._pickColor(...global.get_pointer());
|
||||||
|
|
||||||
|
try {
|
||||||
await this._grabHelper.grabAsync({ actor: this });
|
await this._grabHelper.grabAsync({ actor: this });
|
||||||
|
} finally {
|
||||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||||
this._previewCursor.destroy();
|
this._previewCursor.destroy();
|
||||||
|
|
||||||
@ -570,6 +573,7 @@ class PickPixel extends St.Widget {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this._result;
|
return this._result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user