From 9152d6613b9fbcf56d1ae0cf727c8752c98e193a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 9 Mar 2021 18:12:02 +0100 Subject: [PATCH] workspacesView: Store some variables outside the children-allocate loop We've seen this to help quite a bit with performance previously, so also do it here. Part-of: --- js/ui/workspacesView.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 757b5c318..1af45d88d 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -367,6 +367,11 @@ class WorkspacesView extends WorkspacesViewBase { if (rtl) workspaces.reverse(); + const [fitSingleX1, fitSingleY1] = fitSingleBox.get_origin(); + const [fitSingleWidth, fitSingleHeight] = fitSingleBox.get_size(); + const [fitAllX1, fitAllY1] = fitAllBox.get_origin(); + const [fitAllWidth, fitAllHeight] = fitAllBox.get_size(); + workspaces.forEach(child => { if (fitMode === FitMode.SINGLE) box = fitSingleBox; @@ -379,18 +384,18 @@ class WorkspacesView extends WorkspacesViewBase { if (vertical) { fitSingleBox.set_origin( - fitSingleBox.x1, - fitSingleBox.y1 + fitSingleBox.get_height() + fitSingleSpacing); + fitSingleX1, + fitSingleBox.y1 + fitSingleHeight + fitSingleSpacing); fitAllBox.set_origin( - fitAllBox.x1, - fitAllBox.y1 + fitAllBox.get_height() + fitAllSpacing); + fitAllX1, + fitAllBox.y1 + fitAllHeight + fitAllSpacing); } else { fitSingleBox.set_origin( - fitSingleBox.x1 + fitSingleBox.get_width() + fitSingleSpacing, - fitSingleBox.y1); + fitSingleBox.x1 + fitSingleWidth + fitSingleSpacing, + fitSingleY1); fitAllBox.set_origin( - fitAllBox.x1 + fitAllBox.get_width() + fitAllSpacing, - fitAllBox.y1); + fitAllBox.x1 + fitAllWidth + fitAllSpacing, + fitAllY1); } }); }