mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-25 15:15:36 +00:00
When the window fullscreen mode changes, update the display resolution
This commit is contained in:
parent
707fd9f071
commit
4750fe7390
|
@ -1020,6 +1020,13 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
|
||||||
} else {
|
} else {
|
||||||
SDL_zero(window->fullscreen_mode);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,12 +1036,12 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
|
||||||
SDL_DisplayMode fullscreen_mode;
|
SDL_DisplayMode fullscreen_mode;
|
||||||
SDL_VideoDisplay *display;
|
SDL_VideoDisplay *display;
|
||||||
|
|
||||||
|
CHECK_WINDOW_MAGIC(window, -1);
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
return SDL_InvalidParamError("mode");
|
return SDL_InvalidParamError("mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_WINDOW_MAGIC(window, -1);
|
|
||||||
|
|
||||||
fullscreen_mode = window->fullscreen_mode;
|
fullscreen_mode = window->fullscreen_mode;
|
||||||
if (!fullscreen_mode.w) {
|
if (!fullscreen_mode.w) {
|
||||||
fullscreen_mode.w = window->w;
|
fullscreen_mode.w = window->w;
|
||||||
|
@ -1046,11 +1053,9 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
|
||||||
display = SDL_GetDisplayForWindow(window);
|
display = SDL_GetDisplayForWindow(window);
|
||||||
|
|
||||||
/* if in desktop size mode, just return the size of the desktop */
|
/* 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;
|
fullscreen_mode = display->desktop_mode;
|
||||||
}
|
} else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
|
||||||
else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
|
|
||||||
&fullscreen_mode,
|
&fullscreen_mode,
|
||||||
&fullscreen_mode)) {
|
&fullscreen_mode)) {
|
||||||
return SDL_SetError("Couldn't find display mode match");
|
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;
|
h = window->max_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Should this change fullscreen modes? */
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
window->windowed.w = w;
|
window->windowed.w = w;
|
||||||
window->windowed.h = h;
|
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 {
|
} else {
|
||||||
window->w = w;
|
window->w = w;
|
||||||
window->h = h;
|
window->h = h;
|
||||||
|
|
Loading…
Reference in a new issue