How can I simulate a drag action using Xlib?

view story

http://stackoverflow.com – I have an application which uses Xlib library for simulate a mouse on the screen. I used XQueryPointer and XWarpPointer functions with which I can simulate a mouse movement and also a click. My problem is that I can't "drag" an element (it's an interface with some blocks which you can move within a Qt application written in C++ and launched on Ubuntu). I use many parts of this extract: Sending X11 click event doesn't work with some windows Do you have any idea? Thank you in advance. (HowTos)