From 322a57e88c98b9affa1546eea5dd37d9c042b9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 16 Nov 2019 10:16:37 +0100 Subject: [PATCH] Platform: properly fire Sdl2Application::viewportEvent() in all cases. The event wasn't fired when the window size got changed through an API call. Unfortunately after this change the event gets fired any time I call setMaxWindowSize(), not just when the size changes. --- doc/changelog.dox | 3 +++ src/Magnum/Platform/Sdl2Application.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 5fbc172d4..3f0e1bdb8 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -98,6 +98,9 @@ See also: @subsection changelog-latest-bugfixes Bug fixes +- @ref Platform::Sdl2Application::viewportEvent() gets properly fired also + when window size changes programmatically (such as through + @ref Platform::Sdl2Application::setMinWindowSize() "setMinWindowSize()") - The @ref Primitives::cylinderSolid() and @ref Primitives::coneSolid() primitives were missing a face when both caps and texture coordinates were enabled (see [mosra/magnum#386](https://github.com/mosra/magnum/issues/386)) diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 3388dc1f2..b4e20e994 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -755,7 +755,10 @@ bool Sdl2Application::mainLoopIteration() { switch(event.type) { case SDL_WINDOWEVENT: switch(event.window.event) { - case SDL_WINDOWEVENT_RESIZED: { + /* Not using SDL_WINDOWEVENT_RESIZED, because that doens't + get fired when the window is resized programmatically + (such as through setMaxWindowSize()) */ + case SDL_WINDOWEVENT_SIZE_CHANGED: { #ifdef CORRADE_TARGET_EMSCRIPTEN /* If anybody sees this assert, then emscripten finally implemented resize events. Praise them for that.