I compiled xdotool before for the N900 - not .deb packaged let alone in the repositories, but I made a thread about it. (It does exactly what you want, if you're okay with doing it through the command line or having your app do it through the command line.)