grouped-window-list: fix four panel button layout bugs - #13959
Open
ChrisB85 wants to merge 4 commits into
Open
Conversation
allocate() set childBox.x2 = box.x2, so the label ended flush with the button edge and an ellipsized title touched the border. On a horizontal panel there is no slack there, because setIconPadding() zeroes the actor padding. Reserve the same 6 px that getPreferredWidth() already adds to natural_size, mirrored for RTL.
showLabel() bailed out on !this.label.realized, and a hidden label (hideLabel() calls label.hide()) is exactly that. A pinned app with no windows was therefore stuck at labelVisiblePref=false: opening a window set the text but the button kept its icon-only width and showed no title. Drop realized from the early return and skip the animation for an unrealized label instead.
The allocateForLabel branch counted labelNaturalSize even with no windows open. An empty label has a non-zero, state-dependent width (1 px or 5 px), so two pinned apps without windows ended up 30 px and 29 px wide. With no window there is nothing to label, so such a button now takes the same path as with labels turned off. That path also uses the panel icon size rather than the icon actor's natural width, which depends on the artwork a given app ships.
allocate() only calls label.allocate() when drawLabel is true. Clutter keeps the previous allocation of an actor that is skipped during a layout pass and still paints it, so a button that loses its last window - and with it the room for a title - leaves the old, wide label box in place. The text then spills out of the button and over its neighbours. Allocate a collapsed box in the else branch instead of skipping the label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four independent layout fixes for the
grouped-window-listapplet, all inappGroup.js. Each one was found on a horizontal panel (Cinnamon 6.6.4,global.ui_scale = 1) and verified live by reading back actor and label allocations.1. Keep a gap between the label and the button edge
getPreferredWidth()reservesiconNaturalSize + labelNaturalSize + 6, butallocate()used to stretch the label all the way tobox.x2. The 6 px were silently swallowed, so a truncated title had its ellipsis flush against the button border. The label box now stops6 pxshort on the trailing side (mirrored for RTL).2. Show the title when a pinned app opens a window
showLabel()bailed out on!this.label.realized. For a pinned app with no windows that is the normal state —hideLabel()hides the label, and a hidden actor is never realized. Opening a window from such a button therefore produced a button with an icon and no title until something else forced a refresh. The unrealized case now skips the width animation instead of skipping the whole method.3. Equal width for buttons without a label
allocate()only draws the label whenmetaWindows.length > 0, butgetPreferredWidth()countedlabelNaturalSizeregardless. An empty label reports 1 px or 5 px depending on whether it went throughhideLabel()or an interruptedshowLabel()ease, so two pinned apps with no windows ended up different widths, and the width changed as other buttons were pinned or unpinned.The label size is now excluded when there is no window to label, and the icon-only width is derived from
this.iconSize(the panel icon size) rather than the icon actor's natural width — icon files whose artwork does not fill the requested box otherwise made their button narrower than its neighbours.4. Stop painting the label after the button shrinks
allocate()calledthis.label.allocate()only insideif (this.drawLabel). Clutter keeps the previous allocation of an actor that is skipped during a layout pass and still paints it. A button that lost its last window shrank to icon size,drawLabelbecame false, and the old wide label box stayed behind — the stale title was painted outside the button and over its neighbours.Measured before the fix, on a button that had shrunk to 30 px:
and after:
The
elsebranch now allocates a collapsed box instead of leaving the label unallocated.