From b16221a1d3fd62db01cdc70df647b43168495310 Mon Sep 17 00:00:00 2001 From: zhaolei Date: Sat, 18 Apr 2026 19:11:47 +0800 Subject: [PATCH] macos: explicitly enable modern window corners on macOS 26 Use an explicit runtime check to apply the newer corner styling on macOS 26 while leaving behavior unchanged on older macOS versions for compatibility. Also add the required QuartzCore framework for linking the corner curve API. --- glfw/cocoa_window.m | 13 +++++++++++++ glfw/glfw.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 20ac6f896..cc56987da 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -3918,6 +3918,18 @@ apply_titlebar_color_settings(_GLFWwindow *window) { #undef tc } +static void +apply_window_corner_curve(_GLFWwindow *window) { + if (!window || !window->decorated) return; + if (@available(macOS 26.0, *)) { + GLFWWindow *nsw = window->ns.object; + NSView *frame_view = nsw.contentView.superview; + CALayer *layer = frame_view.layer; + if (!layer) return; + layer.cornerCurve = kCACornerCurveContinuous; + } +} + GLFWAPI void glfwCocoaSetWindowChrome(GLFWwindow *w, unsigned int color, bool use_system_color, unsigned int system_color, int background_blur, unsigned int hide_window_decorations, bool show_text_in_titlebar, int color_space, float background_opacity, bool resizable) { @autoreleasepool { @@ -4033,6 +4045,7 @@ GLFWAPI void glfwCocoaSetWindowChrome(GLFWwindow *w, unsigned int color, bool us } #undef tc apply_titlebar_color_settings(window); + apply_window_corner_curve(window); // HACK: Changing the style mask can cause the first responder to be cleared [nsw makeFirstResponder:window->ns.view]; diff --git a/glfw/glfw.py b/glfw/glfw.py index af723451f..79894ef51 100755 --- a/glfw/glfw.py +++ b/glfw/glfw.py @@ -175,7 +175,7 @@ def init_env( elif module == 'cocoa': ans.cppflags.append('-DGL_SILENCE_DEPRECATION') - for f_ in 'Cocoa IOKit CoreFoundation CoreVideo UniformTypeIdentifiers'.split(): + for f_ in 'Cocoa IOKit CoreFoundation CoreVideo QuartzCore UniformTypeIdentifiers'.split(): ans.ldpaths.extend(('-framework', f_)) elif module == 'wayland':