mirror of https://github.com/encounter/SDL.git
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.
This commit is contained in:
parent
f2f8e6f5ef
commit
9e2b90e2a4
|
@ -1288,11 +1288,13 @@ Cocoa_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
NSWindow *nswindow = windata->nswindow;
|
NSWindow *nswindow = windata->nswindow;
|
||||||
NSSize size;
|
|
||||||
|
|
||||||
size.width = window->w;
|
NSRect frame = [nswindow frame];
|
||||||
size.height = window->h;
|
frame.origin.y = (frame.origin.y + frame.size.height) - ((float) window->h);
|
||||||
[nswindow setContentSize:size];
|
frame.size.width = window->w;
|
||||||
|
frame.size.height = window->h;
|
||||||
|
|
||||||
|
[nswindow setFrame:frame display:YES];
|
||||||
|
|
||||||
ScheduleContextUpdates(windata);
|
ScheduleContextUpdates(windata);
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue