diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-09-09 10:47:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-09 10:47:25 +0100 |
| commit | fcb668663b49289e11cfc87054067e9fa0599751 (patch) | |
| tree | 021f0c7adbe1383775acb3a96dd724bf621a8c1f | |
| parent | 3fae8b49db54e2be6a61453cf3f5bbd452c58662 (diff) | |
| parent | ad98efe1fdc206d285b3fd4e4e8e0be1aac3d1b7 (diff) | |
Merge pull request #2037 from odin-lang/revert-2026-revert-init-window-workaround
Revert "Remove the workaround for NSWindow initWithContentFrame"
| -rw-r--r-- | vendor/darwin/Foundation/NSWindow.odin | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/darwin/Foundation/NSWindow.odin b/vendor/darwin/Foundation/NSWindow.odin index 2efbe8ba3..330af6012 100644 --- a/vendor/darwin/Foundation/NSWindow.odin +++ b/vendor/darwin/Foundation/NSWindow.odin @@ -103,7 +103,18 @@ Window_alloc :: proc() -> ^Window { @(objc_type=Window, objc_name="initWithContentRect") Window_initWithContentRect :: proc (self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: bool) -> ^Window { - return msgSend(^Window, self, "initWithContentRect:styleMask:backing:defer:", contentRect, styleMask, backing, doDefer) + self := self + // HACK: due to a compiler bug, the generated calling code does not + // currently work for this message. Has to do with passing a struct along + // with other parameters, so we don't send the rect here. + // Omiting the rect argument here actually works, because of how the C + // calling conventions are defined. + self = msgSend(^Window, self, "initWithContentRect:styleMask:backing:defer:", styleMask, backing, doDefer) + + // apply the contentRect now, since we did not pass it to the init call + msgSend(nil, self, "setContentSize:", contentRect.size) + msgSend(nil, self, "setFrameOrigin:", contentRect.origin) + return self } @(objc_type=Window, objc_name="contentView") Window_contentView :: proc(self: ^Window) -> ^View { |