Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVDisplayLink deprecation in macOS 15 #36

Open
meshula opened this issue Oct 20, 2024 · 4 comments
Open

CVDisplayLink deprecation in macOS 15 #36

meshula opened this issue Oct 20, 2024 · 4 comments
Assignees
Labels
incompatibility warning Compiler warning, deprecated or suspicious code

Comments

@meshula
Copy link
Contributor

meshula commented Oct 20, 2024

As of macOS 15.0, CVDisplayLink is deprecated. https://developer.apple.com/documentation/corevideo/cvdisplaylink-k0k?language=objc

gcc  -x c -c RGFW.h -D RGFW_NO_API -D RGFW_EXPORT -D RGFW_IMPLEMENTATION -o RGFW.o
RGFW.h:7357:3: warning: 'CVDisplayLinkCreateWithCGDisplay' is deprecated: first deprecated in macOS 15.0 - use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)  [-Wdeprecated-declarations]
 7357 |                 CVDisplayLinkCreateWithCGDisplay(win->src.display, (CVDisplayLinkRef*)&win->src.displayLink);
      |                 ^

As of macOS 14.0, the replacement is on NSView. https://developer.apple.com/documentation/appkit/nsview/4191632-displaylinkwithtarget?language=objc

I was wondering if anyone's got a patch or fix in progress?

Currently one must remove -Werror from the makefile to build on Mac.

make examples
gcc  -Wall -Werror -Wstrict-prototypes -Wextra -Wstrict-prototypes -Wold-style-definition -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-missing-braces -Wno-missing-variable-declarations -Wno-redundant-decls -Wno-unused-function -Wno-unused-label -Wno-unused-result -Wno-incompatible-pointer-types -Wno-format -Wno-format-extra-args -Wno-implicit-function-declaration -Wno-implicit-int -Wno-pointer-sign -Wno-switch -Wno-switch-default -Wno-switch-enum -Wno-unused-value -Wno-type-limits -I. examples/basic/basic.c -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo -std=c99    -o examples/basic/basic
In file included from examples/basic/basic.c:6:

./RGFW.h:7357:3: error: 'CVDisplayLinkCreateWithCGDisplay' is deprecated: first deprecated in macOS 15.0 - use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)  [-Werror,-Wdeprecated-declarations]
 7357 |                 CVDisplayLinkCreateWithCGDisplay(win->src.display, (CVDisplayLinkRef*)&win->src.displayLink);

@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Oct 20, 2024

As of macOS 15.0, CVDisplayLink is deprecated

Oh, I didn't realize.

I was wondering if anyone's got a patch or fix in progress?

A handful of people will fix the issues they find, but I'm the only person actively working on RGFW. I didn't know this was an issue so I didn't have any plans to replace it. But I will look into replacing it asap!

@meshula
Copy link
Contributor Author

meshula commented Oct 20, 2024

Thanks! I may have a chance to look at it in a month or two; if I do get to it before you, I'll let you know.

@ColleagueRiley ColleagueRiley added the warning Compiler warning, deprecated or suspicious code label Oct 21, 2024
@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Dec 8, 2024

@meshula Although this feature has been deprecated by macOS 10.15, I would like to maintain support for at least macOS 10.13.

This just means the solution will look something like this:

#ifdef MACOS_VERSION <= 10.13
// old CVDisplayLink method
#else
// new NSView method
#endif

Or even a runtime check if it would be better

@meshula
Copy link
Contributor Author

meshula commented Dec 10, 2024

A runtime check makes sense, although it would need a local warning suppression to be compatible with Werror.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatibility warning Compiler warning, deprecated or suspicious code
Projects
None yet
Development

No branches or pull requests

2 participants