From f76af48613a7db0717bc17c71c3f4b7d595be120 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 3 May 2024 20:21:42 -0700 Subject: [PATCH] pkg/macos: add CVDisplayLinkSetCurrentCGDisplay --- pkg/macos/video/display_link.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/macos/video/display_link.zig b/pkg/macos/video/display_link.zig index e7f4844a0..0ccae691d 100644 --- a/pkg/macos/video/display_link.zig +++ b/pkg/macos/video/display_link.zig @@ -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.