[gnome-shell] switcherPopup: Dismiss when a system modal dialog opens



commit c0309d973268920eb9740bbdca3afc894bd5204f
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Dec 6 13:56:24 2019 +0100

    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

 js/ui/layout.js        | 1 +
 js/ui/modalDialog.js   | 2 ++
 js/ui/switcherPopup.js | 5 +++++
 3 files changed, 8 insertions(+)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 7fb9f24193..c7dd6287f7 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -189,6 +189,7 @@ var LayoutManager = GObject.registerClass({
                'startup-complete': {},
                'startup-prepared': {},
                'monitors-changed': {},
+               'system-modal-opened': {},
                'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } },
 }, class LayoutManager extends GObject.Object {
     _init() {
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index c29b89ba77..caa874454f 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -219,6 +219,8 @@ var ModalDialog = GObject.registerClass({
         if (!Main.pushModal(this, params))
             return false;
 
+        Main.layoutManager.emit('system-modal-opened');
+
         this._hasModal = true;
         if (this._savedKeyFocus) {
             this._savedKeyFocus.grab_key_focus();
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 48f44c90f7..945f4020a5 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -46,6 +46,9 @@ var SwitcherPopup = GObject.registerClass({
 
         Main.uiGroup.add_actor(this);
 
+        this._systemModalOpenedId =
+            Main.layoutManager.connect('system-modal-opened', () => this.destroy());
+
         this._haveModal = false;
         this._modifierMask = 0;
 
@@ -319,6 +322,8 @@ var SwitcherPopup = GObject.registerClass({
     _onDestroy() {
         this._popModal();
 
+        Main.layoutManager.disconnect(this._systemModalOpenedId);
+
         if (this._motionTimeoutId != 0)
             GLib.source_remove(this._motionTimeoutId);
         if (this._initialDelayTimeoutId != 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]