Dock Case: PopUp placement
Introduction
As of Plasma 5.21 the applets layout strategy for plasma panels has changed.
In the past, applets received all the panel available space(thickness) and as such were responsible, from implementation point of view, to provide proper padding and margins. It is obvious of course that this strategy did not succeed from HIG point of view and as such a newer and better is now implemented.
The new strategy is that padding and margins for all applets in a panel is provided from its containment. As is the case, Applets can now request only specific roles through https://invent.kde.org/frameworks/plasma-framework/-/blob/master/src/plasma/plasma.h#L58 in order to be provided relevant padding and margins around them.
The main approach is that panel containment view is providing to applets the exact visual space that applet should have and all input/events that occur inside padding are sunk - adjusted into applet visual geometry.
The Issue
If Docks (in general and Latte also) decide to follow the new strategy then they are in a desperate need for a solution about their applet popup placement.
Current implementation of popup placement found at: https://invent.kde.org/frameworks/plasma-framework/-/blob/master/src/plasmaquick/dialog.cpp#L961 proposes the following:
- If the parent window does not provide any mask() then popups are positioned by taking into account their parent window geometry [this is the plasma panels case]
- If the parent window provides mask() then popups are positioned based on their parent QQuickItem and can be placed inside the window geometry [If I remember correctly I had introduced that workaround when Latte first appeared]
Let's see the problem, the following screenshot demonstrates a dock in which yellow rectangles indicate the visual space given to applets and immerse padding has been set in order to demonstrate the area from which input events are sunk into applets. Analog clock is going to be our performer, this is how it looks before triggering its popup:
and this is how it looks after triggering its popup:
In second screenshot, popup window is placed at the exact top edge of analog clock as expected though [2] implementation.
But the best result would be the following:
So the popup needs to take into account a dock internal minimum geometry in order to be placed correctly.
The Solution?
A. GTK_FRAME_EXTENTS margins are retrieved and are used in order to discover the dock internal visual geometry, but I dont know if this is possible under wayland world.
B. Plasma::Containment can be enhanced to provide a VisualGeometry (QRect) that will be automatically retrieved from Plasma PopUps and be taken into account for their placement. The VisualGeometry will be optional and if it is not provided then the previous [1,2] solutions are used.
C.?