瀏覽代碼

Cocoa: Fix GLFW_MAXIMIZED for nonresizable windows

The reasoning here is that glfwRestoreWindow will change nothing for
a windowed non-resizable window on Cocoa, and silently refusing to
maximize seems slightly more like something other platforms would do.

This is possibly either the right thing to do or the wrong one.
Camilla Löwy 3 年之前
父節點
當前提交
6f8ec4075b
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 1 0
      README.md
  2. 6 1
      src/cocoa_window.m

+ 1 - 0
README.md

@@ -254,6 +254,7 @@ information on what to include when reporting a bug.
  - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003)
  - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003)
  - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
  - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
  - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
  - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
+ - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false
  - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
  - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
  - [X11] Bugfix: Key names were not updated when the keyboard layout changed
  - [X11] Bugfix: Key names were not updated when the keyboard layout changed
    (#1462,#1528)
    (#1462,#1528)

+ 6 - 1
src/cocoa_window.m

@@ -1353,7 +1353,12 @@ GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window)
 GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window)
 GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window)
 {
 {
     @autoreleasepool {
     @autoreleasepool {
-    return [window->ns.object isZoomed];
+
+    if (window->resizable)
+        return [window->ns.object isZoomed];
+    else
+        return GLFW_FALSE;
+
     } // autoreleasepool
     } // autoreleasepool
 }
 }