[SDL] bug: SDL_WarpMouse does not change MouseState

Johannes Schmidt sdl at myrealbox.com
Fri Oct 1 03:49:05 PDT 2004


On Friday 01 October 2004 02:30, Ivo Danihelka wrote:
> On Fri, 2004-10-01 at 01:11, Johannes Schmidt wrote:
> > The SDL mouse position is updated not before a call to SDL_PumpEvents().
>
> I used SDL_PumpEvents() as you can see from the test program:
> ---------
>     SDL_WarpMouse(screen->w / 2, screen->h / 2);
>
>     for (int i = 0; i < 10; ++i) {
>         int x, y;
>         SDL_PumpEvents();
>         SDL_Delay(100);
>         SDL_GetMouseState(&x, &y);
>         fprintf(stderr, "curosr: %d, %d\n", x, y);
>     }
> ---------
>
> Probably system does not generate motion event as it should in this
> case.

Oops, I haven't read the original message, just Stephane's reply :)

If your mouse cursor is not within the SDL frame and you warp the mouse, you 
get an enter notify, not a motion notify.
Therefore, SDL does not update its internal mouse state.

What's about calling SDL_PrivateMouseMotion even when getting an EnterNotify?

Regards,
Johannes




More information about the SDL mailing list