Fixed Cocoa and OpenGL builds
authorSam Lantinga <slouken@libsdl.org>
Thu, 21 Jan 2010 07:28:01 +0000
changeset 3688 6512cba48440
parent 3687 8e5186a99af4
child 3689 af25b5586af7
Fixed Cocoa and OpenGL builds
src/video/SDL_renderer_gles.c
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/SDL_renderer_gles.c	Thu Jan 21 07:22:11 2010 +0000
+++ b/src/video/SDL_renderer_gles.c	Thu Jan 21 07:28:01 2010 +0000
@@ -255,7 +255,7 @@
     renderer->DestroyTexture = GLES_DestroyTexture;
     renderer->DestroyRenderer = GLES_DestroyRenderer;
     renderer->info = GL_ES_RenderDriver.info;
-    renderer->window = window->id;
+    renderer->window = window;
     renderer->driverdata = data;
 
     renderer->info.flags =
@@ -276,12 +276,12 @@
         return NULL;
     }
 
-    data->context = SDL_GL_CreateContext(window->id);
+    data->context = SDL_GL_CreateContext(window);
     if (!data->context) {
         GLES_DestroyRenderer(renderer);
         return NULL;
     }
-    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
+    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
         GLES_DestroyRenderer(renderer);
         return NULL;
     }
@@ -334,7 +334,7 @@
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     SDL_Window *window = renderer->window;
 
-    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
+    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
         return -1;
     }
     if (data->updateSize) {
--- a/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 07:22:11 2010 +0000
+++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 07:28:01 2010 +0000
@@ -212,7 +212,7 @@
         if (window->flags & SDL_WINDOW_FULLSCREEN) {
             [nscontext setFullScreen];
         } else {
-            [nscontext setView:[windowdata->window contentView]];
+            [nscontext setView:[windowdata->nswindow contentView]];
             [nscontext update];
         }
         [nscontext makeCurrentContext];
--- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:22:11 2010 +0000
+++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:28:01 2010 +0000
@@ -44,22 +44,22 @@
 
     center = [NSNotificationCenter defaultCenter];
 
-    [_data->window setNextResponder:self];
-    if ([_data->window delegate] != nil) {
-        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->window];
-        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->window];
+    [_data->nswindow setNextResponder:self];
+    if ([_data->nswindow delegate] != nil) {
+        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
+        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->nswindow];
     } else {
-        [_data->window setDelegate:self];
+        [_data->nswindow setDelegate:self];
     }
     [center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
     [center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];
 
-    [_data->window setAcceptsMouseMovedEvents:YES];
+    [_data->nswindow setAcceptsMouseMovedEvents:YES];
 }
 
 - (void)close
@@ -68,17 +68,17 @@
 
     center = [NSNotificationCenter defaultCenter];
 
-    [_data->window setNextResponder:nil];
-    if ([_data->window delegate] != self) {
-        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->window];
-        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->window];
+    [_data->nswindow setNextResponder:nil];
+    if ([_data->nswindow delegate] != self) {
+        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
+        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->nswindow];
     } else {
-        [_data->window setDelegate:nil];
+        [_data->nswindow setDelegate:nil];
     }
     [center removeObserver:self name:NSApplicationDidHideNotification object:NSApp];
     [center removeObserver:self name:NSApplicationDidUnhideNotification object:NSApp];
@@ -98,7 +98,7 @@
 - (void)windowDidMove:(NSNotification *)aNotification
 {
     int x, y;
-    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
+    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
     ConvertNSRect(&rect);
     x = (int)rect.origin.x;
     y = (int)rect.origin.y;
@@ -108,7 +108,7 @@
 - (void)windowDidResize:(NSNotification *)aNotification
 {
     int w, h;
-    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
+    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
     w = (int)rect.size.width;
     h = (int)rect.size.height;
     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
@@ -309,7 +309,7 @@
         return -1;
     }
     data->window = window;
-    data->window = nswindow;
+    data->nswindow = nswindow;
     data->created = created;
     data->display = displaydata->display;
     data->videodata = videodata;
@@ -471,7 +471,7 @@
 Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
     NSString *string;
 
     if(window->title) {
@@ -489,7 +489,7 @@
 Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
     SDL_VideoDisplay *display = window->display;
     NSRect rect;
     SDL_Rect bounds;
@@ -519,7 +519,7 @@
 Cocoa_SetWindowSize(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
     NSSize size;
 
     size.width = window->w;
@@ -532,7 +532,7 @@
 Cocoa_ShowWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     if (![nswindow isMiniaturized]) {
         [nswindow makeKeyAndOrderFront:nil];
@@ -544,7 +544,7 @@
 Cocoa_HideWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     [nswindow orderOut:nil];
     [pool release];
@@ -554,7 +554,7 @@
 Cocoa_RaiseWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     [nswindow makeKeyAndOrderFront:nil];
     [pool release];
@@ -564,7 +564,7 @@
 Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     [nswindow zoom:nil];
     [pool release];
@@ -574,7 +574,7 @@
 Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     [nswindow miniaturize:nil];
     [pool release];
@@ -584,7 +584,7 @@
 Cocoa_RestoreWindow(_THIS, SDL_Window * window)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     if ([nswindow isMiniaturized]) {
         [nswindow deminiaturize:nil];
@@ -615,7 +615,7 @@
         [data->listener close];
         [data->listener release];
         if (data->created) {
-            [data->window close];
+            [data->nswindow close];
         }
         SDL_free(data);
     }
@@ -625,7 +625,7 @@
 SDL_bool
 Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
 {
-    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
 
     if (info->version.major <= SDL_MAJOR_VERSION) {
         //info->window = nswindow;