From 85ecd1864f1c416a5001e105be5da53dc46a8e9a Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 9 Feb 2011 19:07:27 -0500 Subject: [PATCH] Use a fixed width for visible portion of workspace thumbnails We will change the workspace thumbnail size as we get more thumbnails; it doesn't really make sense to always show 1/5 of the thumbnails how big or small they are, so instead show a CSS-configurable length. https://bugzilla.gnome.org/show_bug.cgi?id=641879 --- data/theme/gnome-shell.css | 1 + js/ui/workspacesView.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index b144d18e2..dbbf95df4 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -268,6 +268,7 @@ StTooltip StLabel { border-right: 0px; border-radius: 9px 0px 0px 9px; background: #071524; + visible-width: 32px; /* Amount visible before hovering */ } .workspace-thumbnails { diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 691ef67a4..930383e51 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -22,7 +22,6 @@ const WORKSPACE_SWITCH_TIME = 0.25; const MAX_WORKSPACES = 16; -const CONTROLS_POP_IN_FRACTION = 0.8; const CONTROLS_POP_IN_TIME = 0.1; @@ -640,9 +639,9 @@ WorkspacesDisplay.prototype = { let totalHeight = totalAllocation.y2 - totalAllocation.y1; let [controlsMin, controlsNatural] = this._controls.get_preferred_width(totalHeight); - let controlsReserved = controlsNatural * (1 - CONTROLS_POP_IN_FRACTION); + let controlsVisible = this._controls.get_theme_node().get_length('visible-width'); - totalWidth -= controlsReserved; + totalWidth -= controlsVisible; // Workspaces expect to have the same ratio as the screen, so take // this into account when fitting the workspace into the available space @@ -663,9 +662,9 @@ WorkspacesDisplay.prototype = { y = Math.floor(y + Math.abs(totalHeight - height) / 2); if (rtl) - x += controlsReserved; + x += controlsVisible; - let zoomScale = (totalWidth - (controlsNatural - controlsReserved)) / totalWidth; + let zoomScale = (totalWidth - (controlsNatural - controlsVisible)) / totalWidth; let newView = new WorkspacesView(width, height, x, y, zoomScale, this._workspaces); if (this.workspacesView) @@ -765,7 +764,8 @@ WorkspacesDisplay.prototype = { let [controlsMin, controlsNatural] = this._controls.get_preferred_width(box.y2 - box.y1); // Amount of space on the screen we reserve for the visible control - let controlsReserved = controlsNatural * (1 - (1 - this._zoomFraction) * CONTROLS_POP_IN_FRACTION); + let controlsVisible = this._controls.get_theme_node().get_length('visible-width'); + let controlsReserved = controlsVisible * (1 - this._zoomFraction) + controlsNatural * this._zoomFraction; let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL); if (rtl) {