macOS: Display the newly created OS window in specified state

Fix the maximized window can't occupy full screen space when window
decoration or title bar is hidden.
Fix resize_in_steps being applied even when window is maximized.
Allows to specify `os_window_state` in startup session file.
This commit is contained in:
pagedown
2023-02-18 14:02:19 +08:00
parent 1b76cee9b4
commit ba83ce7b10
12 changed files with 109 additions and 33 deletions

View File

@@ -1868,8 +1868,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (window->monitor)
{
_glfwPlatformShowWindow(window);
_glfwPlatformFocusWindow(window);
// Do not show the window here until after setting the window size, maximized state, and full screen
// _glfwPlatformShowWindow(window);
// _glfwPlatformFocusWindow(window);
acquireMonitor(window);
}
@@ -2061,8 +2062,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
{
if (![window->ns.object isZoomed])
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];
}
}
void _glfwPlatformShowWindow(_GLFWwindow* window)