When the window fullscreen mode changes, update the display resolution
parent
707fd9f071
commit
4750fe7390
|
@ -1020,6 +1020,13 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
|
|||
} else {
|
||||
SDL_zero(window->fullscreen_mode);
|
||||
}
|
||||
|
||||
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||
SDL_DisplayMode fullscreen_mode;
|
||||
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
|
||||
SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1029,12 +1036,12 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
|
|||
SDL_DisplayMode fullscreen_mode;
|
||||
SDL_VideoDisplay *display;
|
||||
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
|
||||
if (!mode) {
|
||||
return SDL_InvalidParamError("mode");
|
||||
}
|
||||
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
|
||||
fullscreen_mode = window->fullscreen_mode;
|
||||
if (!fullscreen_mode.w) {
|
||||
fullscreen_mode.w = window->w;
|
||||
|
@ -1046,11 +1053,9 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
|
|||
display = SDL_GetDisplayForWindow(window);
|
||||
|
||||
/* if in desktop size mode, just return the size of the desktop */
|
||||
if ( ( window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) == SDL_WINDOW_FULLSCREEN_DESKTOP )
|
||||
{
|
||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||
fullscreen_mode = display->desktop_mode;
|
||||
}
|
||||
else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
|
||||
} else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
|
||||
&fullscreen_mode,
|
||||
&fullscreen_mode)) {
|
||||
return SDL_SetError("Couldn't find display mode match");
|
||||
|
@ -1681,10 +1686,16 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)
|
|||
h = window->max_h;
|
||||
}
|
||||
|
||||
/* FIXME: Should this change fullscreen modes? */
|
||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||
window->windowed.w = w;
|
||||
window->windowed.h = h;
|
||||
|
||||
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||
SDL_DisplayMode fullscreen_mode;
|
||||
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
|
||||
SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
window->w = w;
|
||||
window->h = h;
|
||||
|
|
Loading…
Reference in New Issue