From 11d21a711aeeeff279439cd287a45585ca90b612 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 8 Feb 2021 07:52:33 +1100 Subject: [PATCH] Mac: Fix cocoa backend not compiling on 32 bit --- src/interop_cocoa.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/interop_cocoa.m b/src/interop_cocoa.m index aaf043dd3..e95d0f7ec 100644 --- a/src/interop_cocoa.m +++ b/src/interop_cocoa.m @@ -20,7 +20,7 @@ extern void Window_CommonInit(void); extern int MapNativeKey(UInt32 key); static void RefreshWindowBounds(void) { - CGRect win, view; + NSRect win, view; int viewY; win = [winHandle frame]; @@ -31,9 +31,9 @@ static void RefreshWindowBounds(void) { /* Then just subtract from screen height to make relative to top instead of bottom of the screen. */ /* Of course this is only half the story, since we're really after Y position of the content. */ /* To work out top Y of view relative to window, it's just win.height - (view.y + view.height) */ - viewY = (int)win.size.height - ((int)view.origin.y + (int)view.size.height); - windowX = (int)win.origin.x + (int)view.origin.x; - windowY = DisplayInfo.Height - ((int)win.origin.y + (int)win.size.height) + viewY; + viewY = (int)win.size.height - ((int)view.origin.y + (int)view.size.height); + windowX = (int)win.origin.x + (int)view.origin.x; + windowY = DisplayInfo.Height - ((int)win.origin.y + (int)win.size.height) + viewY; WindowInfo.Width = (int)view.size.width; WindowInfo.Height = (int)view.size.height; @@ -102,7 +102,7 @@ static void DoDrawFramebuffer(CGRect dirty); static void MakeContentView(void) { - CGRect rect; + NSRect rect; NSView* view; view = [winHandle contentView]; @@ -153,7 +153,7 @@ static void ApplyIcon(void) { } #define WIN_MASK (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask) void Window_Create(int width, int height) { CCWindowDelegate* del; - CGRect rect; + NSRect rect; /* Technically the coordinates for the origin are at bottom left corner */ /* But since the window is in centre of the screen, don't need to care here */ @@ -213,7 +213,7 @@ cc_result Window_ExitFullscreen(void) { void Window_SetSize(int width, int height) { /* Can't use setContentSize:, because that resizes from the bottom left corner. */ - CGRect rect = [winHandle frame]; + NSRect rect = [winHandle frame]; rect.origin.y += WindowInfo.Height - height; rect.size.width += width - WindowInfo.Width; @@ -257,7 +257,7 @@ static void ProcessKeyChars(id ev) { } static cc_bool GetMouseCoords(int* x, int* y) { - CGPoint loc = [NSEvent mouseLocation]; + NSPoint loc = [NSEvent mouseLocation]; *x = (int)loc.x - windowX; *y = (DisplayInfo.Height - (int)loc.y) - windowY; // TODO: this seems to be off by 1 @@ -413,7 +413,7 @@ static void DoDrawFramebuffer(CGRect dirty) { } void Window_DrawFramebuffer(Rect2D r) { - CGRect rect; + NSRect rect; rect.origin.x = r.X; rect.origin.y = WindowInfo.Height - r.Y - r.Height; rect.size.width = r.Width;