git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitec0e4aee19461a915c2413f1598d927cb1b5bef1
parentfcf0b99fb7
authorIsaac Freund <[email protected]>
date2021-12-22 05:30
Subsurface: add commit listener on create if mapped

Subsurfaces may already be mapped when create is called, in which case
we must add the commit listener.

 river/Subsurface.zig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/river/Subsurface.zig b/river/Subsurface.zig
index 92328f5..edbd80f 100644
--- a/river/Subsurface.zig
+++ b/river/Subsurface.zig
@@ -74,6 +74,8 @@ pub fn create(wlr_subsurface: *wlr.Subsurface, parent: Parent) void {
     wlr_subsurface.events.unmap.add(&subsurface.unmap);
     wlr_subsurface.surface.events.new_subsurface.add(&subsurface.new_subsurface);
 
+    if (wlr_subsurface.mapped) wlr_subsurface.surface.events.commit.add(&subsurface.commit);
+
     Subsurface.handleExisting(wlr_subsurface.surface, parent);
 }