Skip to content

Commit

Permalink
Cocoa: Keep the window's screen position through SDL_SetWindowSize().
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Aug 14, 2015
1 parent f2f8e6f commit 9e2b90e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -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);
}}
Expand Down

0 comments on commit 9e2b90e

Please sign in to comment.