How can I lock the cursor to the inside of a window on Linux?

Posted by ZorbaTHut on Stack Overflow See other posts from Stack Overflow or by ZorbaTHut
Published on 2011-01-10T00:51:42Z Indexed on 2011/01/10 0:53 UTC
Read the original article Hit count: 160

Filed under:
|
|

I'm trying to put together a game for Linux which involves a lot of fast action and flinging around of the mouse cursor. If the user wants to play in windowed mode, I'd quite like to lock the cursor to the inside of the window to avoid accidentally changing programs in the heat of battle (obviously this will cancel itself if the user changes programs or hits escape for the pause menu.)

On Windows, this can be accomplished easily with ClipCursor(). I can't find an equivalent on Linux. Is there one?

I plan to do this in pure X code, but obviously if anyone knows of a way to do this in any Linux windowing library then I can just read the source code and figure out how to duplicate it in X.

© Stack Overflow or respective owner

Related posts about linux

Related posts about cursor