Created attachment 139439 [details]
The test app rendered incorrectly by Kwin vs. correctly by Weston
Wayland subsurfaces stay on top when using `wl_subsurface_place_below` to move them under their parent, while placing a subsurface under a sibling works fine.
The Wayland documentation clearly states it should be possible to use `wl_subsurface_place_below` and `wl_subsurface_place_above` with the subsurface's parent instead of a sibling:
This bug used to exist in wlroots as well; it was fixed in `master` recently: https://github.com/swaywm/wlroots/commit/9e58301df7f09660cb36337211cbf5700d99810c
STEPS TO REPRODUCE
1. clone the test repo: https://code.videolan.org/nullgemm/wl_placement_bug_test
2. make and run the example code
Under Kwin the subsurface (in green) stays on top of the main surface (in semi-transparent red).
Under Weston the subsurface is moved under the main surface
Linux Kernel Version: 5.12.10
Plasma Version: 5.22.0
Plasma Framework Version: 5.83.0
Qt Version: 5.15.2
Relevant MR https://invent.kde.org/plasma/kwayland-server/-/merge_requests/248
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1116
Git commit be6c33458f0851a8636372c36fdd31f6fa0af3f9 by Vlad Zahorodnii.
Committed on 08/07/2021 at 06:55.
Pushed by vladz into branch 'master'.
wayland: Allow placing sub-surfaces below their parent
According to the spec, if the wl_subsurface.place_below request is
called with the parent surface, the sub-surface must be placed below the
M +0 -18 src/item.cpp
M +0 -5 src/item.h
M +16 -27 src/surfaceitem_wayland.cpp
M +2 -1 src/surfaceitem_wayland.h