dashSpacer: Don't trigger allocations from size negotiations
If an actor's allocation is outdated, clutter_actor_get_allocation_box() will queue a relayout. That's why it's advised to not use the function unless the allocation is known to be valid (namely during paint), but in particular not from within get_preferred_width/height vfuncs. Using the :allocation property (which may be outdated) would be better, but in this case we can simply delegate the request to the correct actor. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1065
This commit is contained in:
parent
ed999ce926
commit
d5ebd8c816
@ -369,17 +369,15 @@ class DashSpacer extends St.Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_width(forHeight) {
|
vfunc_get_preferred_width(forHeight) {
|
||||||
let box = this.get_allocation_box();
|
if (this._bindConstraint)
|
||||||
let minWidth = super.vfunc_get_preferred_width(forHeight)[0];
|
return this._bindConstraint.source.get_preferred_width(forHeight);
|
||||||
let natWidth = box.x2 - box.x1;
|
return super.vfunc_get_preferred_width(forHeight);
|
||||||
return [minWidth, natWidth];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_height(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
let box = this.get_allocation_box();
|
if (this._bindConstraint)
|
||||||
let minHeight = super.vfunc_get_preferred_height(forWidth)[0];
|
return this._bindConstraint.source.get_preferred_height(forWidth);
|
||||||
let natHeight = box.y2 - box.y1;
|
return super.vfunc_get_preferred_height(forWidth);
|
||||||
return [minHeight, natHeight];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user