Weird mouse events under win98

Hi all

I don’t know whether this is a bug in SDL or something else, but the
problem shows when I check for mouse events. After (almost) every
SDL_MOUSEBUTTONDOWN event I receive, there is immediately
SDL_MOUSEMOTION event sitting in the event queue. Here is a
complete program that clearly shows this behaviour. (I have tested this
only under win98 with SDL-1.2.5a.)

#include <stdio.h>
#include <stdlib.h>
#include “SDL.h”

int main()
{
SDL_Surface *screen;
SDL_Event ev;

SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);

screen = SDL_SetVideoMode(320, 200, 16, SDL_HWSURFACE);
if(screen == NULL)
{
fprintf(stderr, “SDL_SetVideoMode: %s\n”, SDL_GetError());
exit(1);
}

while(SDL_WaitEvent(&ev))
{
switch(ev.type)
{
case SDL_MOUSEBUTTONDOWN:
fprintf(stderr, “mouse button down\n”);
break;

case SDL_MOUSEMOTION:
fprintf(stderr, “mouse motion: %d, %d\n”,
ev.motion.x, ev.motion.y);
break;

case SDL_QUIT:
exit(0);
break;

default:
break;
}
}
return 0;
}–
Ivan Stankovic

I don’t know whether this is a bug in SDL or something else, but
the
problem shows when I check for mouse events. After (almost) every
SDL_MOUSEBUTTONDOWN event I receive, there is immediately
SDL_MOUSEMOTION event sitting in the event queue.

I observed the same behavior recently on Win32 with SDL 1.2.5, but
it only happens in windowed mode, not in fullscreen mode.–
Matthijs Hollemans
All Your Software
www.allyoursoftware.com

I don’t know whether this is a bug in SDL or something else, but
the
problem shows when I check for mouse events. After (almost) every
SDL_MOUSEBUTTONDOWN event I receive, there is immediately
SDL_MOUSEMOTION event sitting in the event queue.

I observed the same behavior recently on Win32 with SDL 1.2.5, but
it only happens in windowed mode, not in fullscreen mode.

It’s very likely that the Os is delivering these itself.

You’re free to filter and scale mouse events to your heart’s content. :slight_smile:

-Sam Lantinga, Software Engineer, Blizzard Entertainment