koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.11k stars 639 forks source link

CVDisplayLink API deprecated in macOS > 15.0 #2382

Open kanghengliu opened 1 month ago

kanghengliu commented 1 month ago

Per this apple developer document, apple has deprecated old APIs for screen capture.

This deprecation results in apple prompting for Screen Capture access frequently(once every animation request) with window animation on. Latest 15.0 developer beta reduced the prompt frequency to once-a-week. However imho it is still better to migrate API if possible(and if not much hassle:) )

example of prompt: reddit credit: 9to5mac

kanghengliu commented 1 month ago

EDIT: Changed title. Checked, none of the currently in use by yabai Core Display APIs are deprecated yet. It is Core Video API CVDisplayLink that is deprecated in macOS ver>15.0. See more in apple docs: CVDisplayLink

Specifically, yabai's animation related functions like window_manager_animate_window_list_async and window_manager_animate_window_list_thread_proc used some of the deprecated CVDisplayLink APIs. See below as example: https://github.com/koekeishiya/yabai/blob/4572d69932a11e157985c7c515d1e094b88707c6/src/window_manager.c#L698-L702

@koekeishiya I haven't got time/skill to be able to migrate per the instructions provided by apple docs. Could you please take a look at it? I'm on dev beta 15.1, and would happily assist in testing.

koekeishiya commented 1 month ago

Editor’s note: Updated to remove paragraph that said there was an API developers could adopt to avoid this pop-up. There is no API to avoid this pop-up.

Source: https://9to5mac.com/2024/08/06/macos-sequoia-screen-recording-privacy-prompt/

--

There is no way this gets through the beta, friggin Apple..

shinyquagsire23 commented 1 month ago

wait does this actually pop up a prompt? If anything I feel like CVDisplayLink/CADisplayLink doing any prompt pop-up would be a bug that should be Feedback'd, it'd basically apply to every media player app that has to sync frame timing

kanghengliu commented 1 month ago

Since the prompt is caused by API deprecation, and I have not spotted any deprecated screen capture APIs in use by yabai, CVDisplayLink is my suspect. And yes, i do agree that it should be Feedback'd. However I can't yet confirm if it actually affects media players that employ this method, as I'm not sure if my media player does this or not(IINA and infuse), and they do not trigger the permission prompt.

shinyquagsire23 commented 1 month ago

actually wait CADisplayLink isn't deprecated and got macOS (non-catalyst) support at some point, if it's just about getting the main monitor rate then that should be fine maybe (worked for me to get vsync updates on visionOS at least)

edit: usage example if anyone is curious, https://github.com/alvr-org/alvr-visionos/blob/main/ALVRClient/RealityKitClientSystem.swift#L77