From 71355ada3104ddc9f166a5d728cc74839cb0a0b4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 30 Dec 2022 15:20:45 -0800 Subject: [PATCH] window should reach into glfw for addWindow for now --- src/Window.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Window.zig b/src/Window.zig index 6559acc31..0d4d9fb59 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -496,10 +496,16 @@ pub fn shouldClose(self: Window) bool { pub fn addWindow(self: Window, other: *Window) void { assert(builtin.target.isDarwin()); + // This has a hard dependency on GLFW currently. If we want to support + // this in other windowing systems we should abstract this. This is NOT + // the right interface. + const self_win = glfwNative.getCocoaWindow(self.windowing_system.window).?; + const other_win = glfwNative.getCocoaWindow(other.windowing_system.window).?; + const NSWindowOrderingMode = enum(isize) { below = -1, out = 0, above = 1 }; - const nswindow = objc.Object.fromId(glfwNative.getCocoaWindow(self.window).?); + const nswindow = objc.Object.fromId(self_win); nswindow.msgSend(void, objc.sel("addTabbedWindow:ordered:"), .{ - objc.Object.fromId(glfwNative.getCocoaWindow(other.window).?), + objc.Object.fromId(other_win), NSWindowOrderingMode.above, }); }