Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files

Fixed bug 1372 - OSX Window Maximize/Resize Doesn't Update Window Pos…


Alex Nankervis 2012-01-15 14:20:01 PST

SDL_cocoawindow.m, windowDidResize needs to also send a window move event.
Depending on the corner you resize a window from, or when maximizing a window,
the window position will change. Discovered this when creating a maximized
window and found that the window position was stuck at the un-maximized
window's value.

Diff with fix attached.
  • Loading branch information
slouken committed Jan 19, 2012
1 parent c5fd9de commit 972b4ce9653ac3ed491d6d54c75b8be69064fe0c
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/video/cocoa/SDL_cocoawindow.m
@@ -153,8 +153,11 @@ - (void)windowDidMove:(NSNotification *)aNotification
- (void)windowDidResize:(NSNotification *)aNotification
SDL_VideoDevice *device = SDL_GetVideoDevice();
int w, h;
int x, y, w, h;
NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
x = (int)rect.origin.x;
y = (int)rect.origin.y;
w = (int)rect.size.width;
h = (int)rect.size.height;
if (SDL_IsShapedWindow(_data->window))
@@ -164,6 +167,9 @@ - (void)windowDidResize:(NSNotification *)aNotification
[((NSOpenGLContext *) device->current_glctx) update];

/* The window can move during a resize event, such as when maximizing
or resizing from a corner */
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);

0 comments on commit 972b4ce

Please sign in to comment.