altTab: Only calculate iconSize once

Right now, _setIconSize() calculates the icon size everytime the
preferred height of AppSwitcher is calculated, which happens quite
often.

Reduce the perfomance impact by only calculating the icon size once.
This has the added benefit of preventing unexpected changes to the icon
sizes while the switcher is open.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2098>
This commit is contained in:
Jonas Dreßler 2018-04-26 01:36:41 +02:00 committed by Marge Bot
parent 7f65fa49db
commit c8f3db31b8

View File

@ -765,7 +765,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
} }
vfunc_get_preferred_height(forWidth) { vfunc_get_preferred_height(forWidth) {
if (!this._iconSize)
this._setIconSize(); this._setIconSize();
return super.vfunc_get_preferred_height(forWidth); return super.vfunc_get_preferred_height(forWidth);
} }