1
0
Fork 0

chore: port to latest Zig master

This commit is contained in:
LordMZTE 2024-03-26 17:18:48 +01:00
parent 431cd4adf7
commit 4e67de14b3
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
5 changed files with 15 additions and 9 deletions

View File

@ -9,8 +9,8 @@
.dependencies = .{
.statspatch = .{
.url = "git+https://git.mzte.de/LordMZTE/statspatch.git#9f6c8648e9901646b440b525201b77dbabc04bba",
.hash = "122093d8dbfbd8f5e28734da73d9e5be1d6b2d41cf234e07daf2dfd7abf7ba65d976",
.url = "git+https://git.mzte.de/lordmzte/statspatch.git#c9143e5e9cfcdad99a49748ce6df5ac5c31e51cd",
.hash = "1220d5aad80984589108230b8e16b8e823c16acbb123fce3c1e7c2e5be442b7366be",
},
},
}

View File

@ -22,7 +22,7 @@ fn Prototype(comptime Self: type) type {
/// Called if the Backevent made it's way up the widget tree without being intercepted.
/// The root widget will be passed.
pub fn unhandled(self: Self, root: *Widget) !void {
try (statspatch.implcallOptional(
try @as(anyerror!void, statspatch.implcallOptional(
self,
.self,
"unhandled",

View File

@ -64,7 +64,7 @@ fn Prototype(comptime Self: type) type {
"strokeRect",
anyerror!void,
.{ self, rectangle, line_width, stroke_color, fill_color },
)) |ret| try ret else {
)) |ret| try @as(anyerror!void, ret) else {
// TODO: draw as 2 rects if fill_color is set
const ud_size = Size{
.width = rectangle.size.width,
@ -219,7 +219,7 @@ fn Prototype(comptime Self: type) type {
"chunk",
anyerror!void,
.{ self, pos, text_chunk },
)) |ret| try ret else {
)) |ret| try @as(anyerror!void, ret) else {
for (text_chunk.spans.items) |ss| {
try self.span(pos.add(ss.position), ss.span);
}

View File

@ -15,7 +15,7 @@ fn Prototype(comptime Self: type) type {
/// Called when a widget subtree is unlinked on this platform.
/// Do not call this directly, instead call Widget.unlink.
pub fn onSubtreeUnlink(self: *Self, widget: *Widget) !void {
try (statspatch.implcallOptional(
try @as(anyerror!void, statspatch.implcallOptional(
self,
.ptr,
"onSubtreeUnlink",

View File

@ -48,7 +48,7 @@ fn Prototype(comptime Self: type) type {
// Possibly call an initialize function. The widget can do any necessary
// initialization of it's data here.
_ = try (statspatch.implcallOptional(self, .ptr, "initialize", anyerror!void, .{self}) orelse {});
_ = try @as(anyerror!void, statspatch.implcallOptional(self, .ptr, "initialize", anyerror!void, .{self}) orelse {});
return self;
}
@ -80,7 +80,7 @@ fn Prototype(comptime Self: type) type {
}
pub fn backevent(self: *Self, ev: Backevent) !void {
try (statspatch.implcallOptional(
try @as(anyerror!void, statspatch.implcallOptional(
self,
.ptr,
"backevent",
@ -169,7 +169,13 @@ fn Prototype(comptime Self: type) type {
/// It is safe to deinitialize the subtree after it has been unlinked.
pub fn unlink(self: *Self) !void {
zenolith.log.debug("child {s}@{x} unlinked", .{ @tagName(self.u), @intFromPtr(self) });
try (statspatch.implcallOptional(self, .ptr, "unlink", anyerror!void, .{self}) orelse {});
try @as(anyerror!void, statspatch.implcallOptional(
self,
.ptr,
"unlink",
anyerror!void,
.{self},
) orelse {});
self.data.parent = null;
if (self.data.platform) |p| try p.onSubtreeUnlink(self);