ColleagueRiley / RGFW

A cross platform lightweight single-header simple-to-use window abstraction library for creating graphical programs or libraries.
zlib License
276 stars 15 forks source link

CVDisplayLink deprecation in macOS 15 #36

Open meshula opened 5 days ago

meshula commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

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.