mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-11-21 20:47:19 +01:00
Only update the window size if setting the display mode succeeded
This commit is contained in:
parent
0eb6f79190
commit
3cad447ee7
@ -1162,12 +1162,15 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * 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);
|
||||
/* make sure the window size (and internals like window-surface size) are adjusted */
|
||||
if (window->w != fullscreen_mode.w || window->h != fullscreen_mode.h) {
|
||||
window->w = fullscreen_mode.w;
|
||||
window->h = fullscreen_mode.h;
|
||||
SDL_OnWindowResized(window);
|
||||
if (SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode) == 0) {
|
||||
#ifndef ANDROID
|
||||
/* Android may not resize the window to exactly what our fullscreen mode is, especially on
|
||||
* windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't
|
||||
* use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
|
||||
* Android's SetWindowFullscreen will generate the window event for us with the proper final size.
|
||||
*/
|
||||
SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, fullscreen_mode.w, fullscreen_mode.h);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1364,11 +1367,11 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||
/* Generate a mode change event here */
|
||||
if (resized) {
|
||||
#ifndef ANDROID
|
||||
// Android may not resize the window to exactly what our fullscreen mode is, especially on
|
||||
// windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't
|
||||
// use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
|
||||
// Android's SetWindowFullscreen will generate the window event for us with the proper final size.
|
||||
|
||||
/* Android may not resize the window to exactly what our fullscreen mode is, especially on
|
||||
* windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't
|
||||
* use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
|
||||
* Android's SetWindowFullscreen will generate the window event for us with the proper final size.
|
||||
*/
|
||||
SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED,
|
||||
fullscreen_mode.w, fullscreen_mode.h);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user