Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#40 pointer warp related race

open
nobody
5
2012-03-14
2012-03-14
No

There is race when pointer is warped and there is no pending events then in the next frame we are pulling an event related to mouse movement before warping and we are receiving abnormal mouse movement.

Workaround:

Index: ois/trunk/src/linux/LinuxMouse.cpp

--- ois/trunk/src/linux/LinuxMouse.cpp (revision 38)
+++ ois/trunk/src/linux/LinuxMouse.cpp (working copy)
@@ -174,6 +174,13 @@
//Compute this frames Relative X & Y motion
int dx = event.xmotion.x - oldXMouseX;
int dy = event.xmotion.y - oldXMouseY;
+
+ // Because of reason unknown there is race when pointer is warped and there is no pending events
+ // then in the next frame we are pulling an event related to mouse movement before warping
+ // and we are receiving abnormal mouse movement
+ int max_diff = (mState.width >> 2) + (mState.width >> 3);
+ if(dx < -max_diff || dx > max_diff || dy < -max_diff || dy > max_diff)
+ continue;

//Store old values for next time to compute relative motion
oldXMouseX = event.xmotion.x;

Discussion