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

commite4a75cffb4da4755598f77b66358d5ae31ed3fb4
parentf4bc5842b3
authorIsaac Freund <[email protected]>
date2023-02-01 22:46
Xwayland: create scene tree

 river/XwaylandView.zig | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig
index 211a8a8..7ae257c 100644
--- a/river/XwaylandView.zig
+++ b/river/XwaylandView.zig
@@ -67,10 +67,9 @@ pub fn create(output: *Output, xwayland_surface: *wlr.XwaylandSurface) error{Out
     const node = try util.gpa.create(ViewStack(View).Node);
     const view = &node.view;
 
-    // TODO actually render xwayland windows, not just an empty tree.
     const tree = try output.layers.views.createSceneTree();
 
-    view.init(output, tree, .{ .xwayland_view = .{
+    try view.init(output, tree, .{ .xwayland_view = .{
         .view = view,
         .xwayland_surface = xwayland_surface,
     } });
@@ -195,6 +194,13 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:
     xwayland_surface.events.request_fullscreen.add(&self.request_fullscreen);
     xwayland_surface.events.request_minimize.add(&self.request_minimize);
 
+    const surface_tree = view.tree.createSceneSubsurfaceTree(surface) catch {
+        log.err("out of memory", .{});
+        surface.resource.getClient().postNoMemory();
+        return;
+    };
+    surface_tree.node.lowerToBottom();
+
     // Use the view's "natural" size centered on the output as the default
     // floating dimensions
     view.float_box = .{