src/video/cocoa/SDL_cocoawindow.m
changeset 3685 64ce267332c6
parent 3530 e96be66e3673
child 3688 6512cba48440
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 05:49:41 2010 +0000
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 06:21:52 2010 +0000
     1.3 @@ -86,13 +86,13 @@
     1.4  
     1.5  - (BOOL)windowShouldClose:(id)sender
     1.6  {
     1.7 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0);
     1.8 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
     1.9      return NO;
    1.10  }
    1.11  
    1.12  - (void)windowDidExpose:(NSNotification *)aNotification
    1.13  {
    1.14 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, 0);
    1.15 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
    1.16  }
    1.17  
    1.18  - (void)windowDidMove:(NSNotification *)aNotification
    1.19 @@ -102,7 +102,7 @@
    1.20      ConvertNSRect(&rect);
    1.21      x = (int)rect.origin.x;
    1.22      y = (int)rect.origin.y;
    1.23 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MOVED, x, y);
    1.24 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y);
    1.25  }
    1.26  
    1.27  - (void)windowDidResize:(NSNotification *)aNotification
    1.28 @@ -111,17 +111,17 @@
    1.29      NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
    1.30      w = (int)rect.size.width;
    1.31      h = (int)rect.size.height;
    1.32 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESIZED, w, h);
    1.33 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
    1.34  }
    1.35  
    1.36  - (void)windowDidMiniaturize:(NSNotification *)aNotification
    1.37  {
    1.38 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.39 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.40  }
    1.41  
    1.42  - (void)windowDidDeminiaturize:(NSNotification *)aNotification
    1.43  {
    1.44 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.45 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.46  }
    1.47  
    1.48  - (void)windowDidBecomeKey:(NSNotification *)aNotification
    1.49 @@ -130,7 +130,7 @@
    1.50  
    1.51      /* We're going to get keyboard events, since we're key. */
    1.52      index = _data->videodata->keyboard;
    1.53 -    SDL_SetKeyboardFocus(index, _data->windowID);
    1.54 +    SDL_SetKeyboardFocus(index, _data->window);
    1.55  }
    1.56  
    1.57  - (void)windowDidResignKey:(NSNotification *)aNotification
    1.58 @@ -141,7 +141,7 @@
    1.59      /* Some other window will get mouse events, since we're not key. */
    1.60      index = _data->videodata->mouse;
    1.61      mouse = SDL_GetMouse(index);
    1.62 -    if (mouse->focus == _data->windowID) {
    1.63 +    if (mouse->focus == _data->window) {
    1.64          SDL_SetMouseFocus(index, 0);
    1.65      }
    1.66  
    1.67 @@ -152,12 +152,12 @@
    1.68  
    1.69  - (void)windowDidHide:(NSNotification *)aNotification
    1.70  {
    1.71 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0);
    1.72 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
    1.73  }
    1.74  
    1.75  - (void)windowDidUnhide:(NSNotification *)aNotification
    1.76  {
    1.77 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0);
    1.78 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
    1.79  }
    1.80  
    1.81  - (void)mouseDown:(NSEvent *)theEvent
    1.82 @@ -228,7 +228,7 @@
    1.83  
    1.84  - (void)mouseMoved:(NSEvent *)theEvent
    1.85  {
    1.86 -    SDL_Window *window = SDL_GetWindowFromID(_data->windowID);
    1.87 +    SDL_Window *window = _data->window;
    1.88      int index;
    1.89      SDL_Mouse *mouse;
    1.90      NSPoint point;
    1.91 @@ -243,8 +243,8 @@
    1.92              SDL_SetMouseFocus(index, 0);
    1.93          }
    1.94      } else {
    1.95 -        if (mouse->focus != _data->windowID) {
    1.96 -            SDL_SetMouseFocus(index, _data->windowID);
    1.97 +        if (mouse->focus != _data->window) {
    1.98 +            SDL_SetMouseFocus(index, _data->window);
    1.99          }
   1.100          SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y, 0);
   1.101      }
   1.102 @@ -298,7 +298,7 @@
   1.103  {
   1.104      NSAutoreleasePool *pool;
   1.105      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
   1.106 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   1.107 +    SDL_VideoDisplay *display = window->display;
   1.108      SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
   1.109      SDL_WindowData *data;
   1.110  
   1.111 @@ -308,7 +308,7 @@
   1.112          SDL_OutOfMemory();
   1.113          return -1;
   1.114      }
   1.115 -    data->windowID = window->id;
   1.116 +    data->window = window;
   1.117      data->window = nswindow;
   1.118      data->created = created;
   1.119      data->display = displaydata->display;
   1.120 @@ -363,7 +363,7 @@
   1.121      if ([nswindow isKeyWindow]) {
   1.122          int index = data->videodata->keyboard;
   1.123          window->flags |= SDL_WINDOW_INPUT_FOCUS;
   1.124 -        SDL_SetKeyboardFocus(index, data->windowID);
   1.125 +        SDL_SetKeyboardFocus(index, data->window);
   1.126  
   1.127          if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   1.128              /* FIXME */
   1.129 @@ -381,7 +381,7 @@
   1.130  {
   1.131      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.132      NSWindow *nswindow;
   1.133 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   1.134 +    SDL_VideoDisplay *display = window->display;
   1.135      NSRect rect;
   1.136      SDL_Rect bounds;
   1.137      unsigned int style;
   1.138 @@ -490,7 +490,7 @@
   1.139  {
   1.140      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   1.141      NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
   1.142 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   1.143 +    SDL_VideoDisplay *display = window->display;
   1.144      NSRect rect;
   1.145      SDL_Rect bounds;
   1.146