src/events/SDL_events.c
changeset 7190 11612d544fcd
parent 7082 e9d6004d2978
child 7191 75360622e65f
     1.1 --- a/src/events/SDL_events.c	Sat May 18 09:35:09 2013 -0700
     1.2 +++ b/src/events/SDL_events.c	Sat May 18 12:48:50 2013 -0700
     1.3 @@ -111,6 +111,7 @@
     1.4          SDL_event_watchers = tmp->next;
     1.5          SDL_free(tmp);
     1.6      }
     1.7 +    SDL_EventOK = NULL;
     1.8  }
     1.9  
    1.10  /* This function (and associated calls) may be called more than once */
    1.11 @@ -133,8 +134,7 @@
    1.12      }
    1.13  #endif /* !SDL_THREADS_DISABLED */
    1.14  
    1.15 -    /* No filter to start with, process most event types */
    1.16 -    SDL_EventOK = NULL;
    1.17 +    /* Process most event types */
    1.18      SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
    1.19      SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
    1.20      SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
    1.21 @@ -365,7 +365,9 @@
    1.22  SDL_PushEvent(SDL_Event * event)
    1.23  {
    1.24      SDL_EventWatcher *curr;
    1.25 +
    1.26      event->common.timestamp = SDL_GetTicks();
    1.27 +
    1.28      if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
    1.29          return 0;
    1.30      }
    1.31 @@ -516,8 +518,20 @@
    1.32      return event_base;
    1.33  }
    1.34  
    1.35 -/* This is a generic event handler.
    1.36 - */
    1.37 +int
    1.38 +SDL_SendAppEvent(SDL_EventType eventType)
    1.39 +{
    1.40 +    int posted;
    1.41 +
    1.42 +    posted = 0;
    1.43 +    if (SDL_GetEventState(eventType) == SDL_ENABLE) {
    1.44 +        SDL_Event event;
    1.45 +        event.type = eventType;
    1.46 +        posted = (SDL_PushEvent(&event) > 0);
    1.47 +    }
    1.48 +    return (posted);
    1.49 +}
    1.50 +
    1.51  int
    1.52  SDL_SendSysWMEvent(SDL_SysWMmsg * message)
    1.53  {