Mapping Other Input to Keyboard Input



I'm working with a friend of mine developing a program taking input from external sources and remapping them to keyboard input (say you had a gamepad or other external device and you wanted to use it to "type"). Is there any easy way to do that in JUCE? I noticed there's the KeyListener class which we could use to get the input from the keyboard (from my understanding) but is there a way to do the reverse and send a key press to the currently active program/window? This will eventuall be run on a Mac and potentially a Windows PC. I looked into the basics of how this might be done on OS X and was non-trivial with Cocoa and I'm guessing similarly with Windows.




Most OSes will consider it a security risk to allow one program to send keyboard events to another.. It's probably possible by digging around in the system libraries, but not something I've ever tried, as it's something that probably very few people would ever want to do.


Yeah it seems like something that would be a lot more work than it's worth to add to the JUCE library. I'm having a hard enough time figuring out where in OSX to look...