From 742058e74251ea7b6c02fb4e5c4db3772f01a515 Mon Sep 17 00:00:00 2001 From: Victor Widell Date: Mon, 28 Oct 2024 10:31:20 +0100 Subject: [PATCH 1/3] macos: Upgraded zig-objc to support zig 0.14.0-dev. --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 1a4c322..c175f1a 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -4,8 +4,8 @@ .minimum_zig_version = "0.13.0", .dependencies = .{ .@"zig-objc" = .{ - .url = "https://github.com/mitchellh/zig-objc/archive/fe5ac419530cf800294369d996133fe9cd067aec.tar.gz", - .hash = "122034b3e15d582d8d101a7713e5f13c872b8b8eb6d9cb47515b8e34ee75e122630d", + .url = "https://github.com/mitchellh/zig-objc/archive/362d12f4d91dfde84668e0befc5a8ca76659965a.zip", + .hash = "12206038da3a8d42de25babfadaa3b8fb01c223850a1f1ce309034172d150df61a8c", .lazy = true, }, .macos_sdk = .{ From 65794fc82f9825034adc47886bbe72949ffead7d Mon Sep 17 00:00:00 2001 From: Victor Widell Date: Mon, 28 Oct 2024 17:12:51 +0100 Subject: [PATCH 2/3] macos: Added dummy Monitor struct. --- src/backends/macos/Monitor.zig | 27 +++++++++++++++++++++++++++ src/backends/macos/backend.zig | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 src/backends/macos/Monitor.zig diff --git a/src/backends/macos/Monitor.zig b/src/backends/macos/Monitor.zig new file mode 100644 index 0000000..7386a28 --- /dev/null +++ b/src/backends/macos/Monitor.zig @@ -0,0 +1,27 @@ +const lib = @import("../../capy.zig"); + +const Monitor = @This(); + +var monitor_list: [0]Monitor = .{}; + +pub fn getList() []Monitor { + return &monitor_list; +} + +pub fn getNumberOfVideoModes(self: *Monitor) usize { + _ = self; + return 0; +} + +pub fn getVideoMode(self: *Monitor, index: usize) lib.VideoMode { + _ = self; + _ = index; + return .{ + .width = 0, + .height = 0, + .refresh_rate_millihertz = 0, + .bit_depth = 0, + }; +} + +pub fn deinitAllPeers() void {} diff --git a/src/backends/macos/backend.zig b/src/backends/macos/backend.zig index f19a55a..72cb014 100644 --- a/src/backends/macos/backend.zig +++ b/src/backends/macos/backend.zig @@ -13,6 +13,8 @@ const EventType = shared.BackendEventType; const BackendError = shared.BackendError; const MouseButton = shared.MouseButton; +pub const Monitor = @import("Monitor.zig"); + // pub const PeerType = *opaque {}; pub const PeerType = objc.Object; From de1a5f732370e01d75e23ee07c27395bcb3c396f Mon Sep 17 00:00:00 2001 From: Victor Widell Date: Mon, 28 Oct 2024 17:31:59 +0100 Subject: [PATCH 3/3] Fixed compile error. --- src/data.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data.zig b/src/data.zig index f95e29a..ede292c 100644 --- a/src/data.zig +++ b/src/data.zig @@ -612,7 +612,7 @@ pub fn Atom(comptime T: type) type { const handler = struct { fn handler(data_wrapper: *Self, fn_ptr: ?*const anyopaque, wrappers: []?*anyopaque) void { - const callback = @as(FunctionType, @ptrCast(fn_ptr)); + const callback = @as(FunctionType, @alignCast(@ptrCast(fn_ptr))); const ArgsTuple = std.meta.Tuple(&ValueTypes); var args: ArgsTuple = undefined;