Bug 438808 - `wl_subsurface_place_below` does not have any effect when used with a subsurface and its parent
Summary: `wl_subsurface_place_below` does not have any effect when used with a subsurf...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.0
Platform: Archlinux Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-17 15:38 UTC by nullgemm
Modified: 2021-07-08 13:07 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
The test app rendered incorrectly by Kwin vs. correctly by Weston (16.78 KB, image/png)
2021-06-17 15:38 UTC, nullgemm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nullgemm 2021-06-17 15:38:26 UTC
Created attachment 139439 [details]
The test app rendered incorrectly by Kwin vs. correctly by Weston

SUMMARY
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:
https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_subsurface-request-place_above

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

OBSERVED RESULT
Under Kwin the subsurface (in green) stays on top of the main surface (in semi-transparent red).

EXPECTED RESULT
Under Weston the subsurface is moved under the main surface

SOFTWARE/OS VERSIONS
Linux Kernel Version: 5.12.10
Plasma Version: 5.22.0
Plasma Framework Version: 5.83.0
Qt Version: 5.15.2
Comment 1 Vlad Zahorodnii 2021-06-19 12:16:08 UTC
Relevant MR https://invent.kde.org/plasma/kwayland-server/-/merge_requests/248
Comment 2 Bug Janitor Service 2021-06-19 14:22:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1116
Comment 3 Vlad Zahorodnii 2021-07-08 06:56:05 UTC
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
parent surface.

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

https://invent.kde.org/plasma/kwin/commit/be6c33458f0851a8636372c36fdd31f6fa0af3f9