Floating panels and docks
Closed, InvalidPublic

Description

I am trying to implement floating panels. This is their appearance before implementing shadows on all borders:

niccolove created this task.Mar 9 2019, 9:14 AM
niccolove triaged this task as Low priority.

By floating what do you mean?

  1. the background has just a visual margin with the near edge ? (meaning that everything else works as usual, mouse interactions with the near edge etc.)
  2. The entire Dock was a real margin with the near edge? (meaning that mouse interactions with the near edge do not work etc) example: the user approaches the edge with a mouse BUT the autohidden dock is not shown

The dock has a real margin, meaning that interactions (/mouse clicks and hovers) made between the panel and the screen border are not be managed by latte, and an auto-hide panel will disappear if mouse is there. Approaching the edge with the mouse will show the autohidden dock anyway. Example:

My problem right now is drawing shadows on all borders if panel is floating. I tried using Plasma::FrameSvg::AllBorders instead of the borders that is created in app/view/effects.cpp:317, and that does indeed show all shadows, but the borders of the panel also move, without the content:

When shadows are turned off, the borders return to their normal positions:

The borders still moves if I remove all the code I added to make the panel floating; but adding and removing shadows normally does not move borders.

the approach is not correct...

By real margin I mean that the dock window will not touch at the edge.
What you want is just a visual margin(from user point of view), from technical point of view the window will need to touch the screen edge..

To test how the dock window looks really you can use:

latte-dock -d --graphics
mvourlakos added a comment.EditedMar 9 2019, 6:43 PM

So let me describe you what is needed, take note of course that any patch for this will be accepted BUT the settings in order for someone to set this will be available only from layout text file.

Technical information: Latte is supporting two modes for its Views (Docks/Panel). Each Latte::View can behave either as a Plasma Panel or as Dock.

Plasma Panels
Plasma panels are drawing their shadows externally and that means that are dependent to the window size. Whatever the window area around that area the shadows will be drawn and have the benefit that these shadows DO NOT accept any mouch/touch input etc. In the code you can see references for this as latteView.type === Latte.Types.PanelView OR root.behaveAsPlasmaPanel

Docks
Docks in contrast of Plasma panels are drawing their backgrounds and shadows INSIDE the window area. This is handled totally only from QML side in the containment qml code. This is the default case so it isnt mentioned explicitly, whatever is NOT a PlasmaPanel is a Dock.

So for this feature we are speaking only for Docks from technical point view. Of course the user could be able to make them look like as a plasma panels but they wouldnt be panels but Docks.

For this feature the following are needed:

  1. You need a new setting for the containment which can be called edgeMargin and would be a percentage of 0% - 100% of iconSize set by the user for that Dock. file: https://phabricator.kde.org/source/latte-dock/browse/master/containment/package/contents/config/main.xml
  2. The previous mentioned option should be available both for applets and tasks in the plasmoid. You can see how this is handled for other options at: https://phabricator.kde.org/source/latte-dock/browse/master/containment/package/contents/ui/main.qml AND https://phabricator.kde.org/source/latte-dock/browse/master/plasmoid/package/contents/ui/main.qml
  3. That option should be used in order to add a margin below all Applets and Tasks at: https://phabricator.kde.org/source/latte-dock/browse/master/containment/package/contents/ui/applet/ AND https://phabricator.kde.org/source/latte-dock/browse/master/plasmoid/package/contents/ui/task/
  4. The background for which you are interested in and you can adjust its borders when that margin is set and how is going to be its edgeMargin can be found at: https://phabricator.kde.org/source/latte-dock/browse/master/containment/package/contents/ui/PanelBox.qml
  5. All the above should provide new metrics in order to calculate properly the new mask that the dock window should use... So all thickness metrics should be adjusted accordingly at: https://phabricator.kde.org/source/latte-dock/browse/master/containment/package/contents/ui/VisibilityManager.qml

Of course nothing should break when merging [1]-[5]. I could help with reviewing [1]-[5]
You could use a specific branch for this and we could merge [1]-[5] all together only when the feature is concrete and does not break any current behavior

Thank you so much for the detailed answer. I was able to do [1,2,4,5].
Unfortunately, I do not understand how to add margin in elements in [3]. I tried to use anchor-based margin, but I see that in some files anchor is not used at all, and where it is used, the margin won't affect the appareance at all. I'm sorry to disturb you again, but may I ask you what the correct approach would be here?

A proper margin for [3] can be added at somewhere in the structure of AppletItem and its children for containmnet and TaskItem and its children for the plasmoid...

Any such approach will have some issues concerning in the v0.8 branch there is such margin placed in order to draw the LatteIndicator... So if you understand how this was accomplished in v0.8 could you use the same approach...

in v0.8 that margin was called

root.statesLineSize
niccolove closed this task as Invalid.Jan 13 2020, 9:39 PM