Always send SDL_WINDOWEVENT_SIZE_CHANGED when window is resized

SDL_WINDOWEVENT_SIZE_CHANGED is now sent even if the resulting size of the window does not match the requested size.
This commit is contained in:
Mathieu Eyraud 2022-01-16 09:40:51 +01:00 committed by Sam Lantinga
parent 1a50334c46
commit 2a0cde8fd5

View File

@ -2273,12 +2273,14 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)
SDL_UpdateFullscreenMode(window, SDL_TRUE);
}
} else {
int old_w = window->w;
int old_h = window->h;
window->w = w;
window->h = h;
if (_this->SetWindowSize) {
_this->SetWindowSize(_this, window);
}
if (window->w == w && window->h == h) {
if (window->w != old_w || window->h != old_h) {
/* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
SDL_OnWindowResized(window);
}