[SystemTray] Set maximum size to block tiling
ClosedPublic

Authored by kmaterka on Jan 9 2020, 3:05 PM.

Details

Summary

System tray dialog/popup can be tiled. This should not be allowed, in this case expanded representaiton should have fixed size. When tiled, it is no longer possible to restore original size.
This also applies to other plasmoids.

BUG: 386551
FIXED-IN: 5.18.0

Test Plan
  1. Open any applet from system tray (for example Clipboard or hidden items)
  2. Use shortcut to tile window (by default Meta + Left/Righ/...)
  3. Applet will change size and tile at the borded of the screen
  4. Expected:

a) before fix: allowed and not possible to restore size
b) after fix: not allowed or restores size on next open

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.Jan 9 2020, 3:05 PM
kmaterka created this revision.

There must be a better way to fix that. Layout.minimum = Layout.maximum has nice side affect that does what I want, but maybe better place is to change some (?) window flags in PlasmaCode.Dialog?

applets/digital-clock/package/contents/ui/CalendarView.qml
36–37

As maximum != minimum in this case, popup can be resized (and tiled), but on next show size is restored

applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
35–37

Removing 1.5 is fine, probably this is a left over. It was something like this (git history):

Layout.minimumHeight: units.gridUnit * 14
Layout.preferredHeight: Layout.minimumHeight * 1.5
36–37

when Layout.maximumWidth/Heigh = Layout.minimumWidth/Heigh window is not re-sizable and not movable

ngraham added a subscriber: ngraham.Jan 9 2020, 3:27 PM

FWIW it is possible to restore the original size by using the same tiling shortcut again.

Still a bug that should be fixed of course, and this is the way that Kicker and Kickoff and others prevent tiling. For now, it seems sane enough to do the same thing here too. BTW, the change for the clock applet doesn't work for me; maybe that should be left out of the patch for now?

I agree that in the long term, it might make sense to do this prevent tiling using a more elegant method so we don't need to implement his hack in every applet with an expanded representation.

FWIW it is possible to restore the original size by using the same tiling shortcut again.

Oh, I tested this on multi-screen setup, but it is working indeed if:

  • I use shortcut few more times to iterate all screens
  • I did not click to hide popup. If it is hidden, it won't restore.

Still a bug that should be fixed of course, and this is the way that Kicker and Kickoff and others prevent tiling. For now, it seems sane enough to do the same thing here too. BTW, the change for the clock applet doesn't work for me; maybe that should be left out of the patch for now?

It is not blocking tiling for digital clock because minimum size != preferred size for whatever reasons. As result, it is not possible to set maximum size equal to minimum size. But this change helps, because on next show (if you hide calendar and click again) it should show with correct size.

I agree that in the long term, it might make sense to do this prevent tiling using a more elegant method so we don't need to implement his hack in every applet with an expanded representation.

That was my point - I'm sure it is possible somehow, Qt (?) is doing this automatically when maximum size = minimum size.

For System Tray, setting the maximum size for ExpandedRepresentation is a good idea, but some plasmoids can't be fixed this way. For example: Clipboard. Usually it is part of the system tray, but:

  • it can be added on the desktop. Full representation is the default, so we can't set maximum size, users can set any size they want
  • on the panel - compact representation is used (icon), full representation is encapsulated in fixed size PlasmaCore.Dialog. Nothig we can do to prevent tiling.
ngraham accepted this revision.Jan 9 2020, 3:40 PM

Yeah.

This revision is now accepted and ready to land.Jan 9 2020, 3:40 PM
kmaterka retitled this revision from WIP: [SystemTray] Set maximum size to block tiling to [SystemTray] Set maximum size to block tiling.Jan 9 2020, 3:47 PM
This revision was automatically updated to reflect the committed changes.