src/video/cocoa/SDL_cocoawindow.m
changeset 3530 e96be66e3673
parent 3529 09155ec3e291
child 3685 64ce267332c6
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sun Dec 06 08:16:23 2009 +0000
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sun Dec 06 08:39:01 2009 +0000
     1.3 @@ -298,7 +298,8 @@
     1.4  {
     1.5      NSAutoreleasePool *pool;
     1.6      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
     1.7 -    SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
     1.8 +    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
     1.9 +    SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
    1.10      SDL_WindowData *data;
    1.11  
    1.12      /* Allocate the window data */
    1.13 @@ -321,10 +322,12 @@
    1.14  
    1.15      /* Fill in the SDL window with the window data */
    1.16      {
    1.17 +        SDL_Rect bounds;
    1.18          NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
    1.19          ConvertNSRect(&rect);
    1.20 -        window->x = (int)rect.origin.x;
    1.21 -        window->y = (int)rect.origin.y;
    1.22 +        Cocoa_GetDisplayBounds(_this, display, &bounds);
    1.23 +        window->x = (int)rect.origin.x - bounds.x;
    1.24 +        window->y = (int)rect.origin.y - bounds.y;
    1.25          window->w = (int)rect.size.width;
    1.26          window->h = (int)rect.size.height;
    1.27      }
    1.28 @@ -392,7 +395,7 @@
    1.29      } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
    1.30          rect.origin.x = bounds.x;
    1.31      } else {
    1.32 -        rect.origin.x = window->x;
    1.33 +        rect.origin.x = bounds.x + window->x;
    1.34      }
    1.35      if ((window->flags & SDL_WINDOW_FULLSCREEN)
    1.36          || window->y == SDL_WINDOWPOS_CENTERED) {
    1.37 @@ -400,7 +403,7 @@
    1.38      } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
    1.39          rect.origin.y = bounds.y;
    1.40      } else {
    1.41 -        rect.origin.y = window->y;
    1.42 +        rect.origin.y = bounds.y + window->y;
    1.43      }
    1.44      rect.size.width = window->w;
    1.45      rect.size.height = window->h;
    1.46 @@ -496,13 +499,13 @@
    1.47          || window->x == SDL_WINDOWPOS_CENTERED) {
    1.48          rect.origin.x = bounds.x + (bounds.w - window->w) / 2;
    1.49      } else {
    1.50 -        rect.origin.x = window->x;
    1.51 +        rect.origin.x = bounds.x + window->x;
    1.52      }
    1.53      if ((window->flags & SDL_WINDOW_FULLSCREEN)
    1.54          || window->y == SDL_WINDOWPOS_CENTERED) {
    1.55          rect.origin.y = bounds.y + (bounds.h - window->h) / 2;
    1.56      } else {
    1.57 -        rect.origin.y = window->y;
    1.58 +        rect.origin.y = bounds.y + window->y;
    1.59      }
    1.60      rect.size.width = window->w;
    1.61      rect.size.height = window->h;