This posting is older than 6 months and can contain outdated information.
Hi Chris,
you're welcome! :-)
There are a few practical problems with your suggestions:
1) I don't know of a (fast and official) API to get a list of
windows, their position and their parent application.
2) Application windows don't necessary have to fill the screen or
overlap other windows. Image a screen with a TextEdit window open on
the left half of the screen and a SubEthaEdit window open on the
right half of the screen. Now, which one of those applications should
be considered active?
It's impossible for both reasons (and especially #2, because it can't
be worked around) to implement automatic Behaviour selection based on
the frontmost rather than the active application.
Remote Buddy tries hard to get an idea of what you are currently
focusing on. If, i.e. you work in an unsupported app to do some
writing and you have iTunes running in the background (i.e. it's not
active), it'll nonetheless use the Behaviour to control iTunes. Same
goes if you have started iTunes and DVD Player (both in the
background): in that case, Remote Buddy will usually choose the
iTunes Behaviour - until the moment you have a DVD in your drive. It
will then assume you also want to watch it and selecte the DVD Player
Behaviour.
Hope that explains why Remote Buddy is implemented the way it is.
Cheers,
Felix