aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-01 12:18:53 +0200
committerSimon Ser <contact@emersion.fr>2021-06-03 14:04:07 +0200
commit9e58301df7f09660cb36337211cbf5700d99810c (patch)
treedde24f5e73f6bfdedae8bd1f3833e652045a0a0d /include
parent11040d4942ed9210fcbca1d2d1001cb8d307b89d (diff)
surface: allow placing subsurfaces below parent
Prior to this commit, subsurfaces could only be placed above their parent. Any place_{above,below} request involving the parent would fail with a protocol error. However the Wayland protocol allows using the parent surface in the place_{above,below} requests, and allows subsurfaces to be placed below their parent. Weston's implementation adds a dummy wl_list node in the subsurface list. However this is potentially dangerous: iterating the list requires making sure the dummy wl_list node is checked for, otherwise memory corruption will happen. Instead, split the list in two: one for subsurfaces above the parent, the other for subsurfaces below. Tested with wleird's subsurfaces demo client. Closes: https://github.com/swaywm/wlroots/issues/1865
Diffstat (limited to 'include')
-rw-r--r--include/wlr/types/wlr_surface.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index d99c182a..00db6cd8 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -139,10 +139,13 @@ struct wlr_surface {
struct wl_signal destroy;
} events;
- struct wl_list subsurfaces; // wlr_subsurface::parent_link
+ // wlr_subsurface.parent_link
+ struct wl_list subsurfaces_below;
+ struct wl_list subsurfaces_above;
- // wlr_subsurface::parent_pending_link
- struct wl_list subsurface_pending_list;
+ // wlr_subsurface.parent_pending_link
+ struct wl_list subsurfaces_pending_below;
+ struct wl_list subsurfaces_pending_above;
struct wl_list current_outputs; // wlr_surface_output::link