Skip to content

Commit 9335195

Browse files
committed
[osx] Don't use obsoleted function on macOS 15.0 (fix aseprite/aseprite#4880)
If we target laf for macOS 15.0, we cannot use the obsoleted CGDisplayCreateImageForRect() function. We have to re-implement the getColorFromScreen() functionality through ScreenCaptureKit in a near future.
1 parent 7f10f4a commit 9335195

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

os/osx/system.mm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LAF OS Library
2-
// Copyright (c) 2020-2023 Igara Studio S.A.
2+
// Copyright (c) 2020-2025 Igara Studio S.A.
33
//
44
// This file is released under the terms of the MIT license.
55
// Read LICENSE.txt for more information.
@@ -108,6 +108,12 @@
108108
gfx::Color SystemOSX::getColorFromScreen(const gfx::Point& screenPosition) const
109109
{
110110
gfx::Color color = gfx::ColorNone;
111+
112+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_15_0
113+
// TODO Use ScreenCaptureKit for macOS 15.0 as
114+
// CGDisplayCreateImageForRect() function is obsoleted in
115+
// this version.
116+
#else
111117
CGImageRef image = CGDisplayCreateImageForRect(
112118
CGMainDisplayID(),
113119
CGRectMake(screenPosition.x, screenPosition.y, 1, 1));
@@ -135,6 +141,7 @@
135141
}
136142
CGImageRelease(image);
137143
}
144+
#endif
138145
return color;
139146
}
140147

0 commit comments

Comments
 (0)