You can use the following declares to turn it on and off for the main view within a window, normally the children controls will adopt the parents setting, however it's more than possible for a child not to follow the parent.
declare Function NSWindowContentView lib "AppKit" selector "contentView" (NSWindowInstance as integer) as integer
declare Sub NSViewWantsLayer lib "AppKit" selector "setWantsLayer:" (NSViewInstance as integer, assigns value as boolean)
NSViewWantsLayer( NSWindowContentView( me.handle ) ) = true
If you want to tell if a control is layer-backed, you can use the following declare; but don't make the assumption that if the main view of a window isn't layer-backed, then nothing is.
declare function NSViewWantsLayer lib "AppKit" selector "wantsLayer" ( NSViewInstance as integer ) as boolean
msgbox "Using layer backed views: " + if( NSViewWantsLayer( rectControl.handle ), "YES", "NO" )
I have a sneaking suspicion that Mojave maybe turning this on automagically, and it's potentially leading to some kind of refresh loop.
There's two things I can think of right now.
- How do you update the interface elements? Make sure that they do not update/refresh/invalidate each other.
- In recent years to overcome some nasty visual glitches with modern macOS, I never directly "show" a complex window. Instead I stick it in a queue and fire a timer, which in turn then calls
window.show. The interval is 0.16 seconds, but it's enough time for the macOS to handle it's !@#$% before the window is attempted to be drawn on screen. It's an ugly hack to an ugly problem.