[gnome-shell] workspace: Make window preview overlays overflow the allocation



commit fcc80407ea7e18332a5f30b11665a0bea530b876
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Feb 12 16:40:36 2021 +0100

    workspace: Make window preview overlays overflow the allocation
    
    We want to use as much space as possible for showing window previews in
    the overview, and the title and close buttons of those windows are only
    visible on hover, so we can show them above anything if we want.
    
    On both primary monitors and secondary monitors, there's a certain free
    space available towards the bottom edge of the monitor (on the primary
    monitor we show the dash there, and secondary monitors just scale down
    the Workspaces). We can make use of this by checking how much free space
    there is available from the bottom edge of our allocation to the bottom
    edge of the monitor, and then aligning the window previews to make full
    use of this space.
    
    So stop adding any padding to the edges of the Workspace, which will
    make the windows a lot larger and completely fill the Workspaces
    allocation.
    
    The left, top and right monitor edges should always be far enough away
    to accomodate the close button and hover scale-up of the window. Only
    with the bottom edge of the monitor we have to be a bit more careful
    (the overflowing height of the window title is quite big), so there we
    check if enough free space is available. If there isn't enough free
    space, we simply apply a bit of bottom padding again and shift the
    window up.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1813>

 js/ui/workspace.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 2d6764dc41..368f2f31ab 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -476,13 +476,18 @@ var WorkspaceLayout = GObject.registerClass({
             colSpacing += oversize;
 
         if (containerBox) {
-            const [topOverlap, bottomOverlap] = window.overlapHeights();
-            const overlap = Math.max(topOverlap, bottomOverlap);
+            const monitor = Main.layoutManager.monitors[this._monitorIndex];
 
-            containerBox.x1 += oversize;
-            containerBox.x2 -= oversize;
-            containerBox.y1 += oversize + overlap;
-            containerBox.y2 -= oversize + overlap;
+            const bottomPoint = new Graphene.Point3D({ y: containerBox.y2 });
+            const transformedBottomPoint =
+                this._container.apply_transform_to_point(bottomPoint);
+            const bottomFreeSpace =
+                (monitor.y + monitor.height) - transformedBottomPoint.y;
+
+            const [, bottomOverlap] = window.overlapHeights();
+
+            if ((bottomOverlap + oversize) > bottomFreeSpace)
+                containerBox.y2 -= (bottomOverlap + oversize) - bottomFreeSpace;
         }
 
         return [rowSpacing, colSpacing, containerBox];


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