From f8b53df5c29ca6a73c1a1435845c5fc63d72580a Mon Sep 17 00:00:00 2001 From: pagedown Date: Fri, 24 Feb 2023 19:56:51 +0800 Subject: [PATCH] macOS: Fix resize_in_steps being applied when double-clicking on the title bar to maximize the window --- glfw/cocoa_window.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index bd0463589..7a9f542f8 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1717,6 +1717,18 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) { if (glfw_window && !glfw_window->decorated && glfw_window->ns.view) [self makeFirstResponder:glfw_window->ns.view]; } +- (void)zoom:(id)sender +{ + if (![self isZoomed]) { + const NSSize original = [self resizeIncrements]; + [self setResizeIncrements:NSMakeSize(1.0, 1.0)]; + [super zoom:sender]; + [self setResizeIncrements:original]; + } else { + [super zoom:sender]; + } +} + @end // }}} @@ -2065,10 +2077,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (![window->ns.object isZoomed]) { - const NSSize original = [window->ns.object resizeIncrements]; - [window->ns.object setResizeIncrements:NSMakeSize(1.0, 1.0)]; [window->ns.object zoom:nil]; - [window->ns.object setResizeIncrements:original]; } }