I found something that might be an SDL issue (or a Linux issue).
Within the SDL screen if the mouse is within a certain region of the
screen, it is turned off by calling SDL_ShowCursor( SDL_DISABLE ); and
when it leaves the given region it’s turned on with SDL_ENABLE.
It all works fine in windowed mode, but when it is in full-screen mode,
the the SDL_ShowCursor( SDL_ENABLE ) call causes the cursor to jump,
upwards and sometimes sideways too. If the SDL_ShowCursor() function is
not called, the mouse coordinates are always fine, whether in
fullscreen or windowed mode. In windowed mode things are fine even if
the SDL_ShowCursor() is called. It’s only in fullscreen mode when the
ShowCursor call makes the mouse jump.
I printed the mouse motion events (x,y), it shows what happens when the
mouse is dragged downwards, at a more or less even speed:
motion 359,357
motion 359,360
motion 359,362
SDL_ShowCursor( SDL_ENABLE )
motion 376,202
motion 376,205
motion 376,208
motion 376,209
As you can see, enabling the cursor makes it jump up by 160 pixels and
slightly to the right this time (although the horzontal jump seems to be
unpredictable, the vertical is always upwards).
The system I’m running is SuSE Linux 10.0 (2.6.13 kernel), x86_64
(Athlon) the X server is xorg, 6.8.2, the video card is an NVidia
GeForce 6200 with the NVidia driver. The SDL lib I use is 1.2.13,
installed from the source tarball.
The user code (i.e. my code) is a single thread (sitting in the event
loop). There’s a constant stream of SDL_PushEvents() from a 10ms timer,
but they are always SDL_USEREVENT, the mouse events are all generated
by SDL itself (that is, I’m sure that it is not a bug in my code and my
code works just fine when it runs in windowed mode).
Anyone has seen something like that before?
Thanks,
Zoltan