[gnome-shell] panel: Only update appMenu icon when the app actually changed
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] panel: Only update appMenu icon when the app actually changed
- Date: Tue, 9 Mar 2021 13:19:10 +0000 (UTC)
commit 5de9166f7a2c0bc8e3347492bb33dac894bb0323
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Mar 1 10:07:27 2021 +0100
panel: Only update appMenu icon when the app actually changed
Right now we always recreate the icon of the appMenu when calling
_sync(). This will relayout the panel everytime we open the overview,
because we call _sync() in that case.
We can easily avoid that by only recreating the icon actor in case the
app that's opened actually changes. This gets us close to doing no more
relayouts of the panel when opening the overview.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1733>
js/ui/panel.js | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 8ca5d038d0..cba32416a2 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -244,11 +244,8 @@ var AppMenuButton = GObject.registerClass({
});
}
- _syncIcon() {
- if (!this._targetApp)
- return;
-
- let icon = this._targetApp.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
+ _syncIcon(app) {
+ const icon = app.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
this._iconBox.set_child(icon);
}
@@ -256,7 +253,8 @@ var AppMenuButton = GObject.registerClass({
if (this._iconBox.child == null)
return;
- this._syncIcon();
+ if (this._targetApp)
+ this._syncIcon(this._targetApp);
}
stopAnimation() {
@@ -324,6 +322,8 @@ var AppMenuButton = GObject.registerClass({
this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
this._label.set_text(this._targetApp.get_name());
this.set_accessible_name(this._targetApp.get_name());
+
+ this._syncIcon(this._targetApp);
}
}
@@ -343,7 +343,6 @@ var AppMenuButton = GObject.registerClass({
this.reactive = visible && !isBusy;
- this._syncIcon();
this.menu.setApp(this._targetApp);
this.emit('changed');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]