switcherPopup: Dismiss when a system modal dialog opens

As system modal dialogs may open without user interaction (for instance
polkit or network agent requests), it is possible for them to pop up
while the app/window switcher is up.

The current result of having both up simultaneously is clearly broken,
so we can either dismiss the popup or prevent the modal dialog from
opening. Assume that the dialog indicates a more important action and
should therefore take precedence, so go with the former.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1536
This commit is contained in:
Florian Müllner 2019-12-06 13:56:24 +01:00
parent 5043e6d6bd
commit 61fccf188a
3 changed files with 8 additions and 0 deletions

View File

@ -189,6 +189,7 @@ var LayoutManager = GObject.registerClass({
'startup-complete': {}, 'startup-complete': {},
'startup-prepared': {}, 'startup-prepared': {},
'monitors-changed': {}, 'monitors-changed': {},
'system-modal-opened': {},
'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } }, 'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } },
}, class LayoutManager extends GObject.Object { }, class LayoutManager extends GObject.Object {
_init() { _init() {

View File

@ -216,6 +216,8 @@ var ModalDialog = GObject.registerClass({
if (!Main.pushModal(this, params)) if (!Main.pushModal(this, params))
return false; return false;
Main.layoutManager.emit('system-modal-opened');
this._hasModal = true; this._hasModal = true;
if (this._savedKeyFocus) { if (this._savedKeyFocus) {
this._savedKeyFocus.grab_key_focus(); this._savedKeyFocus.grab_key_focus();

View File

@ -46,6 +46,9 @@ var SwitcherPopup = GObject.registerClass({
Main.uiGroup.add_actor(this); Main.uiGroup.add_actor(this);
this._systemModalOpenedId =
Main.layoutManager.connect('system-modal-opened', () => this.destroy());
this._haveModal = false; this._haveModal = false;
this._modifierMask = 0; this._modifierMask = 0;
@ -312,6 +315,8 @@ var SwitcherPopup = GObject.registerClass({
_onDestroy() { _onDestroy() {
this._popModal(); this._popModal();
Main.layoutManager.disconnect(this._systemModalOpenedId);
if (this._motionTimeoutId != 0) if (this._motionTimeoutId != 0)
GLib.source_remove(this._motionTimeoutId); GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0) if (this._initialDelayTimeoutId != 0)