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>
This commit is contained in:
parent
e6c1db2bc8
commit
5de9166f7a
@ -244,11 +244,8 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_syncIcon() {
|
_syncIcon(app) {
|
||||||
if (!this._targetApp)
|
const icon = app.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
|
||||||
return;
|
|
||||||
|
|
||||||
let icon = this._targetApp.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
|
|
||||||
this._iconBox.set_child(icon);
|
this._iconBox.set_child(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +253,8 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
if (this._iconBox.child == null)
|
if (this._iconBox.child == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._syncIcon();
|
if (this._targetApp)
|
||||||
|
this._syncIcon(this._targetApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
stopAnimation() {
|
stopAnimation() {
|
||||||
@ -324,6 +322,8 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
|
this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
|
||||||
this._label.set_text(this._targetApp.get_name());
|
this._label.set_text(this._targetApp.get_name());
|
||||||
this.set_accessible_name(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.reactive = visible && !isBusy;
|
||||||
|
|
||||||
this._syncIcon();
|
|
||||||
this.menu.setApp(this._targetApp);
|
this.menu.setApp(this._targetApp);
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user