SDL patch idea

While working on the Myth II patch, I came up with the following patch for SDL.
It happens that my previous patch for callback functions is no longer necesary,
and I can just use the event filter mechanism to achieve the same thing.

However one problem in the current SDL event handling is that the SDL internal
state is updated after the event has been posted, thus when you are querying
this state using for instance SDL_GetKeyState() or SDL_GetMouseState() from
within the event filter, then you get a non up-to-date state. This patch
basically makes sure that the state is updated before, which makes more sense
IMHO. This also avoids the need for the application to maintain its own state
from the events…

On a side note, the active events internal state is left updated after, because
moving it caused some lockups in Myth. Yuck. I just hope that moving the order
doesn’t affect anything I would have missed… so let me know if this is wrong
:)–
Stephane Peter
Programmer
Loki Entertainment Software

“Microsoft has done to computers what McDonald’s has done to gastronomy”
-------------- next part --------------
A non-text attachment was scrubbed…
Name: status.diff
Type: application/octet-stream
Size: 2665 bytes
Desc: status.diff
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20000223/42992a0a/attachment.obj

However one problem in the current SDL event handling is that the SDL internal
state is updated after the event has been posted, thus when you are querying
this state using for instance SDL_GetKeyState() or SDL_GetMouseState() from
within the event filter, then you get a non up-to-date state. This patch
basically makes sure that the state is updated before, which makes more sense
IMHO. This also avoids the need for the application to maintain its own state
from the events…

I’m open to discussion on this. Originally it was a feature to update the
state after the filter, so you could query the old state before the event
was processed, from within the filter function.

How many people are using the current sematics?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec