PDA

View Full Version : Generating Mouse Clicks



Ebonair
3rd July 2009, 23:25
Hello, I am developing a small application that lets your mobile phone act as a touchpad. I am able to move the desktop cursor with QCursor::setPos(), but I can't find a way to simulate mouse button presses so that any application can receive them.

All of the Qt functions I have found only generate presses for the Qt application itself, and it seems they can't be used to create a general-purpose cursor. Say, something that could click on a desktop icon or a button in Open Office.

Does anyone know how to solve this problem?

wysota
3rd July 2009, 23:58
You would have to dig into the native API, with registering global hooks for mouse and keyboard and you would have to send such events using X11 calls. Remember that when your application looses focus and/or activation (i.e. upon clicking with a mouse somewhere outside the application), input events are stopped being delivered to the application. You would have to grab the mouse and that's probably not what you want because then you won't be able to change the active application.

Ebonair
4th July 2009, 18:20
That's what I was afraid of. :P

I'll take a look at the X11 programming and see what I can do with it.