diff test/testwm.c @ 1731:875c3cf1a12c SDL-1.3

SDL_PushEvent() calls the event filter code, and has a return value to tell whether or not the event was actually pushed. SDL_GetEventFilter() now returns an SDL_bool instead of the filter function.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 08 Jul 2006 20:07:08 +0000
parents 6c63fc2bd986
children
line wrap: on
line diff
--- a/test/testwm.c	Sat Jul 08 18:06:02 2006 +0000
+++ b/test/testwm.c	Sat Jul 08 20:07:08 2006 +0000
@@ -175,11 +175,18 @@
     SDL_PushEvent(&event);
 }
 
+static int SDLCALL(*old_filterfunc) (void *, SDL_Event *);
+static void *old_filterdata;
+
 int SDLCALL
 FilterEvents(void *userdata, SDL_Event * event)
 {
     static int reallyquit = 0;
 
+    if (old_filterfunc) {
+        old_filterfunc(old_filterdata, event);
+    }
+
     switch (event->type) {
 
     case SDL_ACTIVEEVENT:
@@ -344,6 +351,7 @@
     }
 
     /* Set an event filter that discards everything but QUIT */
+    SDL_GetEventFilter(&old_filterfunc, &old_filterdata);
     SDL_SetEventFilter(FilterEvents, NULL);
 
     /* Ignore key up events, they don't even get filtered */