diff src/events/SDL_keyboard.c @ 4429:faa9fc8e7f67

General improvements for user custom event registration * Switched event type to enum (int32) * Switched polling by mask to polling by type range * Added SDL_RegisterEvents() to allow dynamic user event registration * Spread events out to allow inserting new related events without breaking binary compatibility * Added padding to event structures so they're the same size regardless of 32-bit compiler structure packing settings * Split SDL_HasEvent() to SDL_HasEvent() for a single event and SDL_HasEvents() for a range of events * Added SDL_GetEventState() as a shortcut for SDL_EventState(X, SDL_QUERY) * Added SDL_FlushEvent() and SDL_FlushEvents() to clear events from the event queue
author Sam Lantinga <slouken@libsdl.org>
date Thu, 25 Mar 2010 01:08:26 -0700
parents f7b03b6838cb
children 5c64052fb476
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Wed Mar 10 15:07:20 2010 +0000
+++ b/src/events/SDL_keyboard.c	Thu Mar 25 01:08:26 2010 -0700
@@ -688,7 +688,7 @@
     SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
     int posted;
     Uint16 modstate;
-    Uint8 type;
+    Uint32 type;
 
     if (!keyboard || !scancode) {
         return 0;
@@ -800,7 +800,7 @@
 
     /* Post the event, if desired */
     posted = 0;
-    if (SDL_ProcessEvents[type] == SDL_ENABLE) {
+    if (SDL_GetEventState(type) == SDL_ENABLE) {
         SDL_Event event;
         event.key.type = type;
         event.key.which = (Uint8) index;
@@ -827,7 +827,7 @@
 
     /* Post the event, if desired */
     posted = 0;
-    if (SDL_ProcessEvents[SDL_TEXTINPUT] == SDL_ENABLE) {
+    if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
         SDL_Event event;
         event.text.type = SDL_TEXTINPUT;
         event.text.which = (Uint8) index;
@@ -845,7 +845,7 @@
 
     /* Post the event, if desired */
     posted = 0;
-    if (SDL_ProcessEvents[SDL_TEXTEDITING] == SDL_ENABLE) {
+    if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
         SDL_Event event;
         event.edit.type = SDL_TEXTEDITING;
         event.edit.start = start;