From 168d72fc1142cd5a8cc4f6c0568cf90ed7ae505e Mon Sep 17 00:00:00 2001 From: nee-wom <16381829+nee-wom@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:52:20 +0200 Subject: [PATCH] macOS EGL: fixed initial layer contents scale The initial event viewDidChangeBackingProperties arrives before the layer is attached to the view. Hence the layer keeps its default scale, which is not always correct. --- src/cocoa_window.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index e69b5fe0..44952dee 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -942,6 +942,8 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, // need to get the layer for EGL window surface creation. [window->ns.view setWantsLayer:YES]; window->ns.layer = [window->ns.view layer]; + if (window->ns.scaleFramebuffer && window->ns.layer) + [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; if (!_glfwInitEGL()) return GLFW_FALSE;