I would like to change the background of an NSView depending on if the the window is focused.
I found this question: Change NSView background color when window has focus
And the first answer works fine except the redraw is not triggered when the windows loses or gains focus.
How can I trigger the redraw when the mainWindow changes?