[gnome-shell] workspaceThumbnails: Center thumbnails in workspace navigator
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspaceThumbnails: Center thumbnails in workspace navigator
- Date: Mon, 1 Feb 2021 18:06:29 +0000 (UTC)
commit de299f0a9069072d4c69d0fa2975e3c3a928068c
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Feb 1 16:28:49 2021 +0100
workspaceThumbnails: Center thumbnails in workspace navigator
We always request a natural width based on the maximum thumbnail scale,
but may very well use a smaller scale when allocating. This currently
results in thumbnails being off center, fix this by distributing any
extra space evenly before allocating thumbnails.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1620>
js/ui/workspaceThumbnail.js | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 73f25593bd..46de36fa47 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1302,6 +1302,13 @@ var ThumbnailsBox = GObject.registerClass({
const thumbnailWidth = Math.round(thumbnailHeight * ratio);
const roundedVScale = thumbnailHeight / portholeHeight;
+ // We always request size for MAX_THUMBNAIL_SCALE, distribute
+ // space evently if we use smaller thumbnails
+ const extraWidth =
+ (MAX_THUMBNAIL_SCALE * portholeWidth - thumbnailWidth) * nWorkspaces;
+ box.x1 += Math.round(extraWidth / 2);
+ box.x2 -= Math.round(extraWidth / 2);
+
let indicatorValue = this._scrollAdjustment.value;
let indicatorUpperWs = Math.ceil(indicatorValue);
let indicatorLowerWs = Math.floor(indicatorValue);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]