From 5421f91f419650c19381a18b813c6e7f01667ec6 Mon Sep 17 00:00:00 2001 From: Harrison DiAmbrosio Date: Tue, 24 Feb 2026 16:24:24 -0500 Subject: [PATCH] comments --- src/View.zig | 3 ++- src/lua/View.zig | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/View.zig b/src/View.zig index 338021f..2b4fb5d 100644 --- a/src/View.zig +++ b/src/View.zig @@ -90,7 +90,8 @@ pub fn init(xdg_toplevel: *wlr.XdgToplevel) *View { return self; } -/// tell the client that we're removing it +// Tell the client to close +// It better behave! pub fn close(self: *View) void { self.xdg_toplevel.sendClose(); } diff --git a/src/lua/View.zig b/src/lua/View.zig index 57303e5..7cc291d 100644 --- a/src/lua/View.zig +++ b/src/lua/View.zig @@ -14,7 +14,8 @@ fn view_id_err(L: *zlua.Lua) noreturn { L.raiseErrorStr("The view id must be >= 0 and < inf", .{}); } -// ---@alias view_id integer +// This allows us to differentiate random numbers from ids +// ---@alias view_id number // ---Get the ids for all available views // ---@return view_id[]? @@ -33,22 +34,29 @@ pub fn get_all_ids(L: *zlua.Lua) i32 { const output: *Output = @ptrCast(@alignCast(o.output.data.?)); if (!output.state.enabled) continue; + // Only search the content and fullscreen layers for views const layers = [_]*wlr.SceneTree{ output.layers.content, output.layers.fullscreen, }; for(layers) |layer| { - if(layer.children.length() == 0) continue; + if(layer.children.length() == 0) continue; // No children + if(@intFromPtr(layer) == 0) { - std.log.debug("ts is literally a null ptr", .{}); - continue; + std.log.err("ts is literally a null ptr", .{}); + unreachable; } var view_it = layer.children.iterator(.forward); while(view_it.next()) |v| { - if(v.data == null) continue; + + if(v.data == null) { + std.log.err("Unassigned arbitrary data in scene graph", .{}); + unreachable; + } + const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(v.data.?)); if(scene_node_data.* == .view) { @@ -65,12 +73,6 @@ pub fn get_all_ids(L: *zlua.Lua) i32 { return 1; } -// TODO: What is this? -pub fn check(L: *zlua.Lua) i32 { - L.pushNil(); - return 1; -} - // ---Get the id for the focused view // ---@return view_id? pub fn get_focused_id(L: *zlua.Lua) i32 { @@ -197,7 +199,8 @@ pub fn set_focused(L: *zlua.Lua) i32 { return 1; } -// ---Resize the view by it's top left corner +// ---Toggle the view to enter fullscreen. Will enter the fullsreen +// layer. // ---@param view_id view_id 0 maps to focused view pub fn toggle_fullscreen(L: *zlua.Lua) i32 { const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);