title: Repaint NSView when mainWindow changes
body: <p>I would like to change the background of an NSView depending on if the the window is focused.</p>
  
  <p>I found this question: <a href="https://stackoverflow.com/questions/6710134/change-nsview-background-color-when-window-has-focus">Change NSView background color when window has focus</a></p>
  
  <p>And the first answer works fine except the redraw is not triggered when the windows loses or gains focus.</p>
  
  <p>How can I trigger the redraw when the mainWindow changes?</p>