From ee7c89721fab3a67c90268d6ab2c8b459b296406 Mon Sep 17 00:00:00 2001 From: Harrison DiAmbrosio Date: Sun, 19 Oct 2025 20:40:53 -0400 Subject: [PATCH] window rendering --- src/output.zig | 5 ++--- src/view.zig | 17 +++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/output.zig b/src/output.zig index 85206c7..ebf82e1 100644 --- a/src/output.zig +++ b/src/output.zig @@ -33,9 +33,8 @@ pub fn create(wlr_output: *wlr.Output) !*Output { std.log.debug("adding output: {s}", .{output.wlr_output.name}); // I don't think we need the result of this - _ = try server.root.output_layout.addAuto(wlr_output); - - // I beive this has the output render the entire scene which is finefor now + const layout_output = try server.root.output_layout.addAuto(wlr_output); + server.root.scene_output_layout.addOutput(layout_output, output.scene_output); return output; } diff --git a/src/view.zig b/src/view.zig index 6af0ddf..8992e51 100644 --- a/src/view.zig +++ b/src/view.zig @@ -31,11 +31,12 @@ pub fn initFromTopLevel(xdg_toplevel: *wlr.XdgToplevel) ?*View { }; // Debug what we have - std.log.debug("xdg_toplevel ptr: {*}", .{xdg_toplevel}); - std.log.debug("xdg_toplevel.base ptr: {*}", .{xdg_toplevel.base}); - std.log.debug("xdg_toplevel.base type: {}", .{@TypeOf(xdg_toplevel.base)}); + // std.log.debug("xdg_toplevel ptr: {*}", .{xdg_toplevel}); + // std.log.debug("xdg_toplevel.base ptr: {*}", .{xdg_toplevel.base}); + // std.log.debug("xdg_toplevel.base type: {}", .{@TypeOf(xdg_toplevel.base)}); const xdg_surface = xdg_toplevel.base; + std.log.debug("surface events type: {}", .{@TypeOf(xdg_surface.surface.events)}); // Attach listeners xdg_surface.surface.events.map.add(&self.map); @@ -112,9 +113,13 @@ fn handleDestroy(listener: *wl.Listener(void)) void { gpa.destroy(view); } -fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) void { - _ = listener; - _ = surface; +fn handleCommit(listener: *wl.Listener(*wlr.Surface), _: *wlr.Surface) void { + const view: *View = @fieldParentPtr("commit", listener); + + // On the first commit, send a configure to tell the client it can proceed + if (view.xdg_toplevel.base.initial_commit) { + _ = view.xdg_toplevel.setSize(0, 0); // 0,0 means "you decide the size" + } } fn handleNewPopup(listener: *wl.Listener(*wlr.XdgPopup), popup: *wlr.XdgPopup) void {