21 #include "../SDL_internal.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 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;
92 const char *report =
SDL_GetHint(
"SDL_EVENT_QUEUE_STATISTICS");
104 SDL_Log(
"SDL EVENT QUEUE: Maximum events in-flight: %d\n",
119 for (wmmsg =
SDL_EventQ.wmmsg_used; wmmsg; ) {
124 for (wmmsg =
SDL_EventQ.wmmsg_free; wmmsg; ) {
141 SDL_disabled_events[
i] =
NULL;
144 while (SDL_event_watchers) {
146 SDL_event_watchers = tmp->
next;
169 #if !SDL_THREADS_DISABLED 212 entry->
msg = *
event->syswm.
msg;
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) {
311 if (minType <= type && type <= maxType) {
312 events[used] = entry->
event;
382 for (entry =
SDL_EventQ.head; entry; entry = next) {
385 if (minType <= type && type <= maxType) {
403 #if !SDL_JOYSTICK_DISABLED 468 for (curr = SDL_event_watchers; curr; curr = curr->
next) {
521 if (SDL_event_watchers) {
522 for (tail = SDL_event_watchers; tail->
next; tail = tail->
next) {
525 tail->
next = watcher;
527 SDL_event_watchers = watcher;
538 for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->
next) {
539 if (curr->callback == filter && curr->userdata == userdata) {
543 SDL_event_watchers = curr->
next;
556 for (entry =
SDL_EventQ.head; entry; entry = next) {
570 Uint8 hi = ((type >> 8) & 0xff);
571 Uint8 lo = (type & 0xff);
573 if (SDL_disabled_events[hi] &&
574 (SDL_disabled_events[hi]->
bits[lo/32] & (1 << (lo&31)))) {
580 if (state != current_state)
585 if (!SDL_disabled_events[hi]) {
587 if (!SDL_disabled_events[hi]) {
592 SDL_disabled_events[hi]->
bits[lo/32] |= (1 << (lo&31));
596 SDL_disabled_events[hi]->
bits[lo/32] &= ~(1 << (lo&31));
604 return current_state;
629 event.type = eventType;
SDL_SysWMEntry * wmmsg_used
int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)
int SDL_WaitEventTimeout(SDL_Event *event, int timeout)
Waits until the specified timeout (in milliseconds) for the next available event. ...
SDL_bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata)
struct _SDL_EventEntry * next
static SDL_EventWatcher * SDL_event_watchers
void SDL_PumpEvents(void)
uint32_t Uint32
An unsigned 32-bit integer type.
GLuint GLsizei const GLchar * message
SDL_bool SDL_HasEvent(Uint32 type)
static int SDL_AddEvent(SDL_Event *event)
volatile int max_events_seen
static SDL_Event events[EVENT_BUF_SIZE]
int SDL_StartEventLoop(void)
#define SDL_MAX_QUEUED_EVENTS
int(* SDL_EventFilter)(void *userdata, SDL_Event *event)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
union SDL_SysWMmsg::@16 msg
static struct @22 SDL_EventQ
SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType)
int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
static SDL_VideoDevice * _this
struct _SDL_SysWMEntry * next
void SDL_GestureProcessEvent(SDL_Event *event)
GLuint GLuint GLsizei GLenum type
void SDL_FlushEvents(Uint32 minType, Uint32 maxType)
void * SDL_calloc(size_t nmemb, size_t size)
#define SDL_GetEventState(type)
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
uint8_t Uint8
An unsigned 8-bit integer type.
struct SDL_EventWatcher * next
SDL_EventFilter SDL_EventOK
SDL_EventType
The types of events that can be delivered.
void SDL_FlushEvent(Uint32 type)
int SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
void SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
static void SDL_CutEvent(SDL_EventEntry *entry)
Uint8 SDL_EventState(Uint32 type, int state)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_assert(condition)
#define SDL_JoystickUpdate
int SDL_SendKeymapChangedEvent(void)
void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
struct _SDL_EventEntry * prev
static Uint32 SDL_userevents
GLbitfield GLuint64 timeout
static SDL_DisabledEventBlock * SDL_disabled_events[256]
SDL_SysWMEntry * wmmsg_free
#define SDL_JoystickEventState
SDL_VideoDevice * SDL_GetVideoDevice(void)
void SDL_SendPendingQuit(void)
#define SDL_arraysize(array)
int SDL_PollEvent(SDL_Event *event)
Polls for currently pending events.
int SDL_SendAppEvent(SDL_EventType eventType)
void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
int SDL_WaitEvent(SDL_Event *event)
Waits indefinitely for the next available event.
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
void SDL_StopEventLoop(void)
void(* PumpEvents)(_THIS)
Uint32 SDL_RegisterEvents(int numevents)