[SystemTray] Fix item size for very narrow panel
ClosedPublic

Authored by kmaterka on Mar 9 2020, 9:17 PM.

Details

Summary

For very narrow panel item size is too big (item + padding exceed panel size). This adds a check to not exceed panel size.
Before:


After:

Test Plan
  • Make panel very narrow - icons should fit into panel
  • Repeat for vertical/horizontal

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.
kmaterka requested review of this revision.Mar 9 2020, 9:17 PM
kmaterka created this revision.
kmaterka edited the summary of this revision. (Show Details)Mar 9 2020, 9:21 PM

I don't like how icon size and item size (container = icon + padding) are calculated and used... Firstly best icons size is calculated, but then padding are added. This combined size is used as item size (container size):

  • SNI icons are rounded to nearest icon size (implicitly, because PlasmaCore.IconItem is used)
  • Plasmoids are scaled to the size of the container, I don't know exactly how it work, probably because default compact representation is just an icon.

By happy coincident it is (?) working correctly for all sizes.

There is also a lot of anchoring involved, all items are aligned to left (which looks bad with expander arrow, gap is bigger) etc. But all of this can be fixed in separate patch.

Not sure if it is just me but the vertical alignment looks slightly off


Or maybe that's the random different sizes

ngraham added a comment.EditedMar 10 2020, 4:46 PM

LGTM

ngraham accepted this revision.Mar 10 2020, 4:47 PM
This revision is now accepted and ready to land.Mar 10 2020, 4:47 PM

Not sure if it is just me but the vertical alignment looks slightly off


Or maybe that's the random different sizes

This is just an illusion. I checked and literally counted pixels, centers of icons are aligned (both horizonaly and vertically). "de" icon is visually "heavier" at the bottom, the arrow on the right is heavier on top which makes impresion that these two are not aligned.

This revision was automatically updated to reflect the committed changes.

After a few days of living with it, I've found that this patch causes the following issue with semi-random tray items getting smaller when a pop-up is opened:

Could you investigate?

After a few days of living with it, I've found that this patch causes the following issue with semi-random tray items getting smaller when a pop-up is opened:

Could you investigate?

Yes, I will take a look at this.