Weird shadowing on changing objects on a transparent NSWindow?

Hi there!

I'm working on a program that runs on a transparent NSWindow. On this window, there are NSImageViews, which change based on certain conditions automatically as the app runs. One small issue however, when these ImageViews change, they leave weird artefacts on the NSWindow.

For example, when changing from the top image to the bottom; it leaves a strange, translucent shadow in its place - as you can see in the images.

I've tried doing stuff like resetting the opacity and shadow of the window by running this code when the images change (run from a function in the NSViewController):

view.window?.isOpaque = true
view.window?.isOpaque = false

view.window?.hasShadow = false
view.window?.hasShadow = true

But the artifacts remain on the window. I've also tried redrawing the NSView and NSImageViews, but to no avail. Is there anything I can do to prevent this from happening?

Thanks!

In case it's relevant, this is the code I'm using to make the NSWindow transparent, called from windowDidLoad:

window?.isOpaque = false
window?.backgroundColor = NSColor.clear

NSWindow invalidateShadow() Invalidates the window shadow so that it is recomputed based on the current window shape.

Weird shadowing on changing objects on a transparent NSWindow?
 
 
Q