Previously, I have used CGEventPost to post events to another application (Logic) which works provided it is in focus. (Please see https://developer.apple.com/forums/thread/724603?page=1#744466022).
I'm actually sending events to a dialog that I've opened via OSC, which causes Logic to "bounce" in the dock indicating that the user needs to respond to the dialog.
As I'm getting some "flashing" due to focus switching, I've tried using CGEventPostToPid to post to the application directly. The theory is that it no longer needs to be in focus, so will obviate the need for focus switching.
Unfortunately this doesn't work. I still need to bring Logic into focus for the dialog to respond to the sent events. I can see that the main window of Logic has lost focus, which implies that, from its point of view the dialog has focus - I would have thought that it would respond to the background event posts.
Any pointers on how to get this to work appreciated. Just wondering if I need to send events directly to the dialog window somehow?
Note that I'm doing this to work around a positioning bug in the OSC interface when songs have mixed time signatures.
Thanks,
Stew