From f7ffad8ee33b735b0997191c06f55c0ddfb9a38c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 16 Jul 2021 11:43:19 +1000 Subject: [PATCH] Compilation fixes --- src/_WindowBase.h | 5 +++-- src/interop_cocoa.m | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/_WindowBase.h b/src/_WindowBase.h index 907334b8a..c131cd0dd 100644 --- a/src/_WindowBase.h +++ b/src/_WindowBase.h @@ -120,8 +120,9 @@ static EGLConfig ctx_config; static EGLint ctx_numConfig; static void GLContext_InitSurface(void) { - if (!win_handle) return; /* window not created or lost */ - ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, win_handle, NULL); + void* window = WindowInfo.Handle; + if (!window) return; /* window not created or lost */ + ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, window, NULL); if (!ctx_surface) return; eglMakeCurrent(ctx_display, ctx_surface, ctx_surface, ctx_context); diff --git a/src/interop_cocoa.m b/src/interop_cocoa.m index 6a3d4d778..84af2f77a 100644 --- a/src/interop_cocoa.m +++ b/src/interop_cocoa.m @@ -1,5 +1,6 @@ #include "_WindowBase.h" #include "ExtMath.h" +#include "Funcs.h" #include "Bitmap.h" #include "String.h" #include @@ -119,6 +120,14 @@ void Clipboard_SetText(const cc_string* value) { [pasteboard setString:str forType:NSStringPboardType]; } +static NSAutoreleasePool* pool; +void Window_Init(void) { + pool = [[NSAutoreleasePool alloc] init]; + appHandle = [NSApplication sharedApplication]; + [appHandle activateIgnoringOtherApps:YES]; + Window_CommonInit(); +} + /*########################################################################################################################* *----------------------------------------------------------Wwindow--------------------------------------------------------* @@ -209,7 +218,6 @@ static void DoDrawFramebuffer(CGRect dirty); } @end - static void MakeContentView(void) { NSRect rect; NSView* view; @@ -222,14 +230,6 @@ static void MakeContentView(void) { [winHandle setContentView:viewHandle]; } -static NSAutoreleasePool* pool; -void Window_Init(void) { - pool = [[NSAutoreleasePool alloc] init]; - appHandle = [NSApplication sharedApplication]; - [appHandle activateIgnoringOtherApps:YES]; - Window_CommonInit(); -} - #ifdef CC_BUILD_ICON extern const int CCIcon_Data[]; extern const int CCIcon_Width, CCIcon_Height; @@ -279,6 +279,7 @@ void Window_Create(int width, int height) { Window_CommonCreate(); WindowInfo.Exists = true; + WindowInfo.Handle = winHandle; del = [CCWindowDelegate alloc]; [winHandle setDelegate:del]; @@ -391,6 +392,7 @@ void Window_ProcessEvents(void) { int key, type, steps, x, y; CGFloat dx, dy; + // https://wiki.freepascal.org/Cocoa_Internals/Application [pool release]; pool = [[NSAutoreleasePool alloc] init];