Setting NSWindow.colorSpace to sRGB doesn't work consistently and causes drawing artifacts

Number:rdar://FB9316904 Date Originated:07/12/2021
Status:Open Resolved:
Product:macOS Product Version:11.4
Classification:Incorrect/Unexpected Behavior Reproducible:
Write an app that does this:

1. Create an NSWindow whose colorSpace is set to [NSColorSpace sRGBColorSpace].
2. Add a a layer-backed view with a solid background color (25% gray in my case).
3. Add a subview that draws a partially transparent color (50% alpha red in my case).

Sometimes the colors are blended as sRGB. Other times they are blended in the device color space. The window flashes as you move it around or mouse over it.

Here’s the kicker: take another app’s window and drag it near the red view. You can “paint” with it; apparently the window server uses sRGB for the parts that are overlapped by the other window’s shadow. See the attached video (using textedit as the second window) and sample project, which was used in the creation of the video.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!