Compilation fixes

This commit is contained in:
UnknownShadow200 2021-07-16 11:43:19 +10:00
parent d8bee2e32c
commit f7ffad8ee3
2 changed files with 14 additions and 11 deletions

View File

@ -120,8 +120,9 @@ static EGLConfig ctx_config;
static EGLint ctx_numConfig; static EGLint ctx_numConfig;
static void GLContext_InitSurface(void) { static void GLContext_InitSurface(void) {
if (!win_handle) return; /* window not created or lost */ void* window = WindowInfo.Handle;
ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, win_handle, NULL); if (!window) return; /* window not created or lost */
ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, window, NULL);
if (!ctx_surface) return; if (!ctx_surface) return;
eglMakeCurrent(ctx_display, ctx_surface, ctx_surface, ctx_context); eglMakeCurrent(ctx_display, ctx_surface, ctx_surface, ctx_context);

View File

@ -1,5 +1,6 @@
#include "_WindowBase.h" #include "_WindowBase.h"
#include "ExtMath.h" #include "ExtMath.h"
#include "Funcs.h"
#include "Bitmap.h" #include "Bitmap.h"
#include "String.h" #include "String.h"
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
@ -119,6 +120,14 @@ void Clipboard_SetText(const cc_string* value) {
[pasteboard setString:str forType:NSStringPboardType]; [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--------------------------------------------------------* *----------------------------------------------------------Wwindow--------------------------------------------------------*
@ -209,7 +218,6 @@ static void DoDrawFramebuffer(CGRect dirty);
} }
@end @end
static void MakeContentView(void) { static void MakeContentView(void) {
NSRect rect; NSRect rect;
NSView* view; NSView* view;
@ -222,14 +230,6 @@ static void MakeContentView(void) {
[winHandle setContentView:viewHandle]; [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 #ifdef CC_BUILD_ICON
extern const int CCIcon_Data[]; extern const int CCIcon_Data[];
extern const int CCIcon_Width, CCIcon_Height; extern const int CCIcon_Width, CCIcon_Height;
@ -279,6 +279,7 @@ void Window_Create(int width, int height) {
Window_CommonCreate(); Window_CommonCreate();
WindowInfo.Exists = true; WindowInfo.Exists = true;
WindowInfo.Handle = winHandle;
del = [CCWindowDelegate alloc]; del = [CCWindowDelegate alloc];
[winHandle setDelegate:del]; [winHandle setDelegate:del];
@ -391,6 +392,7 @@ void Window_ProcessEvents(void) {
int key, type, steps, x, y; int key, type, steps, x, y;
CGFloat dx, dy; CGFloat dx, dy;
// https://wiki.freepascal.org/Cocoa_Internals/Application
[pool release]; [pool release];
pool = [[NSAutoreleasePool alloc] init]; pool = [[NSAutoreleasePool alloc] init];