Using XWarpPointer in a 'mouselook' interface

I’m putting together a mouselook interface where I need to warp the pointer back to the center of the screen whenever it’s moved.Problem is that using XWarpPointer causes another MotionNotify event(as if the user moved the mouse to the center of the window) which then re-warps the pointer etc.I need to tell the XServer not to add events to the queue when I issue the XWarpPointer command.Anybody knows how to do that?I’ve tried XSelectInput But I have problems when I move the mouse with a button pressed so I thought this might not be the way to go.I can’t seem to find anything else in the Xlib man pages though.

If you use XWarpPointer, you will get MotionNotify events as long as they are in your event mask. You could remove MotionNotify from your event mask during the time you do the warp and then put it back.

I would ignore motion events and instead read the mouse position before warping it back each frame.

are you speaking about the mouse event under X ? how to use it correctly ? how to know if your mouse has 2 or 3 buttons ? a ruller …

… that’s maybe too much asking for me: in this case, just forget that.

No I just had a problem with the X server reporting MoveNotify events although I issued an XSelectInput(None) which should bloack all events,when I did A XWarpPointer.Since I did the warp at every frame to warp to the center the resulting event flooding caused problems.I fixed this though by warping the pointer only when it hits the edge of the screen.This way I get warps rarely and I stil can get relative mouse movements w/o constraining the pointer to the window,sort of…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.