mirror of
https://github.com/yawut/SDL.git
synced 2026-06-03 06:35:10 -05:00
Fixed bug 1372 - OSX Window Maximize/Resize Doesn't Update Window Position
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.
This commit is contained in:
parent
ce42b7c89d
commit
f36a10c448
|
|
@ -153,8 +153,11 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
|||
- (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]];
|
||||
ConvertNSRect(&rect);
|
||||
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 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
|||
[((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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user