macOS: Fix resize_in_steps not working correctly on high DPI screens

See #4114
This commit is contained in:
Kovid Goyal
2021-10-12 14:39:06 +05:30
parent 7852e0b618
commit a3717436b6
2 changed files with 9 additions and 3 deletions

View File

@@ -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)