From 7d40930cd687823c3bf054b6824d5f47b9b7f607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 8 Feb 2021 19:02:23 +0100 Subject: [PATCH] windowPreview: Scale up by the same extra size for every window Scaling differently sized WindowPreviews by a constant factor will result in smaller windows getting enlarged by a smaller amount of pixels than larger windows (1000*1.02=1020 but 100*1.02=102, one will grow by 20 pixels and the other one by 2), this can look a bit weird because smaller windows don't scale up as much as larger windows. So introduce a constant extra size to use when scaling windows up, we set only the half size there because we want to ensure that the size added on both sides is not fractional and we remain aligned to the pixel grid. Part-of: --- js/ui/windowPreview.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/ui/windowPreview.js b/js/ui/windowPreview.js index f4a65b620..252778948 100644 --- a/js/ui/windowPreview.js +++ b/js/ui/windowPreview.js @@ -13,7 +13,7 @@ var WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 750; var WINDOW_OVERLAY_FADE_TIME = 200; var WINDOW_SCALE_TIME = 200; -var WINDOW_ACTIVE_SCALE = 1.02; +var WINDOW_ACTIVE_SIZE_INC = 5; // in each direction var DRAGGING_WINDOW_OPACITY = 100; @@ -518,9 +518,14 @@ var WindowPreview = GObject.registerClass({ }); }); + const { width } = this._windowContainer; + const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const activeExtraSize = WINDOW_ACTIVE_SIZE_INC * 2 * scaleFactor; + const scale = (width + activeExtraSize) / width; + this._windowContainer.ease({ - scale_x: WINDOW_ACTIVE_SCALE, - scale_y: WINDOW_ACTIVE_SCALE, + scale_x: scale, + scale_y: scale, duration: animate ? WINDOW_SCALE_TIME : 0, mode: Clutter.AnimationMode.EASE_OUT_QUAD, });