From 9e2b90e2a482a95a66a125276b52b7e277e064cf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 14 Aug 2015 01:20:41 -0400 Subject: [PATCH] Cocoa: Keep the window's screen position through SDL_SetWindowSize(). The Y coordinate is flipped in Cocoa, so if you change the height, the window will move and maybe clip against the screen edge if you don't adjust its Y coordinate to match. Possibly fixes Bugzilla #3066. --- src/video/cocoa/SDL_cocoawindow.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 0378e48a94632..b2521123fcf2a 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1288,11 +1288,13 @@ - (void)resetCursorRects { SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; NSWindow *nswindow = windata->nswindow; - NSSize size; - size.width = window->w; - size.height = window->h; - [nswindow setContentSize:size]; + NSRect frame = [nswindow frame]; + frame.origin.y = (frame.origin.y + frame.size.height) - ((float) window->h); + frame.size.width = window->w; + frame.size.height = window->h; + + [nswindow setFrame:frame display:YES]; ScheduleContextUpdates(windata); }}