diff --git a/doc/changelog.dox b/doc/changelog.dox index 9a7e9d575..0eecfdcf3 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -325,6 +325,9 @@ See also: - Properly zero-initializing the UTF-8 buffer in @ref Platform::GlfwApplication::textInputEvent() (see [mosra/magnum#324](https://github.com/mosra/magnum/pull/324)) +- @ref Platform::Sdl2Application::viewportEvent() and + @ref Platform::GlfwApplication::viewportEvent() is fixed to behave + correctly with @ref platforms-macos-hidpi "Retina-aware" apps on macOS/iOS - @ref Text::AbstractFontConverter::exportFontToFile() and @ref Text::AbstractFontConverter::exportGlyphCacheToFile() now properly returns failure when the underlying data export function returns an empty diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index bbf48fa83..124abb4f1 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -470,15 +470,19 @@ void GlfwApplication::setupCallbacks() { /* Properly redraw after the window is restored from minimized state */ static_cast(glfwGetWindowUserPointer(window))->drawEvent(); }); + #ifdef MAGNUM_TARGET_GL glfwSetFramebufferSizeCallback(_window, [](GLFWwindow* const window, const int w, const int h) { auto& app = *static_cast(glfwGetWindowUserPointer(window)); - ViewportEvent e{{w, h} - #ifdef MAGNUM_TARGET_GL - , app.framebufferSize() - #endif - , app.dpiScaling()}; - static_cast(glfwGetWindowUserPointer(window))->viewportEvent(e); + ViewportEvent e{app.windowSize(), {w, h}, app.dpiScaling()}; + app.viewportEvent(e); }); + #else + glfwSetWindowSizeCallback(_window, [](GLFWwindow* const window, const int w, const int h) { + auto& app = *static_cast(glfwGetWindowUserPointer(window)); + ViewportEvent e{{w, h}, app.dpiScaling()}; + app.viewportEvent(e); + }); + #endif glfwSetKeyCallback(_window, [](GLFWwindow* const window, const int key, int, const int action, const int mods) { auto& app = *static_cast(glfwGetWindowUserPointer(window)); diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index fd1a76596..85e6c8d05 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -693,7 +693,11 @@ void Sdl2Application::mainLoopIteration() { https://github.com/kripken/emscripten/issues/1731 */ CORRADE_ASSERT_UNREACHABLE(); #else - ViewportEvent e{event, {event.window.data1, event.window.data2}, + /* {event.window.data1, event.window.data2} seems to be + framebuffer size and not window size on macOS, which + is weird. Query the values directly instead to be + really sure. */ + ViewportEvent e{event, windowSize(), #ifdef MAGNUM_TARGET_GL framebufferSize(), #endif