win32 event bug (or unfortunate feature)

Tristan Savatier tristan at mpegtv.com
Tue Aug 3 04:00:31 PDT 1999


This time, SDL_PumpEvent (i.e. SDL_SYS_PumpEvent).

It looks like the win32 implementation consumes
all the messages, including possibly private messages
used by the application:


void SDL_SYS_PumpEvents(void)
{
	MSG msg;

	while ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) {
		if ( GetMessage(&msg, NULL, 0, 0) > 0 ) {
			DispatchMessage(&msg);
		}
	}
}

I think that it should be something like:


void SDL_SYS_PumpEvents(void)
{
	MSG msg;

	while ( PeekMessage(&msg, NULL, 0, WM_APP - 1, PM_NOREMOVE) ) {
		if ( GetMessage(&msg, NULL, 0, WM_APP - 1) > 0 ) {
			DispatchMessage(&msg);
		}
	}
}

messages with types larger than WM_APP (0x8000) are private to
the application, and there is no reason that they should be consumed
by SDL. In the case of mtvp, we use those messages to synchronize
the various threads, so nothing can work if SDL eats-up our messages!

-t



More information about the SDL mailing list