mirror of https://github.com/encounter/SDL.git
Setting the window size changes the fullscreen display mode, unless a window display mode has been set.
Testing: * Ran testsprite2 --fullscreen, used Ctrl+ and Ctrl- to change window sizes, verified that the display mode changed as well.
This commit is contained in:
parent
c15e26d77d
commit
4fd03b9582
|
@ -462,15 +462,21 @@ D3D_ActivateRenderer(SDL_Renderer * renderer)
|
||||||
if (data->updateSize) {
|
if (data->updateSize) {
|
||||||
SDL_Window *window = renderer->window;
|
SDL_Window *window = renderer->window;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
Uint32 window_flags = SDL_GetWindowFlags(window);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &w, &h);
|
SDL_GetWindowSize(window, &w, &h);
|
||||||
data->pparams.BackBufferWidth = w;
|
data->pparams.BackBufferWidth = w;
|
||||||
data->pparams.BackBufferHeight = h;
|
data->pparams.BackBufferHeight = h;
|
||||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
|
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||||
data->pparams.BackBufferFormat =
|
SDL_DisplayMode fullscreen_mode;
|
||||||
PixelFormatToD3DFMT(SDL_GetWindowPixelFormat(window));
|
SDL_GetWindowDisplayMode(window, &fullscreen_mode);
|
||||||
|
data->pparams.Windowed = FALSE;
|
||||||
|
data->pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format);
|
||||||
|
data->pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate;
|
||||||
} else {
|
} else {
|
||||||
|
data->pparams.Windowed = TRUE;
|
||||||
data->pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
data->pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||||
|
data->pparams.FullScreen_RefreshRateInHz = 0;
|
||||||
}
|
}
|
||||||
if (D3D_Reset(renderer) < 0) {
|
if (D3D_Reset(renderer) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -565,25 +571,16 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
pparams.hDeviceWindow = windowinfo.info.win.window;
|
pparams.hDeviceWindow = windowinfo.info.win.window;
|
||||||
pparams.BackBufferWidth = w;
|
pparams.BackBufferWidth = w;
|
||||||
pparams.BackBufferHeight = h;
|
pparams.BackBufferHeight = h;
|
||||||
if (window_flags & SDL_WINDOW_FULLSCREEN) {
|
|
||||||
pparams.BackBufferFormat =
|
|
||||||
PixelFormatToD3DFMT(fullscreen_mode.format);
|
|
||||||
} else {
|
|
||||||
pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
|
||||||
}
|
|
||||||
pparams.BackBufferCount = 1;
|
pparams.BackBufferCount = 1;
|
||||||
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
|
|
||||||
if (window_flags & SDL_WINDOW_FULLSCREEN) {
|
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||||
if ((window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
|
||||||
pparams.Windowed = TRUE;
|
|
||||||
pparams.FullScreen_RefreshRateInHz = 0;
|
|
||||||
} else {
|
|
||||||
pparams.Windowed = FALSE;
|
pparams.Windowed = FALSE;
|
||||||
|
pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format);
|
||||||
pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate;
|
pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
pparams.Windowed = TRUE;
|
pparams.Windowed = TRUE;
|
||||||
|
pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||||
pparams.FullScreen_RefreshRateInHz = 0;
|
pparams.FullScreen_RefreshRateInHz = 0;
|
||||||
}
|
}
|
||||||
if (flags & SDL_RENDERER_PRESENTVSYNC) {
|
if (flags & SDL_RENDERER_PRESENTVSYNC) {
|
||||||
|
|
|
@ -1044,10 +1044,10 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
|
||||||
|
|
||||||
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->windowed.w;
|
||||||
}
|
}
|
||||||
if (!fullscreen_mode.h) {
|
if (!fullscreen_mode.h) {
|
||||||
fullscreen_mode.h = window->h;
|
fullscreen_mode.h = window->windowed.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = SDL_GetDisplayForWindow(window);
|
display = SDL_GetDisplayForWindow(window);
|
||||||
|
@ -1688,15 +1688,13 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)
|
||||||
h = window->max_h;
|
h = window->max_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
|
||||||
window->windowed.w = w;
|
window->windowed.w = w;
|
||||||
window->windowed.h = h;
|
window->windowed.h = h;
|
||||||
|
|
||||||
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||||
SDL_DisplayMode fullscreen_mode;
|
window->last_fullscreen_flags = 0;
|
||||||
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
|
SDL_UpdateFullscreenMode(window, SDL_TRUE);
|
||||||
SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window->w = w;
|
window->w = w;
|
||||||
|
|
Loading…
Reference in New Issue