[gnome-shell] workspaceThumbnail: Use current number of workspaces for sizes



commit df2181c91323b869e6f2a680c19b217366cbc7f9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 27 13:29:53 2021 -0300

    workspaceThumbnail: Use current number of workspaces for sizes
    
    There are situations where MetaWorkspaceManager and ThumbnailsBox disagree
    on the number of workspaces, for example when animating them out. It's more
    important to follow the visible number of workspaces while they're updated.
    
    Make vfunc_get_preferred_width() and vfunc_get_preferred_height() use the
    current number of workspace thumbnails to calculate their sizes, instead of
    MetaWorkspaceManager's n-thumbnails property.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

 js/ui/workspaceThumbnail.js | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 839ab89e43..4ca1dd48b8 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1178,13 +1178,12 @@ var ThumbnailsBox = GObject.registerClass({
     }
 
     vfunc_get_preferred_height(forWidth) {
-        let workspaceManager = global.workspace_manager;
         let themeNode = this.get_theme_node();
 
         forWidth = themeNode.adjust_for_width(forWidth);
 
         let spacing = themeNode.get_length('spacing');
-        let nWorkspaces = workspaceManager.n_workspaces;
+        let nWorkspaces = this._thumbnails.length;
         let totalSpacing = (nWorkspaces - 1) * spacing;
 
         const avail = forWidth - totalSpacing;
@@ -1200,11 +1199,10 @@ var ThumbnailsBox = GObject.registerClass({
         // Note that for getPreferredHeight/Width we cheat a bit and skip propagating
         // the size request to our children because we know how big they are and know
         // that the actors aren't depending on the virtual functions being called.
-        let workspaceManager = global.workspace_manager;
         let themeNode = this.get_theme_node();
 
         let spacing = themeNode.get_length('spacing');
-        let nWorkspaces = workspaceManager.n_workspaces;
+        let nWorkspaces = this._thumbnails.length;
         let totalSpacing = (nWorkspaces - 1) * spacing;
 
         const naturalWidth =


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