diff src/events/SDL_events.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/src/events/SDL_events.c	Sat Jul 08 18:06:02 2006 +0000
+++ b/src/events/SDL_events.c	Sat Jul 08 20:07:08 2006 +0000
@@ -435,9 +435,13 @@
 int
 SDL_PushEvent(SDL_Event * event)
 {
-    if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0) <= 0)
+    if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
+        return 0;
+    }
+    if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0) <= 0) {
         return -1;
-    return 0;
+    }
+    return 1;
 }
 
 void
@@ -451,13 +455,16 @@
     while (SDL_PollEvent(&bitbucket) > 0);
 }
 
-SDL_EventFilter
-SDL_GetEventFilter(void **userdata)
+SDL_bool
+SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)
 {
+    if (filter) {
+        *filter = SDL_EventOK;
+    }
     if (userdata) {
         *userdata = SDL_EventOKParam;
     }
-    return (SDL_EventOK);
+    return SDL_EventOK ? SDL_TRUE : SDL_FALSE;
 }
 
 void
@@ -536,11 +543,7 @@
         SDL_memset(&event, 0, sizeof(event));
         event.type = SDL_SYSWMEVENT;
         event.syswm.msg = message;
-        if ((SDL_EventOK == NULL)
-            || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
-            posted = 1;
-            SDL_PushEvent(&event);
-        }
+        posted = (SDL_PushEvent(&event) > 0);
     }
     /* Update internal event state */
     return (posted);