Only force the resize event in the DPI changed case

OpenGL windows don't actually get the WM_WINDOWPOSCHANGED event in the SetWindowPos() call in WIN_SetWindowFullscreen(), so setting the window size to zero never gets reset and we're stuck with a zero sized window.

Instead, just force the resize event in WM_DPICHANGED handling, where we know we need it. If we end up needing to force it in WIN_SetWindowFullscreen(), just set a flag in the window data and respond to that in WM_WINDOWPOSCHANGED, but that's a fairly risky behavior change as suddenly all applications would start getting SDL_WINDOWEVENT_SIZE_CHANGED when going fullscreen, and they may respond to that in expensive and potentially disruptive ways.

For later we'll probably create a DPI changed event and respond to that in the renderer instead of this window size changed hack.

This fixes https://github.com/libsdl-org/SDL/issues/6033 @ericwa
This commit is contained in:
Sam Lantinga
2022-08-12 18:13:42 -07:00
parent b880709e9c
commit be0cf257fe
2 changed files with 8 additions and 6 deletions

View File

@@ -932,11 +932,6 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen);
#endif
/* Clear the window size, to force SDL_SendWindowEvent to send a SDL_WINDOWEVENT_RESIZED
event in WM_WINDOWPOSCHANGED. */
data->window->w = 0;
data->window->h = 0;
if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) {
top = HWND_TOPMOST;
} else {