Bug 485648 - Floating panel offsets newly placed windows just before unfloating
Summary: Floating panel offsets newly placed windows just before unfloating
Status: REOPENED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-16 23:39 UTC by Natalie Clarius
Modified: 2024-08-16 14:52 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Window gets placed with margin (278.18 KB, video/mp4)
2024-04-17 08:41 UTC, Natalie Clarius
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Natalie Clarius 2024-04-16 23:39:01 UTC
SUMMARY
A floating panel doesn't unfloat before a newly placed window touches it, which creates an unnecessary offset for the window position once the panel then unfloats.

STEPS TO REPRODUCE
1. Set panel to top positioned and floating
2. Set window placement to top-left corner
3. Have no visible windows currently touching the panel so it is floating
4. Open a new window

OBSERVED RESULT
New window gets placed with a margin to the floating panel, then the panel unfloats to get out of the way of the now touching window, now there is a gap between the window and the panel

EXPECTED RESULT
New window touches the unfloated panel

SOFTWARE/OS VERSIONS
git master
Comment 1 Niccolò Venerandi 2024-04-17 08:24:18 UTC
May I ask you for a screenshot / vid of the situation? Thanks!
Comment 2 Natalie Clarius 2024-04-17 08:41:54 UTC
Created attachment 168605 [details]
Window gets placed with margin

You can see in the video how the first window ends up with a margin to the defloated panel, while the second window gets placed correctly (here in "minimal overlapping" window placement mode to illustrate better).
Comment 3 Natalie Clarius 2024-04-17 09:27:25 UTC
I might as well have filed the issue against KWin as a bug of the placement code; the problem is the interaction between the two: By the time the window is placed, the panel doesn't yet know to defloat, so the placement respects the floating margin, which directly afterwards goes away. Not sure how this could be fixed.
Comment 4 Niccolò Venerandi 2024-04-18 09:14:09 UTC
The fix is that Kwin should use the reserved space by layer shells to position newly created windows instead of relying on their size; the reserved space is always of the correct size
Comment 5 Marco Martin 2024-07-05 12:16:41 UTC
Git commit f7ee03d065b4e293746248f749a7965c4321b1cb by Marco Martin.
Committed on 05/07/2024 at 12:16.
Pushed by mart into branch 'master'.

Refactor floating panels

* Floating panels are always big enough to fit the floating version
* they never move during animations
* when they unfloat the masks get updated so that the extra area is completely hidden
* the exclusive zone never changes and follows the unfloated geometry
* maximize window animations are better, won't resize the window twice anymore
* unfloating animation is smoother now

depends from https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2309,
https://invent.kde.org/frameworks/ksvg/-/merge_requests/50,
https://invent.kde.org/plasma/libplasma/-/merge_requests/1166
and https://invent.kde.org/plasma/libplasma/-/merge_requests/1148
Related: bug 483346, bug 480550

M  +1    -0    shell/autotests/CMakeLists.txt
M  +19   -9    shell/panelshadows.cpp
M  +2    -1    shell/panelshadows_p.h
M  +81   -45   shell/panelview.cpp
M  +0    -1    shell/panelview.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/f7ee03d065b4e293746248f749a7965c4321b1cb
Comment 6 Natalie Clarius 2024-08-16 14:52:50 UTC
On X11 the bug is still present for me.