windowPreview: Ensure style as soon as preview is realized
For the windowPreview we need to ensure the style information of the border and title is up-to-date when chromeWidths() or chromeHeights() is called. Since the introduction of the WorkspaceLayout those functions may be called during an allocation cycle, which means we should avoid calling queuing relayouts inside them. Calling StWidgets ensure_style() method will queue a relayout though in case the newly generated theme node has a different geometry. So avoid queueing a relayout during allocation cycles (and the warning Clutter logs because of that) by ensuring the style of the border and title earlier, as soon as the WindowPreview is attached to a stage. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1305
This commit is contained in:
parent
6757c7d20a
commit
c26860dcb7
@ -347,6 +347,14 @@ var WindowPreview = GObject.registerClass({
|
||||
this.add_child(this._border);
|
||||
this.add_child(this._title);
|
||||
this.add_child(this._closeButton);
|
||||
|
||||
this.connect('notify::realized', () => {
|
||||
if (!this.realized)
|
||||
return;
|
||||
|
||||
this._border.ensure_style();
|
||||
this._title.ensure_style();
|
||||
});
|
||||
}
|
||||
|
||||
vfunc_get_preferred_width(forHeight) {
|
||||
@ -401,8 +409,6 @@ var WindowPreview = GObject.registerClass({
|
||||
}
|
||||
|
||||
chromeHeights() {
|
||||
this._border.ensure_style();
|
||||
this._title.ensure_style();
|
||||
const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
|
||||
const [, titleHeight] = this._title.get_preferred_height(-1);
|
||||
|
||||
@ -415,7 +421,6 @@ var WindowPreview = GObject.registerClass({
|
||||
}
|
||||
|
||||
chromeWidths() {
|
||||
this._border.ensure_style();
|
||||
const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
|
||||
|
||||
const leftOversize = this._closeButtonSide === St.Side.LEFT
|
||||
|
Loading…
Reference in New Issue
Block a user