Mouse warp questions

Lionel Ulmer lionel.ulmer at
Sun May 1 07:28:25 CDT 2005

On Sat, Apr 16, 2005 at 10:52:10PM +0000, Stefan Dösinger wrote:
> Yes, it "fixes" the problem. The mouse wasn't moved once during my 2 minute 
> test, but it looks like this is because the mouse warp is broken with 
> MOUSE_HACK undefined.

No, I think it's due to a bug in Wine:

trace:dinput:SysMouseAImpl_GetDeviceData (0x77c60a80)->(dods=16,entries=-1,fl=0x00000001)
trace:dinput:SysMouseAImpl_GetDeviceData Application discarding 2 event(s).
trace:dinput:SysMouseAImpl_GetDeviceData Warping mouse to 400 - 300

So basically the application is trying to get the number of events in the
queue and we just discard all of them.

As before, a patch will be done when I come back home (I really should have
taken the time to install Linux on this laptopt :-) ) but I think it's
pretty easy to fix (i.e. just handle the 'PEEK' attribute in the 'dod ==
NULL' case).

A real proper fix would need to handle the 'INFINITE' value for 'entries'
and stuff like this, but well, I doubt it's really necessary.

Anyway, the bug is that we tell the application that there are two events in
the queue (but erase them in the process of querying) and when the
application actually asks for these two events, we do not return any as we
flushed them.

So the game cursor will not move at all :-)

> I digged a little bit into the mouse warp thing. It looks like that the mouse 
> warp is used for applications which read the mouse moves. But the cursor 
> still exists and if it reaches the boarder of the screen X wouldn't report 
> any changes in the mouse position, so wine constantly warps the mouse back to
> the middle of the screen.

Basically yeah. It comes mostly from the fact that DInput requires relative
mouse movements (a mouse does not report any absolute axis in Windows and if
you request absolute mode, it's completely broken, even on Windows).

The problem is how to handle a case when the user continuously moves his
mouse to - let's say - the right and that your mouse cursor reaches the edge
of your screen ? X11 will always report the same X coordinate and thus even
if the user moves his mouse, Wine will report to the game that the mouse did
not move in the horizontal direction.

So a part from an X11 extension (which I plan to work on again one of these
days with the guys), the only way to support this is via mouse
warping (note that DGA mouse exists, but well, it's a bit ugly and is a bit
frowned upon by the X people now).


		 Lionel Ulmer -

More information about the wine-devel mailing list