Skip to content

grouped-window-list: fix four panel button layout bugs - #13959

Open
ChrisB85 wants to merge 4 commits into
linuxmint:masterfrom
ChrisB85:grouped-window-list-layout-fixes
Open

grouped-window-list: fix four panel button layout bugs#13959
ChrisB85 wants to merge 4 commits into
linuxmint:masterfrom
ChrisB85:grouped-window-list-layout-fixes

Conversation

@ChrisB85

Copy link
Copy Markdown

Four independent layout fixes for the grouped-window-list applet, all in appGroup.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() reserves iconNaturalSize + labelNaturalSize + 6, but allocate() used to stretch the label all the way to box.x2. The 6 px were silently swallowed, so a truncated title had its ellipsis flush against the button border. The label box now stops 6 px short 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 when metaWindows.length > 0, but getPreferredWidth() counted labelNaturalSize regardless. An empty label reports 1 px or 5 px depending on whether it went through hideLabel() or an interrupted showLabel() 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() called this.label.allocate() only inside if (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, drawLabel became 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:

actor=624-654   labelBox=30-150   drawLabel=false   label.visible=true

and after:

actor=624-654   labelBox=0-0      drawLabel=false

The else branch now allocates a collapsed box instead of leaving the label unallocated.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant