src/video/cocoa/SDL_cocoawindow.m
changeset 3688 6512cba48440
parent 3685 64ce267332c6
child 4465 3e69e077cb95
child 4811 d79939f20c45
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:22:11 2010 +0000
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 07:28:01 2010 +0000
     1.3 @@ -44,22 +44,22 @@
     1.4  
     1.5      center = [NSNotificationCenter defaultCenter];
     1.6  
     1.7 -    [_data->window setNextResponder:self];
     1.8 -    if ([_data->window delegate] != nil) {
     1.9 -        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->window];
    1.10 -        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->window];
    1.11 -        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->window];
    1.12 -        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->window];
    1.13 -        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->window];
    1.14 -        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->window];
    1.15 -        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->window];
    1.16 +    [_data->nswindow setNextResponder:self];
    1.17 +    if ([_data->nswindow delegate] != nil) {
    1.18 +        [center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->nswindow];
    1.19 +        [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->nswindow];
    1.20 +        [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->nswindow];
    1.21 +        [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
    1.22 +        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
    1.23 +        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
    1.24 +        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->nswindow];
    1.25      } else {
    1.26 -        [_data->window setDelegate:self];
    1.27 +        [_data->nswindow setDelegate:self];
    1.28      }
    1.29      [center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
    1.30      [center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];
    1.31  
    1.32 -    [_data->window setAcceptsMouseMovedEvents:YES];
    1.33 +    [_data->nswindow setAcceptsMouseMovedEvents:YES];
    1.34  }
    1.35  
    1.36  - (void)close
    1.37 @@ -68,17 +68,17 @@
    1.38  
    1.39      center = [NSNotificationCenter defaultCenter];
    1.40  
    1.41 -    [_data->window setNextResponder:nil];
    1.42 -    if ([_data->window delegate] != self) {
    1.43 -        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->window];
    1.44 -        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->window];
    1.45 -        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->window];
    1.46 -        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->window];
    1.47 -        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->window];
    1.48 -        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->window];
    1.49 -        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->window];
    1.50 +    [_data->nswindow setNextResponder:nil];
    1.51 +    if ([_data->nswindow delegate] != self) {
    1.52 +        [center removeObserver:self name:NSWindowDidExposeNotification object:_data->nswindow];
    1.53 +        [center removeObserver:self name:NSWindowDidMoveNotification object:_data->nswindow];
    1.54 +        [center removeObserver:self name:NSWindowDidResizeNotification object:_data->nswindow];
    1.55 +        [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
    1.56 +        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
    1.57 +        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
    1.58 +        [center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->nswindow];
    1.59      } else {
    1.60 -        [_data->window setDelegate:nil];
    1.61 +        [_data->nswindow setDelegate:nil];
    1.62      }
    1.63      [center removeObserver:self name:NSApplicationDidHideNotification object:NSApp];
    1.64      [center removeObserver:self name:NSApplicationDidUnhideNotification object:NSApp];
    1.65 @@ -98,7 +98,7 @@
    1.66  - (void)windowDidMove:(NSNotification *)aNotification
    1.67  {
    1.68      int x, y;
    1.69 -    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
    1.70 +    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
    1.71      ConvertNSRect(&rect);
    1.72      x = (int)rect.origin.x;
    1.73      y = (int)rect.origin.y;
    1.74 @@ -108,7 +108,7 @@
    1.75  - (void)windowDidResize:(NSNotification *)aNotification
    1.76  {
    1.77      int w, h;
    1.78 -    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
    1.79 +    NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
    1.80      w = (int)rect.size.width;
    1.81      h = (int)rect.size.height;
    1.82      SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
    1.83 @@ -309,7 +309,7 @@
    1.84          return -1;
    1.85      }
    1.86      data->window = window;
    1.87 -    data->window = nswindow;
    1.88 +    data->nswindow = nswindow;
    1.89      data->created = created;
    1.90      data->display = displaydata->display;
    1.91      data->videodata = videodata;
    1.92 @@ -471,7 +471,7 @@
    1.93  Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
    1.94  {
    1.95      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    1.96 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
    1.97 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    1.98      NSString *string;
    1.99  
   1.100      if(window->title) {
   1.101 @@ -489,7 +489,7 @@
   1.102  Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
   1.103  {
   1.104      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.105 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.106 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.107      SDL_VideoDisplay *display = window->display;
   1.108      NSRect rect;
   1.109      SDL_Rect bounds;
   1.110 @@ -519,7 +519,7 @@
   1.111  Cocoa_SetWindowSize(_THIS, SDL_Window * window)
   1.112  {
   1.113      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.114 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.115 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.116      NSSize size;
   1.117  
   1.118      size.width = window->w;
   1.119 @@ -532,7 +532,7 @@
   1.120  Cocoa_ShowWindow(_THIS, SDL_Window * window)
   1.121  {
   1.122      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.123 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.124 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.125  
   1.126      if (![nswindow isMiniaturized]) {
   1.127          [nswindow makeKeyAndOrderFront:nil];
   1.128 @@ -544,7 +544,7 @@
   1.129  Cocoa_HideWindow(_THIS, SDL_Window * window)
   1.130  {
   1.131      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.132 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.133 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.134  
   1.135      [nswindow orderOut:nil];
   1.136      [pool release];
   1.137 @@ -554,7 +554,7 @@
   1.138  Cocoa_RaiseWindow(_THIS, SDL_Window * window)
   1.139  {
   1.140      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.141 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.142 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.143  
   1.144      [nswindow makeKeyAndOrderFront:nil];
   1.145      [pool release];
   1.146 @@ -564,7 +564,7 @@
   1.147  Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
   1.148  {
   1.149      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.150 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.151 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.152  
   1.153      [nswindow zoom:nil];
   1.154      [pool release];
   1.155 @@ -574,7 +574,7 @@
   1.156  Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
   1.157  {
   1.158      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.159 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.160 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.161  
   1.162      [nswindow miniaturize:nil];
   1.163      [pool release];
   1.164 @@ -584,7 +584,7 @@
   1.165  Cocoa_RestoreWindow(_THIS, SDL_Window * window)
   1.166  {
   1.167      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.168 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.169 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.170  
   1.171      if ([nswindow isMiniaturized]) {
   1.172          [nswindow deminiaturize:nil];
   1.173 @@ -615,7 +615,7 @@
   1.174          [data->listener close];
   1.175          [data->listener release];
   1.176          if (data->created) {
   1.177 -            [data->window close];
   1.178 +            [data->nswindow close];
   1.179          }
   1.180          SDL_free(data);
   1.181      }
   1.182 @@ -625,7 +625,7 @@
   1.183  SDL_bool
   1.184  Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
   1.185  {
   1.186 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.187 +    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
   1.188  
   1.189      if (info->version.major <= SDL_MAJOR_VERSION) {
   1.190          //info->window = nswindow;