popupMenu: Close when a system modal pops up

Just like switcher popups, popup menus don't play well together with
system modals, and generally have a lower priority. So just like
switcher popups, close popup menus when a system modal dialog pops
up.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1536
This commit is contained in:
Florian Müllner 2019-12-06 18:07:35 +01:00
parent 61fccf188a
commit afd2ce2353

View File

@ -804,6 +804,7 @@ var PopupMenu = class extends PopupMenuBase {
this._keyPressId = this.sourceActor.connect('key-press-event', this._keyPressId = this.sourceActor.connect('key-press-event',
this._onKeyPress.bind(this)); this._onKeyPress.bind(this));
this._systemModalOpenedId = 0;
this._openedSubMenu = null; this._openedSubMenu = null;
} }
@ -878,6 +879,11 @@ var PopupMenu = class extends PopupMenuBase {
if (this.isEmpty()) if (this.isEmpty())
return; return;
if (!this._systemModalOpenedId) {
this._systemModalOpenedId =
Main.layoutManager.connect('system-modal-opened', () => this.close());
}
this.isOpen = true; this.isOpen = true;
this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment); this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
@ -908,6 +914,11 @@ var PopupMenu = class extends PopupMenuBase {
destroy() { destroy() {
if (this._keyPressId) if (this._keyPressId)
this.sourceActor.disconnect(this._keyPressId); this.sourceActor.disconnect(this._keyPressId);
if (this._systemModalOpenedId)
Main.layoutManager.disconnect(this._systemModalOpenedId);
this._systemModalOpenedId = 0;
super.destroy(); super.destroy();
} }
}; };