From 7bd8238e8d1d88c8b3d298435976a57069a690b5 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Sun, 29 Mar 2026 16:24:29 -0700 Subject: [PATCH] Fix issue with SetWindowSize that caused drawing to fail after resizing the window on a retina display. --- src/platforms/rcore_desktop_glfw.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 9b6881d40..140ec6634 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -739,6 +739,22 @@ void SetWindowSize(int width, int height) CORE.Window.screen.height = height; glfwSetWindowSize(platform.handle, width, height); + + // Update render size and viewport to match new screen size immediately, + // rather than waiting for the async FramebufferSizeCallback. + if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) + { + Vector2 scaleDpi = GetWindowScaleDPI(); + CORE.Window.render.width = (int)(width*scaleDpi.x); + CORE.Window.render.height = (int)(height*scaleDpi.y); + } + else + { + CORE.Window.render.width = width; + CORE.Window.render.height = height; + } + CORE.Window.currentFbo = CORE.Window.render; + SetupViewport(CORE.Window.render.width, CORE.Window.render.height); } // Set window opacity, value opacity is between 0.0 and 1.0