Relative mouse movement produces random jumps

[I’m resending this after I subscribed, as the moderator doesn’t seem to approve my original mail. Apologies if this now shows up a twice.]

Hi,

I’m having a problem with sdl 1.2.5:

The mouse pointer is disabled, and grabbed
| SDL_WM_GrabInput(SDL_GRAB_ON);
| SDL_ShowCursor(SDL_DISABLE);

According to the manual this means relative MouseMotion events should
now be generated.

This mostly works. But every now and then sdl reports a really big jump
in mouse movement.

To debug this, i have defined DEBUG_MOTION and DEBUG_XEVENTS in
SDL_x11events.c.

When running the application and moving the Mouse it produces something
like the following:

| DGA motion: -1,1
| DGA motion: -1,0
| DGA motion: 0,1
| DGA motion: -1,0
| DGA motion: -1,0
| LeaveNotify! (111,89)
| EnterNotify! (111,89)
| DGA motion: -1,0
| DGA motion: -1,0

I then instumented SDL_PrivateMouseMotion in SDL_mouse.c which clearly
shows that the LeaveNotify/EnterNotify causes the jumps in relative
movement.

| DGA motion: 1,1
| MouseMotion: 1 1 1
| event.motion xrel= 1 yrel= 1
| DGA motion: 1,0
| MouseMotion: 1 1 0
| event.motion xrel= 1 yrel= 0
| DGA motion: 1,1
| MouseMotion: 1 1 1
| event.motion xrel= 1 yrel= 1
| DGA motion: 1,0
| MouseMotion: 1 1 0
| event.motion xrel= 1 yrel= 0
| LeaveNotify! (121,86)
| EnterNotify! (121,86)
| MouseMotion: 0 121 86
| event.motion xrel=-162 yrel= 32
| XXX jump detected: -162 32
| DGA motion: 0,1
| MouseMotion: 1 0 1
| event.motion xrel= 0 yrel= 1
| DGA motion: -1,0
| MouseMotion: 1 -1 0
| event.motion xrel= -1 yrel= 0

I’m not sure how to fix that. I’m not even sure if the Xserver should
generate Leave/EnterNotify events with a grabbed mouse pointer, but I
think SDL should deal more gracefully with that case, as the Leave and
EnterNotify events have exactly the same position.

I’m using FreeBSD 5.1-CURRENT with XFree85-4.3.0. My windowmanager is
wmx (although it also happens with twm). I also tried compiling sdl
with --disable-threads which didn’t make a difference. The problem
occurs in both windowed mode and fullscreen mode. The application in
which this occurs is the game neverball (http://icculus.org/neverball/).

Can this be fixed, or at least explain to me how to fix it best?

CU,
Sec–
Linux Philosophie: wenn was nicht eindeutig definiert
ist dann kann man’s ja gleich ganz anders machen.