Incorrect mouse motion... - Patch


been playing with this problem, came up with a patch that
makes a full-screen openGL application with "directx"
drivers act the same as with “windib” drivers.

Apply to “src/video/windx5/SDL_dx5events.c”

I reproduced the problem by tweaking the “testgl” demo
(command-line “testgl -fullscreen -logo”) so that the bitmap
follows the mouse instead of bouncing around.

DirectDraw isn’t used for the openGL surfaces, but DirectInput
is used for the mouse and keyboard.

Due to the way the macros DDRAW_FULLSCREEN() and DINPUT_FULLSCREEN()
work, when in openGL mode, the visible cursor is tracking the windows
cursor (with acceleration etc.) but the message queue is receiving
the DirectInput mouse messages (no acceleration), and the two disagree.

I tried various things, but the simplest change is to dump the position
information from DirectInput and use the windows cursor stuff instead!

I am a bit puzzled as to the advantages of using DirectInput for mouse and keyboard. You lose user button-reversal and acceleration functionality on the mouse, and although some keys work better (e.g. the two enter keys), num-lock and caps-lock get screwed up.

John.> ----- Original Message -----

From: (Sam Lantinga)
Sent: Friday, March 29, 2002 8:22 AM
Subject: Re: [SDL] Incorrect mouse motion…

This is exactly the problem that I appear to be having. I am running in
1280x1024. I think the others are correct in that it has to do with
acceleration. If I move the mouse VERY slowly, it tracks correctly.

SDL is not the way to go for my application. It is critical that I have
accurate mouse positioning.

Like I said, this is a bug (in fact the only bug holding up SDL 1.2.4),
so as soon as somebody figures out how to fix it, we will.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

SDL mailing list
SDL at
-------------- next part --------------
A non-text attachment was scrubbed…
Name: openGL-FS-cursor.pat
Type: application/octet-stream
Size: 1603 bytes
Desc: not available

thanks !!