Cocoa accessibility API, can I click a window in the background without activating it?

Posted by Winawer on Stack Overflow See other posts from Stack Overflow or by Winawer
Published on 2010-04-30T21:56:10Z Indexed on 2010/05/02 0:07 UTC
Read the original article Hit count: 267

I've been searching forever for a solution to this, so I thought I'd seek out the brainpower of greater minds than mine. I'm developing a Cocoa app that uses the Accessibility API to manipulate another program (it's a hotkey app). The app I'm controlling typically has multiple windows open, with some hidden behind others. What I would like to do, if it's possible, is to send mouse events to windows using the Accessibility API in a way that presses a button in the window without bringing it to the foreground (interact with the window but don't activate it). The reason I'm trying to do this is that sending the mouse event to this other window will force it to the foreground and disrupt the user's interaction with the foremost window.

This is possible on Windows - apparently, because apps similar to mine do it there - but I'm getting the feeling that this isn't possible with Cocoa, given the way the window manager works. Am I mistaken?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about accessibility