XWarpPointer breaks raw mouse input.

Mad Fish The One madfishtheone at gmail.com
Tue Sep 7 12:43:53 PDT 2010


I'm writing a game, and I want raw mouse input to control camera (so no
additional acceleration by X server) and don't want mouse to escape the
window (for obvious reasons).
I'm using XI_RawMotion events for raw mouse input, and XWarpPointer to not
allow mouse escape the window.
Well, the problem is, when XWarpPointer is called, XI_RawMotion is posted
with coordinates of XWarpPointer's target point in screen coordinates. But
it shouldn't - isn't it RAW input?
How to do it right?

Minimal test case: http://pastebin.com/WFJULnYk
(captures RawMotion events, and sends XWarpPointer sometimes).
Compile as: "gcc warptest.c -o warptest -lX11 -lXi"
You will see a series of normal events, and then a strange event generated
by XWarpPointer.

Anyway, is there a better method of containing pointer in a window without
breaking Alt+Tab (that's what XGrabPointer does)?
Can you also recommend some general best practices with X input for games?

P.S. Currently using X server 1.8.2 on Arch Linux. (reported to happen on
1.9 as well)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20100907/e7265f36/attachment.html>


More information about the xorg mailing list