From 99378b6dae61bb54ad9aae121fce0ee2f7cd62f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 22 Feb 2021 12:50:29 +0100 Subject: [PATCH] workspace: Scale down wallpaper by a fixed number of pixels To ensure the workspace thumbnails are vertically closer to the window picker than to the search, scale down the wallpapers by a fixed number of pixels. Using 24 px for this means we'll take of 12 px at the top and 12 px at the bottom of the wallpaper, that's a better strategy than always scaling it by a fixed factor since it doesn't change with the monitor size. Part-of: --- js/ui/workspace.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index ee33f302a..fbbbef2b3 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -24,7 +24,7 @@ var LAYOUT_SCALE_WEIGHT = 1; var LAYOUT_SPACE_WEIGHT = 0.1; const BACKGROUND_CORNER_RADIUS_PIXELS = 30; -const BACKGROUND_SCALE = 0.94; +const BACKGROUND_MARGIN = 12; // Window Thumbnail Layout Algorithm // ================================= @@ -938,13 +938,16 @@ class WorkspaceBackground extends St.Widget { } vfunc_allocate(box) { - const scaledBox = box.copy(); - scaledBox.scale(BACKGROUND_SCALE); + const [width, height] = box.get_size(); + const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const scaledHeight = height - (BACKGROUND_MARGIN * 2 * scaleFactor); + const scaledWidth = (scaledHeight / height) * width; - const [scaledWidth, scaledHeight] = scaledBox.get_size(); + const scaledBox = box.copy(); scaledBox.set_origin( - box.x1 + (box.get_width() - scaledWidth) / 2, - box.y1 + (box.get_height() - scaledHeight) / 2); + box.x1 + (width - scaledWidth) / 2, + box.y1 + (height - scaledHeight) / 2); + scaledBox.set_size(scaledWidth, scaledHeight); const progress = this._stateAdjustment.value;