make sure the vertical systary size hints are fixed
ClosedPublic

Authored by mart on Sep 3 2016, 9:05 AM.

Details

Summary

on vertical panels the systray could get
stretched to a size taller than it should, getting
a lot of empty space
BUG:368146

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart updated this revision to Diff 6408.Sep 3 2016, 9:05 AM
mart retitled this revision from to make sure the vertical systary size hints are fixed.
mart updated this object.
mart edited the test plan for this revision. (Show Details)
Restricted Application added a project: Plasma. · View Herald TranscriptSep 3 2016, 9:05 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart added a reviewer: Plasma.Sep 3 2016, 9:05 AM

Why is it needed?

the panel containment is a layout - the system tray's current only size hint is minimum and it doesn't have a Layout.fillHeight - which means any other item which does have a fillHeight: true will force this system tray to it's minimum size. Effectively what this patch is doing.

if no item with fillHeight exists, the panel will create a spacer (panel.qml checkLastSpacer) with Layout.fillHeight=true
so we can always be sure (in theory) that something in that layout does have that.

mart added a comment.Sep 4 2016, 9:28 AM

Why is it needed?

the panel containment is a layout - the system tray's current only size hint is minimum and it doesn't have a Layout.fillHeight - which means any other item which does have a fillHeight: true will force this system tray to it's minimum size. Effectively what this patch is doing.

if no item with fillHeight exists, the panel will create a spacer (panel.qml checkLastSpacer) with Layout.fillHeight=true
so we can always be sure (in theory) that something in that layout does have that.

unfortunately seems to be needed in vertical panels.
the taskbar should have fillHeight, and indeed scales correctly, without setting the maximum height, the systray gets stretched as well (i can reproduce the screenshot attached to https://bugs.kde.org/show_bug.cgi?id=368146) can you try locally if it reproduces for you?

it tries to stretch the systray a bit (not huge, just a tad too much) never the less, hmm maybe preferredwidth defaults to too much?

Yes I can reproduce the bug. And I even downloaded this and confirm that then i can't reproduce it.

But that doesn't answer my question.

mart added a comment.Sep 4 2016, 10:06 AM

Yes I can reproduce the bug. And I even downloaded this and confirm that then i can't reproduce it.

But that doesn't answer my question.

the hints of the applet seems sane.
minimumHeight is the proper size (114 px in my case) preferredHeight -1 (that should be ok) and maximumHeight infinity (that should be ok)
but i guess as most applets have both min and max defined, the layout decides to stretch this one, as it's allowed (since maximum height it's infonite)
i'm surprised that the only one that gets stretched isn't the taskbar as is the on.y one to be explicitly fillHeight

davidedmundson accepted this revision.Sep 4 2016, 10:24 AM
davidedmundson added a reviewer: davidedmundson.

You don't need to guess, the code is open source...

Here is the reason.

panel/main.qml

the container has:

Layout.preferredHeight: (!currentLayout.isLayoutHorizontal ? (applet && applet.Layout.preferredHeight > 0 ? applet.Layout.preferredHeight : root.width) : root.height)

This means that even though the system tray has no preferredHeight, the container, which is what the layout sees does. The layout will fit an item to fit it's preferred height before it will let another item fill height.

basically making all trays square if they don't specify anything else.

Put that in the commit message and use you can ship this; though setting the preferredHeight is probably more correct.

This revision is now accepted and ready to land.Sep 4 2016, 10:24 AM
This revision was automatically updated to reflect the committed changes.