mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
hi
This commit is contained in:
parent
46b21391c0
commit
ddc9a05f39
6 changed files with 111 additions and 53 deletions
18
src/root.zig
18
src/root.zig
|
|
@ -11,6 +11,7 @@ const server = &@import("main.zig").server;
|
|||
const gpa = std.heap.c_allocator;
|
||||
|
||||
scene: *wlr.Scene,
|
||||
scene_tree: ?*wlr.Scene,
|
||||
scene_output_layout: *wlr.SceneOutputLayout,
|
||||
|
||||
output_layout: *wlr.OutputLayout,
|
||||
|
|
@ -28,10 +29,11 @@ pub fn init(self: *Root) !void {
|
|||
|
||||
self.* = .{
|
||||
.scene = scene,
|
||||
.scene_tree = null,
|
||||
.output_layout = output_layout,
|
||||
|
||||
.scene_output_layout = try scene.attachOutputLayout(output_layout),
|
||||
|
||||
|
||||
.all_views = try .initCapacity(gpa, 10),
|
||||
};
|
||||
}
|
||||
|
|
@ -49,13 +51,17 @@ pub fn addOutput(self: *Root, new_output: *Output) void {
|
|||
}
|
||||
|
||||
pub fn addView(self: *Root, view: *View) void {
|
||||
self.all_views.append(gpa, view) catch {
|
||||
std.log.err("Out of memory to append view", .{});
|
||||
};
|
||||
|
||||
_ = self.scene.tree.createSceneXdgSurface(view.xdg_toplevel.base) catch {
|
||||
self.scene_tree = self.scene.tree.createSceneXdgSurface(view.xdg_toplevel.base) catch {
|
||||
std.log.err("Unable to create scene node for new view", .{});
|
||||
};
|
||||
|
||||
self.all_views.append(gpa, view) catch {
|
||||
std.log.err("Out of memory to append view", .{});
|
||||
self.scene_tree = null;
|
||||
return;
|
||||
};
|
||||
|
||||
std.log.debug("View added succesfully", .{});
|
||||
}
|
||||
|
||||
const ViewAtResult = struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue