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.
This commit is contained in:
zhaolei 2026-04-18 19:11:47 +08:00
parent 2d18b88480
commit b16221a1d3
2 changed files with 14 additions and 1 deletions

View file

@ -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];

View file

@ -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':