Drawing in CGConext No Longer Works On Catalina

In our application, for interactive drawing in overlay windows, we call graphicsContext on the NSWindow to get the NSGraphicsContext, then CGContext on the NSGraphicsContext to get the CGContextRef and then do our drawing using Core Graphics calls ending with CGContextFlush() with the CGContextRef. This worked flawlessly for many versions of MacOS over the years, but now with OS 10.15, nothing appears in the window anymore. What do we have to now do differently to make drawing work?


Thank You



Larry

Replies

It would be better to call setNeedsDisplay on the view or setViewsNeedDisplay on the window and let AppKit call the drawRect: . Apple streamlined the AppKit drawing code in recent macOS versions, and modifying things directly outside the standard view drawing cycle is not supported.