[gnome-shell/wip/aday/app-grid-layout] workspace: Don't limit workspaceBox size when doing app grid animation



commit 559692f5511eb47408f7786d9c6b2b464dc25e8a
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Tue Feb 16 23:11:30 2021 +0100

    workspace: Don't limit workspaceBox size when doing app grid animation
    
    In the allocate() vfunc of WorkspaceLayout we use a small trick to make
    the nonlinear animation paths when opening the overview less jarring:
    Because a window might get smaller than its target size during the
    animation, we make sure the size never drops below the final size
    calculated by the layout strategy.
    
    In the app grid the Workspace is very small though, and the size of a
    window slot calculated by the layout strategy might actually be larger
    than the workspaceBox. This means we might use the window slot size
    instead of the workspaceBox size and end up with a window that's at the
    correct position, but its size is too large.
    
    Fix this by only applying this trick when we're animating towards or
    from the state where we actually expect the workspaceBox to be larger
    than the window slot, that is during the the transition from the session
    to the window picker (or the other way round).
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1698>

 js/ui/workspace.js | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 730ad20615..ee33f302ab 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -402,7 +402,7 @@ var WorkspaceLayout = GObject.registerClass({
             false),
     },
 }, class WorkspaceLayout extends Clutter.LayoutManager {
-    _init(metaWorkspace, monitorIndex) {
+    _init(metaWorkspace, monitorIndex, overviewAdjustment) {
         super._init();
 
         this._spacing = 20;
@@ -413,6 +413,7 @@ var WorkspaceLayout = GObject.registerClass({
         this._workarea = metaWorkspace
             ? metaWorkspace.get_work_area_for_monitor(this._monitorIndex)
             : Main.layoutManager.getWorkAreaForMonitor(this._monitorIndex);
+        this._overviewAdjustment = overviewAdjustment;
 
         this._container = null;
         this._windows = new Map();
@@ -611,6 +612,10 @@ var WorkspaceLayout = GObject.registerClass({
         const layoutBox = new Clutter.ActorBox();
         let childBox = new Clutter.ActorBox();
 
+        const { ControlsState } = OverviewControls;
+        const inSessionTransition =
+            this._overviewAdjustment.value <= ControlsState.WINDOW_PICKER;
+
         for (const child of container) {
             if (!child.visible)
                 continue;
@@ -639,11 +644,17 @@ var WorkspaceLayout = GObject.registerClass({
             }
 
             workspaceBox.scale(allocationScale);
-            // don't allow the scaled floating size to drop below
-            // the target layout size
-            workspaceBox.set_size(
-                Math.max(workspaceBox.get_width(), width),
-                Math.max(workspaceBox.get_height(), height));
+
+            // Don't allow the scaled floating size to drop below
+            // the target layout size.
+            // We only want to apply this when the scaled floating size is
+            // actually larger than the target layout size, that is while
+            // animating between the session and the window picker.
+            if (inSessionTransition) {
+                workspaceBox.set_size(
+                    Math.max(workspaceBox.get_width(), width),
+                    Math.max(workspaceBox.get_height(), height));
+            }
 
             layoutBox.x1 = x;
             layoutBox.x2 = layoutBox.x1 + width;
@@ -986,7 +997,8 @@ class Workspace extends St.Widget {
             layout_manager: new Clutter.BinLayout(),
         });
 
-        const layoutManager = new WorkspaceLayout(metaWorkspace, monitorIndex);
+        const layoutManager = new WorkspaceLayout(metaWorkspace, monitorIndex,
+            overviewAdjustment);
 
         // Background
         this._background =


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