From 9720b3298797682900965f3b5963aef324c2320d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 3 Oct 2015 23:44:48 +0200 Subject: [PATCH] dash: Revert mislead cleanup When adjusting dash icon sizes, we compute the icon padding by subtracting the configured icon size from the first icon actor's preferred size. To make sure that the preferred size correctly corresponds to the current dash icon size even while the icon is animating, we enforce the size before the size request. For that we used to temporarily manipulate the icon texture size directly, but commit e92d204d425 cleaned this up to use the setIconSize() method instead. This does not work however, as the icon actor's iconSize property will always match the dash iconSize property, making the method a noop. So go back to the original approach of enforcing the texture size to make sure we always base our computations on correct values. https://bugzilla.gnome.org/show_bug.cgi?id=745649 --- js/ui/dash.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/ui/dash.js b/js/ui/dash.js index 246bc108b..e809f87ab 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -644,15 +644,13 @@ const Dash = new Lang.Class({ let firstIcon = firstButton._delegate.icon; let minHeight, natHeight; + let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; // Enforce the current icon size during the size request - firstIcon.setIconSize(this.iconSize); + let [currentWidth, currentHeight] = firstIcon.icon.get_size(); + firstIcon.icon.set_size(this.iconSize * scaleFactor, this.iconSize * scaleFactor); [minHeight, natHeight] = firstButton.get_preferred_height(-1); - - let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; - let iconSizes = baseIconSizes.map(function(s) { - return s * scaleFactor; - }); + firstIcon.icon.set_size(currentWidth, currentHeight); // Subtract icon padding and box spacing from the available height availHeight -= iconChildren.length * (natHeight - this.iconSize * scaleFactor) + @@ -660,6 +658,10 @@ const Dash = new Lang.Class({ let availSize = availHeight / iconChildren.length; + let iconSizes = baseIconSizes.map(function(s) { + return s * scaleFactor; + }); + let newIconSize = baseIconSizes[0]; for (let i = 0; i < iconSizes.length; i++) { if (iconSizes[i] < availSize)