workspace: Avoid setting overlay title width

Avoid setting the width of the overlay title ourselves to keep the
default width of -1, this way StLabel will change its width by itself as
soon as the text is updated.

The width only needs to be changed if the window title changes, and we
don't animate it in this case anyway so there's no need to pass a width
to _animateOverlayActor().

Setting the title width to the preferred width on relayout is impossible
because get_preferred_width() will always return the width we set the
label to before. If the width is not set to -1, there's no way to get
the new preferred width without calculating it ourselves from the
underlying ClutterText instance.

https://bugzilla.gnome.org/show_bug.cgi?id=787260
This commit is contained in:
verdre 2018-06-29 19:53:31 +02:00 committed by Florian Müllner
parent b72b773d87
commit c04289853f

View File

@ -545,12 +545,10 @@ var WindowOverlay = new Lang.Class({
let titleX = cloneX + (cloneWidth - title.width) / 2;
let titleY = cloneY + cloneHeight - (title.height - this.borderSize) / 2;
if (animate) {
this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), title.width);
} else {
title.width = title.width;
if (animate)
this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY));
else
title.set_position(Math.floor(titleX), Math.floor(titleY));
}
let borderX = cloneX - this.borderSize;
let borderY = cloneY - this.borderSize;
@ -573,6 +571,9 @@ var WindowOverlay = new Lang.Class({
time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad' };
if (width !== undefined)
params.width = width;
if (height !== undefined)
params.height = height;