1
0
Fork 0

deps: update zenolith

This commit is contained in:
LordMZTE 2024-01-30 16:19:58 +01:00
parent 788a38fb45
commit f0b5f244af
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 23 additions and 19 deletions

View file

@ -10,8 +10,8 @@
.dependencies = .{
.zenolith = .{
//.path = "../zenolith",
.url = "git+https://git.mzte.de/zenolith/zenolith.git#ad388687cd205079aab75074a542eadc79490df7",
.hash = "12201677a81b6f8133bbe9c7d3b2afc07b61bf632a070d13d57f995827022f6a1f54",
.url = "git+https://git.mzte.de/zenolith/zenolith.git#c4ae23938d9f64ffd8dd0662314f7b478818547a",
.hash = "1220aa2f21fb19b4cb741e0709e84308a4d079f446dd655827206b0f834da8efa350",
},
.sdl2 = .{

View file

@ -96,21 +96,7 @@ pub fn run(
) anyerror!void {
// Initial layout pass before we get a resize event.
if (self.initial_run) {
var width: c_int = 0;
var height: c_int = 0;
c.SDL_GetWindowSize(self.window, &width, &height);
try zenolith.treevent.fire(root, zenolith.treevent.LayoutSize{
.final = true,
.constraints = .{
.min = .{ .width = 0, .height = 0 },
.max = .{ .width = @intCast(width), .height = @intCast(height) },
},
});
try zenolith.treevent.fire(root, zenolith.treevent.LayoutPosition{
.position = .{ .x = 0, .y = 0 },
});
try self.relayoutRoot(root);
self.initial_run = false;
}
@ -160,13 +146,13 @@ pub fn run(
try zenolith.treevent.fire(root, zenolith.treevent.LayoutSize{
.final = true,
.constraints = .{
.min = .{ .width = 0, .height = 0 },
.min = zenolith.layout.Size.zero,
.max = size,
},
});
try zenolith.treevent.fire(root, zenolith.treevent.LayoutPosition{
.position = .{ .x = 0, .y = 0 },
.position = zenolith.layout.Position.zero,
});
},
else => {},
@ -392,3 +378,21 @@ pub fn createFont(self: Sdl2Platform, opts: CreateFontOptions) CreateFontError!S
.pixel_buf = std.ArrayList(u8).init(self.alloc),
};
}
pub fn relayoutRoot(self: *Sdl2Platform, root: *zenolith.widget.Widget) !void {
var width: c_int = 0;
var height: c_int = 0;
c.SDL_GetWindowSize(self.window, &width, &height);
try zenolith.treevent.fire(root, zenolith.treevent.LayoutSize{
.final = true,
.constraints = .{
.min = .{ .width = 0, .height = 0 },
.max = .{ .width = @intCast(width), .height = @intCast(height) },
},
});
try zenolith.treevent.fire(root, zenolith.treevent.LayoutPosition{
.position = .{ .x = 0, .y = 0 },
});
}