macOS: Fix resize_in_steps being applied when double-clicking on the

title bar to maximize the window
This commit is contained in:
pagedown 2023-02-24 19:56:51 +08:00
parent c5149dec24
commit f8b53df5c2
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -1717,6 +1717,18 @@ - (void)toggleFullScreen:(nullable id)sender
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];
}
}