[gnome-shell] windowManager: Use MetaWindow.has_attached_dialogs()



commit 5106ca929118ef2e981b030338cde225ad008dd8
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Nov 30 18:31:19 2021 +0100

    windowManager: Use MetaWindow.has_attached_dialogs()
    
    Now that MetaWindow itself exposes a method for checking for
    attached dialogs, we can use that instead of our own helper
    method.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2054>

 js/ui/windowManager.js | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 72cadd9ac0..d3c4d26552 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1397,22 +1397,8 @@ var WindowManager = class {
         }
     }
 
-    _hasAttachedDialogs(window, ignoreWindow) {
-        var count = 0;
-        window.foreach_transient(win => {
-            if (win != ignoreWindow &&
-                win.is_attached_dialog() &&
-                win.get_transient_for() == window) {
-                count++;
-                return false;
-            }
-            return true;
-        });
-        return count != 0;
-    }
-
-    _checkDimming(window, ignoreWindow) {
-        let shouldDim = this._hasAttachedDialogs(window, ignoreWindow);
+    _checkDimming(window) {
+        const shouldDim = window.has_attached_dialogs();
 
         if (shouldDim && !window._dimmed) {
             window._dimmed = true;
@@ -1558,7 +1544,7 @@ var WindowManager = class {
         }
 
         if (window.is_attached_dialog())
-            this._checkDimming(window.get_transient_for(), window);
+            this._checkDimming(window.get_transient_for());
 
         let types = [Meta.WindowType.NORMAL,
                      Meta.WindowType.DIALOG,


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