From 92d3c6e051958b31151bf9538205a71cab6f70d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Moreno?= Date: Thu, 10 Sep 2020 16:30:15 +0200 Subject: [PATCH] appDisplay: Don't iterate over all pages in page manager In getAppPosition it's not needed to continue looking for an app in the page manager if the app is found in a page. This patch breaks the search loop just after the first ocurrence is found. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1434 --- js/ui/appDisplay.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index cecf6d185..68fdbdd0e 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -851,11 +851,11 @@ var PageManager = GObject.registerClass({ for (let pageIndex = 0; pageIndex < this._pages.length; pageIndex++) { const pageData = this._pages[pageIndex]; - if (!(appId in pageData)) - continue; - - page = pageIndex; - position = pageData[appId].position; + if (appId in pageData) { + page = pageIndex; + position = pageData[appId].position; + break; + } } return [page, position];