Q:

Controlling multiple pointers with Xlib or xinput in ubuntu/linux

I'm creating a system that uses multiple cursors (pointers) in multiple xsessions. My computer has multiple video cards in it for controlling different monitors. I want to have a different cursor on each screen and control each. Each monitor is a different session.
I started using the xlib library in C to control the single cursor I have using the following command:
XWarpPointer(display,None,window,0,0,0,0,x,y);

This works perfectly for one cursor. Then I created a second cursor using xinput in the terminal:
>>xinput create-master second

and then I have two cursors on screen. I can go and control each with a separate mouse by using the reattach command:
>>xinput reattach MOUSEID POINTERID

The last step is to control each cursor separately using xlib. When I use the xWarpPointer command it just moves the original cursor around and I can't find a way to designate which cursor to control. I have also been unable to find a way to set the default pointer. You can see a list of all the pointers using "xinput list" in terminal. Does anyone know how I can 
Thanks for the help!

A:

You need to use XIWarpPointer request from XInput2 extension, it takes deviceid as parameter
Bool     XIWarpPointer(
        Display*            display,
        int                 deviceid,
        Window              src_win,
        Window              dst_win,
        double              src_x,
        double              src_y,
        unsigned int        src_width,
        unsigned int        src_height,
        double              dst_x,
        double              dst_y
    );

