Skip to content

Commit

Permalink
Merge pull request #99 from geon/fix-macos-build
Browse files Browse the repository at this point in the history
Fix macos build
  • Loading branch information
zenith391 authored Oct 30, 2024
2 parents 0bb517a + de1a5f7 commit f304a9d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -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 = .{
Expand Down
27 changes: 27 additions & 0 deletions src/backends/macos/Monitor.zig
Original file line number Diff line number Diff line change
@@ -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 {}
2 changes: 2 additions & 0 deletions src/backends/macos/backend.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/data.zig
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,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;
Expand Down

0 comments on commit f304a9d

Please sign in to comment.