Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsanta01

Posted 27 December 2012 - 02:49 PM

I don't think there is a function to lock the cursor in position (shame on me if I'm wrong), but you can call XWarpPointer every time you receive a mouse event, which has the same effect.

sorry for plusing your answer smile.png its not exactly the way its done. XWarpPointer() would move the cursor and produce the mouse event itself, performance falls drastically for no good reason. its better to call XWarpPointer() after the event queue is empty:

while (XPending(display)) {
    XNextEvent(display, &event);
    // process you events
}

XWarpPointer(...);

or you can look through the freeglut sources to find out how its implemented for X11.


#2santa01

Posted 27 December 2012 - 02:48 PM


I don't think there is a function to lock the cursor in position (shame on me if I'm wrong), but you can call XWarpPointer every time you receive a mouse event, which has the same effect.

sorry for plusing your answer :) its not exactly the way its done. XWarpPointer() would move the cursor and produce the mouse event itself, performance falls drastically for no good reason. its better to call XWarpPointer() after the event queue is empty:
while (XPending(display)) {    XNextEvent(display, &event);    // process you events}XWarpPointer(...);

or you can look through the freeglut sources to find out how its implemented for X11.

#1santa01

Posted 27 December 2012 - 02:44 PM

I don't think there is a function to lock the cursor in position (shame on me if I'm wrong), but you can call XWarpPointer every time you receive a mouse event, which has the same effect.

 

not exactly the way its done, XWarpPointer() would move the cursor and produce the mouse event itself, performance falls drastically for no good reason. its better to call XWarpPointer() after the event queue is empty:

while (XPending(display)) {
    XNextEvent(display, &event);
    // process you events
}

XWarpPointer(...);

 

or you can look through the freeglut sources to find out how its implemented for X11.


PARTNERS