Set mac windows to their current size.

The initially requested size may be too big so the actual window size
may end up smaller than requested. When resetting the window to the
initial size, use the actual initial size. Otherwise those with small
screens will end up with the origin in the wrong place until resizing
the window.

Change-Id: I962cb8db52ece09f6bdc27b7b5520ce8a524ffe6
Reviewed-on: https://skia-review.googlesource.com/c/173760
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Ben Wagner 2018-11-30 14:54:55 -05:00 committed by Skia Commit-Bot
parent ea905ec333
commit e6dfe8e6f8

View File

@ -80,7 +80,9 @@ bool Window_mac::initWindow() {
// Workaround for a bug in SDL that causes a black screen until you move the window on 10.14.
SDL_PumpEvents();
SDL_SetWindowSize(fWindow, initialWidth,initialHeight);
int actualWidth, actualHeight;
SDL_GetWindowSize(fWindow, &actualWidth, &actualHeight);
SDL_SetWindowSize(fWindow, actualWidth, actualHeight);
return true;
}