From a3717436b6c872d5a659f848d848a2632d773eb7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Oct 2021 14:39:06 +0530 Subject: [PATCH] macOS: Fix resize_in_steps not working correctly on high DPI screens See #4114 --- docs/changelog.rst | 3 +++ glfw/cocoa_window.m | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 080e92cdd..40071c6e3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -87,6 +87,9 @@ To update |kitty|, :doc:`follow the instructions `. - macOS: Fix :kbd:`ctrl+shift` with :kbd:`Esc or Function keys` not working (:iss:`4109`) +- macOS: Fix :opt:`resize_in_steps` not working correctly on high DPI screens + (:iss:`4114`) + 0.23.1 [2021-08-17] ---------------------- diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index b72d04475..b7e41e15f 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1875,10 +1875,13 @@ void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom void _glfwPlatformSetWindowSizeIncrements(_GLFWwindow* window, int widthincr, int heightincr) { - if (widthincr != GLFW_DONT_CARE && heightincr != GLFW_DONT_CARE) - [window->ns.object setResizeIncrements:NSMakeSize(widthincr, heightincr)]; - else + if (widthincr != GLFW_DONT_CARE && heightincr != GLFW_DONT_CARE) { + float xscale = 1, yscale = 1; + _glfwPlatformGetWindowContentScale(window, &xscale, &yscale); + [window->ns.object setResizeIncrements:NSMakeSize(widthincr / xscale, heightincr / yscale)]; + } else { [window->ns.object setResizeIncrements:NSMakeSize(1.0, 1.0)]; + } } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)