title: Click through custom NSWindow
body: <p>I have custom NSWindow with custom NSView set as its contentView.</p>
  
  <p>The window gets initialized with:</p>
  
  <pre><code>[window setOpaque:NO];
  [window setBackgroundColor: [NSColor clearColor]];
  [window setHasShadow: NO];
  
  [window setAcceptsMouseMovedEvents: YES];
  [window setLevel: NSFloatingWindowLevel];
  </code></pre>
  
  <p>Content view, in its <code>drawRect</code> draws simple circle filled by solid color.</p>
  
  <p>All this works OK - the window appears on desktop and I see that circle. </p>
  
  <p>The only thing that does not work: the whole window rectangle is not transparent for mouse clicks. If I will click outside the circle (but inside invisible window box) my view receives mouseDown events but I expect underlying windows (or desktop) to be activated instead. </p>
  
  <p>It appears that I need something like hitTest method to be overridden on my NSWindow class but unfortunately there is no such menthod.</p>
  
  <p>So is the question: is it possible to have NSWindow with custom click through areas in OS X. If "yes" then how?</p>
  
  <p>UPDATE:</p>
  
  <p>Looking on <a href="https://developer.apple.com/library/mac/samplecode/RoundTransparentWindow/Introduction/Intro.html" rel="nofollow">RoundTransparentWindow</a> sample that works as expected - the window is click through in transparent areas. Seems like this piece:</p>
  
  <pre><code>- (void)drawRect:(NSRect)rect {
     ...
     // Reset the window shape and shadow.
      if (shouldDisplayWindow) {
          [[self window] display];
          [[self window] setHasShadow:NO];
          [[self window] setHasShadow:YES];
      }
  }
  </code></pre>
  
  <p>in CustomView.m is related to the problem but even with it (in my case) I cannot achieve transparency for mouse clicks :( </p>