macOS; Fix restoring from fullscreen when resize increments are enabled

This commit is contained in:
Kovid Goyal
2021-10-23 13:06:47 +05:30
parent 518e0f4e21
commit edd423aad6

View File

@@ -1601,7 +1601,11 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
{ {
if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1) if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1)
return; return;
// When resizeIncrements is set, Cocoa cannot restore the original window size after returning from fullscreen.
const NSSize original = [self resizeIncrements];
[self setResizeIncrements:NSMakeSize(1.0, 1.0)];
[super toggleFullScreen:sender]; [super toggleFullScreen:sender];
[self setResizeIncrements:original];
} }
@end @end