|
@@ -1598,6 +1598,22 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
|
|
displayIndex = SDL_GetIndexOfDisplay(display);
|
|
|
SDL_GetDisplayBounds(displayIndex, &bounds);
|
|
|
|
|
|
+ /* for real fullscreen we might switch the resolution, so get width and height
|
|
|
+ * from closest supported mode and use that instead of current resolution
|
|
|
+ */
|
|
|
+ if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP
|
|
|
+ && (bounds.w != w || bounds.h != h)) {
|
|
|
+ SDL_DisplayMode fullscreen_mode, closest_mode;
|
|
|
+ SDL_zero(fullscreen_mode);
|
|
|
+ fullscreen_mode.w = w;
|
|
|
+ fullscreen_mode.h = h;
|
|
|
+ if(SDL_GetClosestDisplayModeForDisplay(display, &fullscreen_mode, &closest_mode) != NULL) {
|
|
|
+ bounds.w = closest_mode.w;
|
|
|
+ bounds.h = closest_mode.h;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ window->fullscreen_mode.w = bounds.w;
|
|
|
+ window->fullscreen_mode.h = bounds.h;
|
|
|
window->x = bounds.x;
|
|
|
window->y = bounds.y;
|
|
|
window->w = bounds.w;
|