[gnome-shell/gnome-42] switchMonitor: Fix initial selection on desktop



commit 379845337487b4f6a3a62953eb70921ad51423fe
Author: Yao Wei (魏銘廷) <yao wei canonical com>
Date:   Mon Aug 29 16:45:05 2022 +0800

    switchMonitor: Fix initial selection on desktop
    
    Due to !2056 the monitor config is 2 instead of 4 on the desktop.
    However, the constant `Meta.MonitorSwitchConfigType.UNKNOWN` is fixed to
    4, and may cause the initial selection to be out of index thus fail to
    display the switcher.  This replaces the above constant to the actual
    length of the switcher items.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2451>
    (cherry picked from commit 137c50b6dc7d8a6eec844d7e2baf8aabb3680a89)

 js/ui/switchMonitor.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/switchMonitor.js b/js/ui/switchMonitor.js
index 10b4a50cde..a95c5fa9ad 100644
--- a/js/ui/switchMonitor.js
+++ b/js/ui/switchMonitor.js
@@ -63,7 +63,7 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup {
 
     _initialSelection() {
         let currentConfig = Meta.MonitorManager.get().get_switch_config();
-        let selectConfig = (currentConfig + 1) % Meta.MonitorSwitchConfigType.UNKNOWN;
+        let selectConfig = (currentConfig + 1) % this._items.length;
         this._select(selectConfig);
     }
 


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