mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
comments
This commit is contained in:
parent
94bd4e0815
commit
5421f91f41
2 changed files with 17 additions and 13 deletions
|
|
@ -90,7 +90,8 @@ pub fn init(xdg_toplevel: *wlr.XdgToplevel) *View {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// tell the client that we're removing it
|
// Tell the client to close
|
||||||
|
// It better behave!
|
||||||
pub fn close(self: *View) void {
|
pub fn close(self: *View) void {
|
||||||
self.xdg_toplevel.sendClose();
|
self.xdg_toplevel.sendClose();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ fn view_id_err(L: *zlua.Lua) noreturn {
|
||||||
L.raiseErrorStr("The view id must be >= 0 and < inf", .{});
|
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
|
// ---Get the ids for all available views
|
||||||
// ---@return view_id[]?
|
// ---@return view_id[]?
|
||||||
|
|
@ -33,22 +34,29 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
|
||||||
const output: *Output = @ptrCast(@alignCast(o.output.data.?));
|
const output: *Output = @ptrCast(@alignCast(o.output.data.?));
|
||||||
if (!output.state.enabled) continue;
|
if (!output.state.enabled) continue;
|
||||||
|
|
||||||
|
// Only search the content and fullscreen layers for views
|
||||||
const layers = [_]*wlr.SceneTree{
|
const layers = [_]*wlr.SceneTree{
|
||||||
output.layers.content,
|
output.layers.content,
|
||||||
output.layers.fullscreen,
|
output.layers.fullscreen,
|
||||||
};
|
};
|
||||||
|
|
||||||
for(layers) |layer| {
|
for(layers) |layer| {
|
||||||
if(layer.children.length() == 0) continue;
|
if(layer.children.length() == 0) continue; // No children
|
||||||
|
|
||||||
if(@intFromPtr(layer) == 0) {
|
if(@intFromPtr(layer) == 0) {
|
||||||
std.log.debug("ts is literally a null ptr", .{});
|
std.log.err("ts is literally a null ptr", .{});
|
||||||
continue;
|
unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
var view_it = layer.children.iterator(.forward);
|
var view_it = layer.children.iterator(.forward);
|
||||||
|
|
||||||
while(view_it.next()) |v| {
|
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.?));
|
const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(v.data.?));
|
||||||
|
|
||||||
if(scene_node_data.* == .view) {
|
if(scene_node_data.* == .view) {
|
||||||
|
|
@ -65,12 +73,6 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: What is this?
|
|
||||||
pub fn check(L: *zlua.Lua) i32 {
|
|
||||||
L.pushNil();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---Get the id for the focused view
|
// ---Get the id for the focused view
|
||||||
// ---@return view_id?
|
// ---@return view_id?
|
||||||
pub fn get_focused_id(L: *zlua.Lua) i32 {
|
pub fn get_focused_id(L: *zlua.Lua) i32 {
|
||||||
|
|
@ -197,7 +199,8 @@ pub fn set_focused(L: *zlua.Lua) i32 {
|
||||||
return 1;
|
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
|
// ---@param view_id view_id 0 maps to focused view
|
||||||
pub fn toggle_fullscreen(L: *zlua.Lua) i32 {
|
pub fn toggle_fullscreen(L: *zlua.Lua) i32 {
|
||||||
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue