pkg/macos: add CVDisplayLinkSetCurrentCGDisplay

This commit is contained in:
Mitchell Hashimoto
2024-05-03 20:21:42 -07:00
parent e31e25f54d
commit f76af48613

View File

@ -36,6 +36,17 @@ pub const DisplayLink = opaque {
return c.CVDisplayLinkIsRunning(@ptrCast(self)) != 0;
}
pub fn setCurrentCGDisplay(
self: *DisplayLink,
display_id: c.CGDirectDisplayID,
) Error!void {
if (c.CVDisplayLinkSetCurrentCGDisplay(
@ptrCast(self),
display_id,
) != c.kCVReturnSuccess)
return error.InvalidOperation;
}
// Note: this purposely throws away a ton of arguments I didn't need.
// It would be trivial to refactor this into Zig types and properly
// pass this through.