[SDL] Re: SDL_WarpMouse() and SDL_ShowCursor()

David Olofson david at olofson.net
Mon Nov 28 08:34:46 PST 2005


On Monday 28 November 2005 16.23, Ricardo Cruz wrote:
[...]
> > Actually, I'd also consider the X behavior a bug, althogh, if I
> > stretch (far) I can sort of understand why someone might have
> > thought it doesn't make sense to move an invisible pointer.
> >
>  Making the system mouse cursor invisible and blit some image in its
> place is quite a common practice in games.

...but then it's no longer invisible! ;-)


> These developers expect 
> the mouse warpping if they ask to, so, unless it breaks something, I
> think this should implement for invisible cursors as well.

Yes, of course. Maybe fixing this *does* break something; I'm not 
sure, BUT...

...unless I'm confusing things, it *is* actually working as expected 
(at least here, on Xorg/Linux), with both hidden cursor and warping. 
I get absolutes and deltas, warping works, and I get these "echo" 
events caused by the warping, and all is fine.

What happens is that when the cursor is enabled again, it is somehow 
moved back to where it was when it was disabled. By enabling the 
cursor *before* doing that final "warp back to the starting point", 
this problem is avoided.


If you're rendering your own cursor, I think you avoid this problem 
entirely, as you won't be triggering this "enable cursor and on some 
targets, move back to where it was disabled" operation.


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---




More information about the SDL mailing list