WgpuMetalSurface_mac: switch to <AppKit/AppKit.h> umbrella

The narrow `<AppKit/NSView.h>` header only forward-declares NSWindow,
so `view.window.backingScaleFactor` fails to compile on macOS with:

    error: property 'backingScaleFactor' cannot be found in forward
           class object 'NSWindow'

Use the AppKit umbrella header so NSWindow's interface (including
backingScaleFactor) is in scope. Same idiomatic include any non-trivial
Cocoa code reaches for; we're already linking -framework Cocoa so
there's no compile-time cost beyond a slightly heavier translation
unit (the .mm is ~30 lines anyway).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-06-02 14:25:06 +10:00
parent 21d394501f
commit 6b72a60d8c
+4 -1
View File
@@ -7,7 +7,10 @@
#if defined(__APPLE__)
#import <AppKit/NSView.h>
// The AppKit umbrella header pulls in NSWindow so `view.window`'s
// `backingScaleFactor` resolves — `<AppKit/NSView.h>` alone only
// forward-declares NSWindow.
#import <AppKit/AppKit.h>
#import <QuartzCore/CAMetalLayer.h>
void* wgpu_macos_attach_metal_layer(void* nsview_ptr) {