28 #include "SDL_thread.h"
30 #include "../timer/SDL_timer_c.h"
31 #if !SDL_JOYSTICK_DISABLED
32 #include "../joystick/SDL_joystick_c.h"
34 #include "../video/SDL_sysvideo.h"
37 #define SDL_MAX_QUEUED_EVENTS 65535
44 SDL_EventFilter callback;
53 } SDL_DisabledEventBlock;
59 typedef struct _SDL_EventEntry
63 struct _SDL_EventEntry *prev;
64 struct _SDL_EventEntry *next;
67 typedef struct _SDL_SysWMEntry
70 struct _SDL_SysWMEntry *next;
89 #if !SDL_JOYSTICK_DISABLED
125 for (wmmsg =
SDL_EventQ.wmmsg_used; wmmsg; ) {
130 for (wmmsg =
SDL_EventQ.wmmsg_free; wmmsg; ) {
148 while (SDL_event_watchers) {
150 SDL_event_watchers = tmp->next;
173 #if !SDL_THREADS_DISABLED
214 entry->event = *
event;
216 entry->msg = *
event->syswm.msg;
217 entry->event.syswm.msg = &entry->msg;
242 entry->prev->next = entry->next;
245 entry->next->prev = entry->prev;
282 for (i = 0; i < numevents; ++
i) {
292 if (events ==
NULL) {
301 for (wmmsg =
SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) {
302 wmmsg_next = wmmsg->next;
308 for (entry =
SDL_EventQ.head; entry && used < numevents; entry = next) {
310 type = entry->event.type;
311 if (minType <= type && type <= maxType) {
312 events[used] = entry->event;
325 wmmsg->msg = *entry->event.syswm.msg;
383 for (entry =
SDL_EventQ.head; entry; entry = next) {
385 type = entry->event.type;
386 if (minType <= type && type <= maxType) {
404 #if !SDL_JOYSTICK_DISABLED
446 if (timeout > 0 && ((
int) (
SDL_GetTicks() - expiration) >= 0)) {
467 for (curr = SDL_event_watchers; curr; curr = curr->next) {
468 curr->callback(curr->userdata, event);
513 watcher->callback =
filter;
514 watcher->userdata = userdata;
516 SDL_event_watchers = watcher;
526 for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->next) {
527 if (curr->callback == filter && curr->userdata == userdata) {
529 prev->next = curr->next;
531 SDL_event_watchers = curr->next;
544 for (entry =
SDL_EventQ.head; entry; entry = next) {
546 if (!
filter(userdata, &entry->event)) {
558 Uint8 hi = ((type >> 8) & 0xff);
568 if (state != current_state)
592 return current_state;
617 event.type = eventType;
SDL_SysWMEntry * wmmsg_used
DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType)
DECLSPEC void SDLCALL SDL_JoystickUpdate(void)
DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
static SDL_EventWatcher * SDL_event_watchers
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex)
static int SDL_AddEvent(SDL_Event *event)
DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event)
Waits indefinitely for the next available event.
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
Polls for currently pending events.
int SDL_StartEventLoop(void)
DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void)
#define SDL_MAX_QUEUED_EVENTS
DECLSPEC void SDLCALL SDL_free(void *mem)
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
DECLSPEC void SDLCALL SDL_PumpEvents(void)
static struct @79 SDL_EventQ
DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex)
int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)
static SDL_VideoDevice * _this
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC Uint32 SDLCALL SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
void SDL_GestureProcessEvent(SDL_Event *event)
static __inline__ SDL_bool SDL_ShouldPollJoystick()
#define SDL_GetEventState(type)
SDL_EventFilter SDL_EventOK
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
SDL_EventType
The types of events that can be delivered.
union SDL_SysWMmsg::@77 msg
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
void(* PumpEvents)(_THIS)
GLbitfield GLuint64 timeout
static void SDL_CutEvent(SDL_EventEntry *entry)
DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event *event, int timeout)
Waits until the specified timeout (in milliseconds) for the next available event. ...
DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
struct _SDL_SysWMEntry SDL_SysWMEntry
DECLSPEC int SDLCALL SDL_JoystickEventState(int state)
#define SDL_assert(condition)
DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata)
DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type)
#define SDL_arraysize(array)
struct SDL_mutex SDL_mutex
DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
struct SDL_EventWatcher SDL_EventWatcher
DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType)
struct _SDL_EventEntry SDL_EventEntry
uint8_t Uint8
An unsigned 8-bit integer type.
static Uint32 SDL_userevents
static SDL_DisabledEventBlock * SDL_disabled_events[256]
SDL_SysWMEntry * wmmsg_free
DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents)
DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type)
SDL_VideoDevice * SDL_GetVideoDevice(void)
int SDL_SendAppEvent(SDL_EventType eventType)
DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
SDL_bool SDL_PrivateJoystickNeedsPolling()
void SDL_StopEventLoop(void)