src/video/cocoa/SDL_cocoawindow.m
changeset 5564 7ed38a8ad304
parent 5535 96594ac5fd1a
child 5646 fe1df351ca3d
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Fri Jul 15 17:05:32 2011 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 16 11:52:09 2011 -0700
     1.3 @@ -114,6 +114,7 @@
     1.4  - (void)windowDidMove:(NSNotification *)aNotification
     1.5  {
     1.6      int x, y;
     1.7 +    SDL_VideoDevice *device = SDL_GetVideoDevice();
     1.8      SDL_Window *window = _data->window;
     1.9      NSWindow *nswindow = _data->nswindow;
    1.10      NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
    1.11 @@ -136,17 +137,28 @@
    1.12  
    1.13      x = (int)rect.origin.x;
    1.14      y = (int)rect.origin.y;
    1.15 +
    1.16 +    if (window == device->current_glwin) {
    1.17 +        [((NSOpenGLContext *) device->current_glctx) update];
    1.18 +    }
    1.19 +
    1.20      SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
    1.21  }
    1.22  
    1.23  - (void)windowDidResize:(NSNotification *)aNotification
    1.24  {
    1.25 +    SDL_VideoDevice *device = SDL_GetVideoDevice();
    1.26      int w, h;
    1.27      NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
    1.28      w = (int)rect.size.width;
    1.29      h = (int)rect.size.height;
    1.30      if (SDL_IsShapedWindow(_data->window))
    1.31          Cocoa_ResizeWindowShape(_data->window);
    1.32 +
    1.33 +    if (_data->window == device->current_glwin) {
    1.34 +        [((NSOpenGLContext *) device->current_glctx) update];
    1.35 +    }
    1.36 +
    1.37      SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
    1.38  }
    1.39  
    1.40 @@ -683,6 +695,10 @@
    1.41      [nswindow setFrameOrigin:rect.origin];
    1.42      s_moveHack = moveHack;
    1.43  
    1.44 +    if (window == _this->current_glwin) {
    1.45 +        [((NSOpenGLContext *) _this->current_glctx) update];
    1.46 +    }
    1.47 +
    1.48      [pool release];
    1.49  }
    1.50  
    1.51 @@ -690,12 +706,18 @@
    1.52  Cocoa_SetWindowSize(_THIS, SDL_Window * window)
    1.53  {
    1.54      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    1.55 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    1.56 +    SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
    1.57 +    NSWindow *nswindow = windata->nswindow;
    1.58      NSSize size;
    1.59  
    1.60      size.width = window->w;
    1.61      size.height = window->h;
    1.62      [nswindow setContentSize:size];
    1.63 +
    1.64 +    if (window == _this->current_glwin) {
    1.65 +        [((NSOpenGLContext *) _this->current_glctx) update];
    1.66 +    }
    1.67 +
    1.68      [pool release];
    1.69  }
    1.70  
    1.71 @@ -738,6 +760,11 @@
    1.72      NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    1.73  
    1.74      [nswindow zoom:nil];
    1.75 +
    1.76 +    if (window == _this->current_glwin) {
    1.77 +        [((NSOpenGLContext *) _this->current_glctx) update];
    1.78 +    }
    1.79 +
    1.80      [pool release];
    1.81  }
    1.82  
    1.83 @@ -856,6 +883,10 @@
    1.84  #endif
    1.85      [nswindow makeKeyAndOrderFront:nil];
    1.86  
    1.87 +    if (window == _this->current_glwin) {
    1.88 +        [((NSOpenGLContext *) _this->current_glctx) update];
    1.89 +    }
    1.90 +
    1.91      [pool release];
    1.92  }
    1.93