3

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!

General Grievance
  • 4,555
  • 31
  • 31
  • 45
amustafa
  • 858
  • 1
  • 7
  • 17

1 Answers1

3

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
    );
Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75
  • Thanks! That works perfectly. Now there is another issue though. When I move the cursor to the desired xsession, it doesn't refresh the view on the background. I wind up turning the whole screen white. Here is a long to the new topic. http://stackoverflow.com/questions/13733239/second-cursor-is-not-triggering-a-screen-refresh – amustafa Dec 05 '12 at 22:10