src/video/cocoa/SDL_cocoawindow.m
changeset 6231 5eecf59b698f
parent 6185 b91e7565e877
child 6301 e8a69c5378e7
equal deleted inserted replaced
6223:af89a3a770e7 6231:5eecf59b698f
   151 }
   151 }
   152 
   152 
   153 - (void)windowDidResize:(NSNotification *)aNotification
   153 - (void)windowDidResize:(NSNotification *)aNotification
   154 {
   154 {
   155     SDL_VideoDevice *device = SDL_GetVideoDevice();
   155     SDL_VideoDevice *device = SDL_GetVideoDevice();
   156     int w, h;
   156     int x, y, w, h;
   157     NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
   157     NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
       
   158     ConvertNSRect(&rect);
       
   159     x = (int)rect.origin.x;
       
   160     y = (int)rect.origin.y;
   158     w = (int)rect.size.width;
   161     w = (int)rect.size.width;
   159     h = (int)rect.size.height;
   162     h = (int)rect.size.height;
   160     if (SDL_IsShapedWindow(_data->window))
   163     if (SDL_IsShapedWindow(_data->window))
   161         Cocoa_ResizeWindowShape(_data->window);
   164         Cocoa_ResizeWindowShape(_data->window);
   162 
   165 
   163     if (_data->window == device->current_glwin) {
   166     if (_data->window == device->current_glwin) {
   164         [((NSOpenGLContext *) device->current_glctx) update];
   167         [((NSOpenGLContext *) device->current_glctx) update];
   165     }
   168     }
   166 
   169 
       
   170     /* The window can move during a resize event, such as when maximizing
       
   171        or resizing from a corner */
       
   172     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y);
   167     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
   173     SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
   168 }
   174 }
   169 
   175 
   170 - (void)windowDidMiniaturize:(NSNotification *)aNotification
   176 - (void)windowDidMiniaturize:(NSNotification *)aNotification
   171 {
   177 {