Fixed Cocoa and OpenGL builds
authorSam Lantinga <slouken@libsdl.org>
Thu, 21 Jan 2010 07:28:01 +0000
changeset 36886512cba48440
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
     1.1 --- a/src/video/SDL_renderer_gles.c	Thu Jan 21 07:22:11 2010 +0000
     1.2 +++ b/src/video/SDL_renderer_gles.c	Thu Jan 21 07:28:01 2010 +0000
     1.3 @@ -255,7 +255,7 @@
     1.4      renderer->DestroyTexture = GLES_DestroyTexture;
     1.5      renderer->DestroyRenderer = GLES_DestroyRenderer;
     1.6      renderer->info = GL_ES_RenderDriver.info;
     1.7 -    renderer->window = window->id;
     1.8 +    renderer->window = window;
     1.9      renderer->driverdata = data;
    1.10  
    1.11      renderer->info.flags =
    1.12 @@ -276,12 +276,12 @@
    1.13          return NULL;
    1.14      }
    1.15  
    1.16 -    data->context = SDL_GL_CreateContext(window->id);
    1.17 +    data->context = SDL_GL_CreateContext(window);
    1.18      if (!data->context) {
    1.19          GLES_DestroyRenderer(renderer);
    1.20          return NULL;
    1.21      }
    1.22 -    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
    1.23 +    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
    1.24          GLES_DestroyRenderer(renderer);
    1.25          return NULL;
    1.26      }
    1.27 @@ -334,7 +334,7 @@
    1.28      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    1.29      SDL_Window *window = renderer->window;
    1.30  
    1.31 -    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
    1.32 +    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
    1.33          return -1;
    1.34      }
    1.35      if (data->updateSize) {
     2.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 07:22:11 2010 +0000
     2.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 07:28:01 2010 +0000
     2.3 @@ -212,7 +212,7 @@
     2.4          if (window->flags & SDL_WINDOW_FULLSCREEN) {
     2.5              [nscontext setFullScreen];
     2.6          } else {
     2.7 -            [nscontext setView:[windowdata->window contentView]];
     2.8 +            [nscontext setView:[windowdata->nswindow contentView]];
     2.9              [nscontext update];
    2.10          }
    2.11          [nscontext makeCurrentContext];
     3.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:22:11 2010 +0000
     3.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:28:01 2010 +0000
     3.3 @@ -44,22 +44,22 @@
     3.4  
     3.5      center = [NSNotificationCenter defaultCenter];
     3.6  
     3.7 -    [_data->window setNextResponder:self];
     3.8 -    if ([_data->window delegate] != nil) {
     3.9 -        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->window];
    3.10 -        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->window];
    3.11 -        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->window];
    3.12 -        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->window];
    3.13 -        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->window];
    3.14 -        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->window];
    3.15 -        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->window];
    3.16 +    [_data->nswindow setNextResponder:self];
    3.17 +    if ([_data->nswindow delegate] != nil) {
    3.18 +        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->nswindow];
    3.19 +        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->nswindow];
    3.20 +        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->nswindow];
    3.21 +        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
    3.22 +        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
    3.23 +        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
    3.24 +        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->nswindow];
    3.25      } else {
    3.26 -        [_data->window setDelegate:self];
    3.27 +        [_data->nswindow setDelegate:self];
    3.28      }
    3.29      [center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
    3.30      [center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];
    3.31  
    3.32 -    [_data->window setAcceptsMouseMovedEvents:YES];
    3.33 +    [_data->nswindow setAcceptsMouseMovedEvents:YES];
    3.34  }
    3.35  
    3.36  - (void)close
    3.37 @@ -68,17 +68,17 @@
    3.38  
    3.39      center = [NSNotificationCenter defaultCenter];
    3.40  
    3.41 -    [_data->window setNextResponder:nil];
    3.42 -    if ([_data->window delegate] != self) {
    3.43 -        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->window];
    3.44 -        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->window];
    3.45 -        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->window];
    3.46 -        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->window];
    3.47 -        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->window];
    3.48 -        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->window];
    3.49 -        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->window];
    3.50 +    [_data->nswindow setNextResponder:nil];
    3.51 +    if ([_data->nswindow delegate] != self) {
    3.52 +        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->nswindow];
    3.53 +        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->nswindow];
    3.54 +        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->nswindow];
    3.55 +        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
    3.56 +        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
    3.57 +        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
    3.58 +        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->nswindow];
    3.59      } else {
    3.60 -        [_data->window setDelegate:nil];
    3.61 +        [_data->nswindow setDelegate:nil];
    3.62      }
    3.63      [center removeObserver:self name:NSApplicationDidHideNotification object:NSApp];
    3.64      [center removeObserver:self name:NSApplicationDidUnhideNotification object:NSApp];
    3.65 @@ -98,7 +98,7 @@
    3.66  - (void)windowDidMove:(NSNotification *)aNotification
    3.67  {
    3.68      int x, y;
    3.69 -    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
    3.70 +    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
    3.71      ConvertNSRect(&rect);
    3.72      x = (int)rect.origin.x;
    3.73      y = (int)rect.origin.y;
    3.74 @@ -108,7 +108,7 @@
    3.75  - (void)windowDidResize:(NSNotification *)aNotification
    3.76  {
    3.77      int w, h;
    3.78 -    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
    3.79 +    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
    3.80      w = (int)rect.size.width;
    3.81      h = (int)rect.size.height;
    3.82      SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
    3.83 @@ -309,7 +309,7 @@
    3.84          return -1;
    3.85      }
    3.86      data->window = window;
    3.87 -    data->window = nswindow;
    3.88 +    data->nswindow = nswindow;
    3.89      data->created = created;
    3.90      data->display = displaydata->display;
    3.91      data->videodata = videodata;
    3.92 @@ -471,7 +471,7 @@
    3.93  Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
    3.94  {
    3.95      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    3.96 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
    3.97 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    3.98      NSString *string;
    3.99  
   3.100      if(window->title) {
   3.101 @@ -489,7 +489,7 @@
   3.102  Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
   3.103  {
   3.104      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.105 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.106 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.107      SDL_VideoDisplay *display = window->display;
   3.108      NSRect rect;
   3.109      SDL_Rect bounds;
   3.110 @@ -519,7 +519,7 @@
   3.111  Cocoa_SetWindowSize(_THIS, SDL_Window * window)
   3.112  {
   3.113      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.114 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.115 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.116      NSSize size;
   3.117  
   3.118      size.width = window->w;
   3.119 @@ -532,7 +532,7 @@
   3.120  Cocoa_ShowWindow(_THIS, SDL_Window * window)
   3.121  {
   3.122      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.123 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.124 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.125  
   3.126      if (![nswindow isMiniaturized]) {
   3.127          [nswindow makeKeyAndOrderFront:nil];
   3.128 @@ -544,7 +544,7 @@
   3.129  Cocoa_HideWindow(_THIS, SDL_Window * window)
   3.130  {
   3.131      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.132 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.133 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.134  
   3.135      [nswindow orderOut:nil];
   3.136      [pool release];
   3.137 @@ -554,7 +554,7 @@
   3.138  Cocoa_RaiseWindow(_THIS, SDL_Window * window)
   3.139  {
   3.140      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.141 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.142 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.143  
   3.144      [nswindow makeKeyAndOrderFront:nil];
   3.145      [pool release];
   3.146 @@ -564,7 +564,7 @@
   3.147  Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
   3.148  {
   3.149      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.150 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.151 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.152  
   3.153      [nswindow zoom:nil];
   3.154      [pool release];
   3.155 @@ -574,7 +574,7 @@
   3.156  Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
   3.157  {
   3.158      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.159 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.160 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.161  
   3.162      [nswindow miniaturize:nil];
   3.163      [pool release];
   3.164 @@ -584,7 +584,7 @@
   3.165  Cocoa_RestoreWindow(_THIS, SDL_Window * window)
   3.166  {
   3.167      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   3.168 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.169 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.170  
   3.171      if ([nswindow isMiniaturized]) {
   3.172          [nswindow deminiaturize:nil];
   3.173 @@ -615,7 +615,7 @@
   3.174          [data->listener close];
   3.175          [data->listener release];
   3.176          if (data->created) {
   3.177 -            [data->window close];
   3.178 +            [data->nswindow close];
   3.179          }
   3.180          SDL_free(data);
   3.181      }
   3.182 @@ -625,7 +625,7 @@
   3.183  SDL_bool
   3.184  Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
   3.185  {
   3.186 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   3.187 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   3.188  
   3.189      if (info->version.major <= SDL_MAJOR_VERSION) {
   3.190          //info->window = nswindow;