Bug 445495

Summary: Desktop Widgets end up below "AlwaysVisible" plasma panels on running but not current activities
Product: [Plasma] plasmashell Reporter: Michail Vourlakos <mvourlakos>
Component: Desktop ContainmentAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: kde, marco, nate, plasma-bugs
Priority: NOR    
Version: 5.23.3   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.90
Sentry Crash Report:

Description Michail Vourlakos 2021-11-14 16:47:03 UTC
SUMMARY
Desktop widgets can end up below plasma panels when they are at desktops of active activities but these activities are not the current one.


STEPS TO REPRODUCE
1. Add an AlwaysVisible plasma panel at top edge
2. Add a Notes widget in the current activity desktop (called [A] from now on) and push it far far at the top screen edge
3. Move to another running Activity (called [B] from now on) and do [2] again
4. While on B activity right click the panel and increase its size, you will notice that Notes applet in B activity is pushed correctly downwards at the correct position
5. Move now on A activity you will notice that Notes applet in A activity ignores totally the panel and is touching totally the screen top edge

OBSERVED RESULT
Notes applet in A Activity is under the plasma panel even though it should not

EXPECTED RESULT
Notes applet in A Activity  should be at the correct position after changing the panel size

ADDITIONAL INFORMATION
Following the code path it is observed that Corona::availableScreenRect is FALSE for Desktop containments that are not the current one. This is happening because when Desktop Containments are calling function

Plasma::ShellCorona::screenForContainment(const Plasma::Containment *containment) const

they get as result screen = -1 . and screen==-1 means that availableScreenRect ignores totally the desktop margins from panels. No idea why that was decided and what is tried to be protected by the checks in the function for:

containment->activity() == m_activityController->currentActivity()

any ideas?
Comment 1 Michail Vourlakos 2021-11-14 18:34:34 UTC
function in question: https://github.com/KDE/plasma-workspace/blob/master/shell/shellcorona.cpp#L1823
Comment 3 Bug Janitor Service 2021-11-19 15:53:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/390
Comment 4 Nate Graham 2021-12-13 16:05:27 UTC
Git commit c3bccdf278f2d9cbf638e864fc478cb72d2d0db5 by Nate Graham, on behalf of Michail Vourlakos.
Committed on 13/12/2021 at 15:58.
Pushed by ngraham into branch 'master'.

fix availableScreenRect for applets/containments

--when an applet or desktop containment is not
in the current activity and requests ::availableScreenRect()
value, Plasma::Corona decides to return as valid screenId: -1.
That behavior can lead to applets going under plasma panels
that have set visibility to AlwaysVisible. Such panels should
always been taken into account when calculating the
available screen geometry.

M  +5    -0    src/scriptengines/qml/plasmoid/appletinterface.cpp

https://invent.kde.org/frameworks/plasma-framework/commit/c3bccdf278f2d9cbf638e864fc478cb72d2d0db5