title: How can I use Cocoa's Accessibility API to detect that a window is brought to front?
body: <p>I'm using the Accessibility API to detect when a certain application opens windows, closes windows, when the windows are moved or resized, or made main and/or focused. However the client app seems to move a window to front without an Accessibility API notification being
  fired.</p>
  
  <p>How can my application detect when another application brings a window to front, without making it key?</p>
  
  <p>I'm hoping to find a solution that works on OS X 10.4 and 10.5</p>
  
  <p>More info:
  I'm using these statements at the moment. They work fine when the user manually selects a window to bring it to front. But it doens't work when the app itself is bringing the window to the front.</p>
  
  <pre><code>AXObserverAddNotification(observer, element, kAXMainWindowChangedNotification, 0);
  AXObserverAddNotification(observer, element, kAXFocusedWindowChangedNotification, 0);
  </code></pre>