diff --git a/src/LayerSurface.zig b/src/LayerSurface.zig index 968cc74..ee3e949 100644 --- a/src/LayerSurface.zig +++ b/src/LayerSurface.zig @@ -27,6 +27,7 @@ pub fn init(wlr_layer_surface: *wlr.LayerSurfaceV1) *LayerSurface { const self = try gpa.create(LayerSurface); + self.* = .{ .output = blk: { // These block things are dangerous @@ -61,7 +62,6 @@ pub fn init(wlr_layer_surface: *wlr.LayerSurfaceV1) *LayerSurface { }; } - self.wlr_layer_surface.events.destroy.add(&self.destroy); self.wlr_layer_surface.surface.events.map.add(&self.map); self.wlr_layer_surface.surface.events.unmap.add(&self.unmap); @@ -104,8 +104,10 @@ fn handleDestroy( fn handleMap( listener: *wl.Listener(void) ) void { - const layer: *LayerSurface = @fieldParentPtr("map", listener); - layer.allowKeyboard(); + const layer_suraface: *LayerSurface = @fieldParentPtr("map", listener); + std.log.debug("layer surface mapped", .{}); + layer_suraface.output.arrangeLayers(); + layer_suraface.allowKeyboard(); } fn handleUnmap(listener: *wl.Listener(void)) void { @@ -113,6 +115,8 @@ fn handleUnmap(listener: *wl.Listener(void)) void { // FIXME: this crashes mez when killing mez layer_surface.output.arrangeLayers(); + + // TODO: Idk if this should be deiniting the layer surface entirely layer_surface.deinit(); } @@ -122,6 +126,8 @@ fn handleCommit( ) void { const layer_surface: *LayerSurface = @fieldParentPtr("commit", listener); + std.log.debug("layer surface commited", .{}); + if (!layer_surface.wlr_layer_surface.initial_commit) return; layer_surface.output.arrangeLayers(); } diff --git a/src/Server.zig b/src/Server.zig index 1c5b2bd..257e1f5 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -211,7 +211,6 @@ fn handleNewXdgToplevelDecoration( decoration: *wlr.XdgToplevelDecorationV1 ) void { if(server.root.viewById(@intFromPtr(decoration.toplevel))) |view| { - std.log.debug("found view\n", .{}); view.xdg_toplevel_decoration = decoration; } } @@ -224,6 +223,7 @@ fn handleNewLayerSurface( _: *wl.Listener(*wlr.LayerSurfaceV1), layer_surface: *wlr.LayerSurfaceV1 ) void { + std.log.debug("requested layer shell\n", .{}); if (layer_surface.output == null) { if (server.seat.focused_output == null) { std.log.err("No output available for new layer surface", .{}); diff --git a/src/View.zig b/src/View.zig index 663ac5e..2787b2d 100644 --- a/src/View.zig +++ b/src/View.zig @@ -164,7 +164,6 @@ fn handleMap(listener: *wl.Listener(void)) void { &server.seat.keyboard_group.keyboard.modifiers ); - std.log.debug("setting view decoration mode to server side\n", .{}); if(view.xdg_toplevel_decoration) |decoration| { _ = decoration.setMode(wlr.XdgToplevelDecorationV1.Mode.server_side); } diff --git a/src/lua/View.zig b/src/lua/View.zig index fc0bb40..c10248f 100644 --- a/src/lua/View.zig +++ b/src/lua/View.zig @@ -64,14 +64,10 @@ pub fn close(L: *zlua.Lua) i32 { // ---@param x number x position for view // ---@param y number y position for view pub fn set_position(L: *zlua.Lua) i32 { - std.log.debug("repositioning", .{}); - const view_id: u64 = @intCast(L.checkInteger(1)); const x: i32 = @intFromFloat(@round(L.checkNumber(2))); const y: i32 = @intFromFloat(@round(L.checkNumber(3))); - std.log.debug("position to set: ({d}, {d})", .{x, y}); - const view: ?*View = if (view_id == 0) server.seat.focused_view else server.root.viewById(view_id); if(view) |v| { v.setPosition(x, y);