Not elegant, but if you want to type in the inactive window, I think you are going to have to save the status of the active window, make the window under the cursor the active window, type or have the typed text pasted, and then restore the original active window.
I can think of a few ways to trigger the procedure, but I don't understand how this will work without three hands (one to position the mouse, and the other two to type). Or is it one hand typing while the other is mousing?