WindowOverlay: fix title sizing
After the first time the title was placed, we were setting its width, thus forcing get_preferred_width() to return that as the minimum and natural width. To workaround that, explicitly reset the width to -1, -1, causing StLabel->get_preferred_width() to be called, which would give us a meaningful value for minimum and natural width. https://bugzilla.gnome.org/show_bug.cgi?id=688234
This commit is contained in:
parent
c66068c435
commit
944762ac83
@ -557,8 +557,16 @@ const WindowOverlay = new Lang.Class({
|
||||
else
|
||||
button.set_position(Math.floor(buttonX), Math.floor(buttonY));
|
||||
|
||||
// Clutter.Actor.get_preferred_width() will return the fixed width if one
|
||||
// is set, so we need to reset the width by calling set_width(-1), to forward
|
||||
// the call down to StLabel.
|
||||
// We also need to save and restore the current width, otherwise the animation
|
||||
// starts from the wrong point.
|
||||
let prevTitleWidth = title.width;
|
||||
title.set_width(-1);
|
||||
let [titleMinWidth, titleNatWidth] = title.get_preferred_width(-1);
|
||||
let titleWidth = Math.max(titleMinWidth, Math.min(titleNatWidth, cloneWidth));
|
||||
title.width = prevTitleWidth;
|
||||
|
||||
let titleX = cloneX + (cloneWidth - titleWidth) / 2;
|
||||
let titleY = cloneY + cloneHeight + title._spacing;
|
||||
|
Loading…
Reference in New Issue
Block a user