From: Brendan Shanks bshanks@codeweavers.com
The macOS Sequoia SDK has "obsoleted" this function: calling it triggers a build error when targeting macOS Sequoia. It can still be used though, either by targeting pre-Sequoia or by getting a pointer to the function through dlsym().
This is intended to be temporary until ScreenCaptureKit.framework or some other approach can be used. --- dlls/winemac.drv/cocoa_window.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 76b05857b77..6545e7908b3 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -25,6 +25,7 @@ #import <CoreVideo/CoreVideo.h> #import <Metal/Metal.h> #import <QuartzCore/QuartzCore.h> +#include <dlfcn.h>
#import "cocoa_window.h"
@@ -2369,9 +2370,20 @@ - (void) grabDockIconSnapshotFromWindow:(WineWindow*)window force:(BOOL)force return; }
+ static CGImageRef __nullable (*pCGWindowListCreateImageFromArray)(CGRect, CFArrayRef, CGWindowImageOption); + static dispatch_once_t once; + dispatch_once(&once, ^{ + void *h = dlopen("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", RTLD_LAZY | RTLD_LOCAL); + if (h) + pCGWindowListCreateImageFromArray = dlsym(h, "CGWindowListCreateImageFromArray"); + }); + + if (!pCGWindowListCreateImageFromArray) + return; + const void* windowID = (const void*)(uintptr_t)(CGWindowID)window.windowNumber; CFArrayRef windowIDs = CFArrayCreate(NULL, &windowID, 1, NULL); - CGImageRef windowImage = CGWindowListCreateImageFromArray(CGRectNull, windowIDs, kCGWindowImageBoundsIgnoreFraming); + CGImageRef windowImage = pCGWindowListCreateImageFromArray(CGRectNull, windowIDs, kCGWindowImageBoundsIgnoreFraming); CFRelease(windowIDs); if (!windowImage) return;