mirror of https://github.com/encounter/SDL.git
Replaced all remaining uses of NSAutoreleasePool with @autoreleasepool blocks (bugzilla #2680.)
This commit is contained in:
parent
6c20b68257
commit
4fc4026660
|
@ -150,8 +150,8 @@ Cocoa_GL_UnloadLibrary(_THIS)
|
||||||
|
|
||||||
SDL_GLContext
|
SDL_GLContext
|
||||||
Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
||||||
SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
|
SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
|
||||||
|
@ -173,8 +173,6 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
/* specify a profile if we're on Lion (10.7) or later. */
|
/* specify a profile if we're on Lion (10.7) or later. */
|
||||||
if (lion_or_later) {
|
if (lion_or_later) {
|
||||||
NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
|
NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
|
||||||
|
@ -239,7 +237,6 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||||
if (fmt == nil) {
|
if (fmt == nil) {
|
||||||
SDL_SetError("Failed creating OpenGL pixel format");
|
SDL_SetError("Failed creating OpenGL pixel format");
|
||||||
[pool release];
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,12 +250,9 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
|
|
||||||
if (context == nil) {
|
if (context == nil) {
|
||||||
SDL_SetError("Failed creating OpenGL context");
|
SDL_SetError("Failed creating OpenGL context");
|
||||||
[pool release];
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
|
if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
|
||||||
Cocoa_GL_DeleteContext(_this, context);
|
Cocoa_GL_DeleteContext(_this, context);
|
||||||
SDL_SetError("Failed making OpenGL context current");
|
SDL_SetError("Failed making OpenGL context current");
|
||||||
|
@ -306,15 +300,12 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
/*_this->gl_config.minor_version = glversion_minor;*/
|
/*_this->gl_config.minor_version = glversion_minor;*/
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
|
SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
|
||||||
[nscontext setWindow:window];
|
[nscontext setWindow:window];
|
||||||
|
@ -324,9 +315,8 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}}
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
||||||
|
@ -352,8 +342,8 @@ Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
NSOpenGLContext *nscontext;
|
NSOpenGLContext *nscontext;
|
||||||
GLint value;
|
GLint value;
|
||||||
int status;
|
int status;
|
||||||
|
@ -362,8 +352,6 @@ Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
||||||
return SDL_SetError("Late swap tearing currently unsupported");
|
return SDL_SetError("Late swap tearing currently unsupported");
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
|
nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
|
||||||
if (nscontext != nil) {
|
if (nscontext != nil) {
|
||||||
value = interval;
|
value = interval;
|
||||||
|
@ -373,57 +361,44 @@ Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
||||||
status = SDL_SetError("No current OpenGL context");
|
status = SDL_SetError("No current OpenGL context");
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_GL_GetSwapInterval(_THIS)
|
Cocoa_GL_GetSwapInterval(_THIS)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
NSOpenGLContext *nscontext;
|
NSOpenGLContext *nscontext;
|
||||||
GLint value;
|
GLint value;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
|
nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
|
||||||
if (nscontext != nil) {
|
if (nscontext != nil) {
|
||||||
[nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval];
|
[nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||||
status = (int)value;
|
status = (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}}
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
|
Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext();
|
SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext();
|
||||||
[nscontext flushBuffer];
|
[nscontext flushBuffer];
|
||||||
[nscontext updateIfNeeded];
|
[nscontext updateIfNeeded];
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
|
Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
|
SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
[nscontext setWindow:NULL];
|
[nscontext setWindow:NULL];
|
||||||
[nscontext release];
|
[nscontext release];
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_OPENGL_CGL */
|
#endif /* SDL_VIDEO_OPENGL_CGL */
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,11 @@ ConvertRects(SDL_ShapeTree* tree, void* closure)
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
|
Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
|
SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
|
||||||
SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
|
SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
|
||||||
SDL_CocoaClosure closure;
|
SDL_CocoaClosure closure;
|
||||||
NSAutoreleasePool *pool = NULL;
|
|
||||||
if(data->saved == SDL_TRUE) {
|
if(data->saved == SDL_TRUE) {
|
||||||
[data->context restoreGraphicsState];
|
[data->context restoreGraphicsState];
|
||||||
data->saved = SDL_FALSE;
|
data->saved = SDL_FALSE;
|
||||||
|
@ -93,16 +93,14 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowSha
|
||||||
NSRectFill([[windata->nswindow contentView] frame]);
|
NSRectFill([[windata->nswindow contentView] frame]);
|
||||||
data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
|
data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
closure.view = [windata->nswindow contentView];
|
closure.view = [windata->nswindow contentView];
|
||||||
closure.path = [NSBezierPath bezierPath];
|
closure.path = [NSBezierPath bezierPath];
|
||||||
closure.window = shaper->window;
|
closure.window = shaper->window;
|
||||||
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
|
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
|
||||||
[closure.path addClip];
|
[closure.path addClip];
|
||||||
[pool release];
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_ResizeWindowShape(SDL_Window *window)
|
Cocoa_ResizeWindowShape(SDL_Window *window)
|
||||||
|
|
|
@ -1000,8 +1000,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created)
|
SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
|
@ -1016,8 +1016,6 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
|
||||||
data->videodata = videodata;
|
data->videodata = videodata;
|
||||||
data->nscontexts = [[NSMutableArray alloc] init];
|
data->nscontexts = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
/* Create an event listener for the window */
|
/* Create an event listener for the window */
|
||||||
data->listener = [[Cocoa_WindowListener alloc] init];
|
data->listener = [[Cocoa_WindowListener alloc] init];
|
||||||
|
|
||||||
|
@ -1079,16 +1077,15 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
|
||||||
[nswindow setOneShot:NO];
|
[nswindow setOneShot:NO];
|
||||||
|
|
||||||
/* All done! */
|
/* All done! */
|
||||||
[pool release];
|
|
||||||
window->driverdata = data;
|
window->driverdata = data;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_CreateWindow(_THIS, SDL_Window * window)
|
Cocoa_CreateWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSWindow *nswindow;
|
NSWindow *nswindow;
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
@ -1123,9 +1120,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
|
||||||
nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
|
nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
|
||||||
}
|
}
|
||||||
@catch (NSException *e) {
|
@catch (NSException *e) {
|
||||||
SDL_SetError("%s", [[e reason] UTF8String]);
|
return SDL_SetError("%s", [[e reason] UTF8String]);
|
||||||
[pool release];
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
[nswindow setBackgroundColor:[NSColor blackColor]];
|
[nswindow setBackgroundColor:[NSColor blackColor]];
|
||||||
|
|
||||||
|
@ -1155,63 +1150,54 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
|
||||||
/* Allow files and folders to be dragged onto the window by users */
|
/* Allow files and folders to be dragged onto the window by users */
|
||||||
[nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
|
[nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
|
if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
|
||||||
[nswindow release];
|
[nswindow release];
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
|
||||||
NSWindow *nswindow = (NSWindow *) data;
|
NSWindow *nswindow = (NSWindow *) data;
|
||||||
NSString *title;
|
NSString *title;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
/* Query the title from the existing window */
|
/* Query the title from the existing window */
|
||||||
title = [nswindow title];
|
title = [nswindow title];
|
||||||
if (title) {
|
if (title) {
|
||||||
window->title = SDL_strdup([title UTF8String]);
|
window->title = SDL_strdup([title UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
return SetupWindowData(_this, window, nswindow, SDL_FALSE);
|
return SetupWindowData(_this, window, nswindow, SDL_FALSE);
|
||||||
}
|
}}
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
|
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
NSString *string = [[NSString alloc] initWithUTF8String:window->title];
|
NSString *string = [[NSString alloc] initWithUTF8String:window->title];
|
||||||
[nswindow setTitle:string];
|
[nswindow setTitle:string];
|
||||||
[string release];
|
[string release];
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
|
Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSImage *nsimage = Cocoa_CreateImage(icon);
|
NSImage *nsimage = Cocoa_CreateImage(icon);
|
||||||
|
|
||||||
if (nsimage) {
|
if (nsimage) {
|
||||||
[NSApp setApplicationIconImage:nsimage];
|
[NSApp setApplicationIconImage:nsimage];
|
||||||
}
|
}
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
|
Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = windata->nswindow;
|
NSWindow *nswindow = windata->nswindow;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
@ -1229,14 +1215,12 @@ Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
|
||||||
s_moveHack = moveHack;
|
s_moveHack = moveHack;
|
||||||
|
|
||||||
ScheduleContextUpdates(windata);
|
ScheduleContextUpdates(windata);
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowSize(_THIS, SDL_Window * window)
|
Cocoa_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = windata->nswindow;
|
NSWindow *nswindow = windata->nswindow;
|
||||||
NSSize size;
|
NSSize size;
|
||||||
|
@ -1246,14 +1230,12 @@ Cocoa_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
[nswindow setContentSize:size];
|
[nswindow setContentSize:size];
|
||||||
|
|
||||||
ScheduleContextUpdates(windata);
|
ScheduleContextUpdates(windata);
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window)
|
Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
NSSize minSize;
|
NSSize minSize;
|
||||||
|
@ -1261,14 +1243,12 @@ Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window)
|
||||||
minSize.height = window->min_h;
|
minSize.height = window->min_h;
|
||||||
|
|
||||||
[windata->nswindow setContentMinSize:minSize];
|
[windata->nswindow setContentMinSize:minSize];
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
|
Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
NSSize maxSize;
|
NSSize maxSize;
|
||||||
|
@ -1276,14 +1256,12 @@ Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
|
||||||
maxSize.height = window->max_h;
|
maxSize.height = window->max_h;
|
||||||
|
|
||||||
[windata->nswindow setContentMaxSize:maxSize];
|
[windata->nswindow setContentMaxSize:maxSize];
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_ShowWindow(_THIS, SDL_Window * window)
|
Cocoa_ShowWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
|
SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
|
||||||
NSWindow *nswindow = windowData->nswindow;
|
NSWindow *nswindow = windowData->nswindow;
|
||||||
|
|
||||||
|
@ -1292,23 +1270,21 @@ Cocoa_ShowWindow(_THIS, SDL_Window * window)
|
||||||
[nswindow makeKeyAndOrderFront:nil];
|
[nswindow makeKeyAndOrderFront:nil];
|
||||||
[windowData->listener resumeVisibleObservation];
|
[windowData->listener resumeVisibleObservation];
|
||||||
}
|
}
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_HideWindow(_THIS, SDL_Window * window)
|
Cocoa_HideWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
|
|
||||||
[nswindow orderOut:nil];
|
[nswindow orderOut:nil];
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_RaiseWindow(_THIS, SDL_Window * window)
|
Cocoa_RaiseWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
|
SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
|
||||||
NSWindow *nswindow = windowData->nswindow;
|
NSWindow *nswindow = windowData->nswindow;
|
||||||
|
|
||||||
|
@ -1321,28 +1297,24 @@ Cocoa_RaiseWindow(_THIS, SDL_Window * window)
|
||||||
[nswindow makeKeyAndOrderFront:nil];
|
[nswindow makeKeyAndOrderFront:nil];
|
||||||
}
|
}
|
||||||
[windowData->listener resumeVisibleObservation];
|
[windowData->listener resumeVisibleObservation];
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
|
Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = windata->nswindow;
|
NSWindow *nswindow = windata->nswindow;
|
||||||
|
|
||||||
[nswindow zoom:nil];
|
[nswindow zoom:nil];
|
||||||
|
|
||||||
ScheduleContextUpdates(windata);
|
ScheduleContextUpdates(windata);
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
|
Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = data->nswindow;
|
NSWindow *nswindow = data->nswindow;
|
||||||
|
|
||||||
|
@ -1351,13 +1323,12 @@ Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
|
||||||
} else {
|
} else {
|
||||||
[nswindow miniaturize:nil];
|
[nswindow miniaturize:nil];
|
||||||
}
|
}
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_RestoreWindow(_THIS, SDL_Window * window)
|
Cocoa_RestoreWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
|
|
||||||
if ([nswindow isMiniaturized]) {
|
if ([nswindow isMiniaturized]) {
|
||||||
|
@ -1365,8 +1336,7 @@ Cocoa_RestoreWindow(_THIS, SDL_Window * window)
|
||||||
} else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
|
} else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
|
||||||
[nswindow zoom:nil];
|
[nswindow zoom:nil];
|
||||||
}
|
}
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
static NSWindow *
|
static NSWindow *
|
||||||
Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
|
Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
|
||||||
|
@ -1391,21 +1361,20 @@ Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
if (SetWindowStyle(window, GetWindowStyle(window))) {
|
if (SetWindowStyle(window, GetWindowStyle(window))) {
|
||||||
if (bordered) {
|
if (bordered) {
|
||||||
Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
|
Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[pool release];
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
|
Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = data->nswindow;
|
NSWindow *nswindow = data->nswindow;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
@ -1479,9 +1448,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleContextUpdates(data);
|
ScheduleContextUpdates(data);
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
|
Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
|
||||||
|
@ -1564,8 +1531,8 @@ Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_DestroyWindow(_THIS, SDL_Window * window)
|
Cocoa_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -1585,9 +1552,7 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
}
|
}
|
||||||
window->driverdata = NULL;
|
window->driverdata = NULL;
|
||||||
|
}}
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_bool
|
SDL_bool
|
||||||
Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
|
Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
|
||||||
|
@ -1619,9 +1584,9 @@ Cocoa_IsWindowInFullscreenSpace(SDL_Window * window)
|
||||||
|
|
||||||
SDL_bool
|
SDL_bool
|
||||||
Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state)
|
Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state)
|
||||||
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
SDL_bool succeeded = SDL_FALSE;
|
SDL_bool succeeded = SDL_FALSE;
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
if ([data->listener setFullscreenSpace:(state ? YES : NO)]) {
|
if ([data->listener setFullscreenSpace:(state ? YES : NO)]) {
|
||||||
|
@ -1642,10 +1607,8 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
return succeeded;
|
return succeeded;
|
||||||
}
|
}}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)
|
Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)
|
||||||
|
|
Loading…
Reference in New Issue