mirror of https://github.com/encounter/SDL.git
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:
parent
b880709e9c
commit
be0cf257fe
|
@ -1548,7 +1548,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
data->scaling_dpi = newDPI;
|
data->scaling_dpi = newDPI;
|
||||||
|
|
||||||
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
||||||
Renderers need to get this to know that the framebuffer size changed. */
|
Renderers need to get this to know that the framebuffer size changed.
|
||||||
|
|
||||||
|
We clear the window size to force the event to be delivered, but what we really
|
||||||
|
want for SDL3 is a new event to notify that the DPI changed and then watch for
|
||||||
|
that in the renderer directly.
|
||||||
|
*/
|
||||||
|
data->window->w = 0;
|
||||||
|
data->window->h = 0;
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
|
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -932,11 +932,6 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
|
||||||
SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen);
|
SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen);
|
||||||
#endif
|
#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)) {
|
if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) {
|
||||||
top = HWND_TOPMOST;
|
top = HWND_TOPMOST;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue