1.1 --- a/include/SDL_events.h Thu Dec 29 05:11:33 2011 -0500
1.2 +++ b/include/SDL_events.h Thu Dec 29 05:13:55 2011 -0500
1.3 @@ -132,6 +132,7 @@
1.4 typedef struct SDL_WindowEvent
1.5 {
1.6 Uint32 type; /**< ::SDL_WINDOWEVENT */
1.7 + Uint32 timestamp;
1.8 Uint32 windowID; /**< The associated window */
1.9 Uint8 event; /**< ::SDL_WindowEventID */
1.10 Uint8 padding1;
1.11 @@ -147,6 +148,7 @@
1.12 typedef struct SDL_KeyboardEvent
1.13 {
1.14 Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
1.15 + Uint32 timestamp;
1.16 Uint32 windowID; /**< The window with keyboard focus, if any */
1.17 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
1.18 Uint8 repeat; /**< Non-zero if this is a key repeat */
1.19 @@ -162,6 +164,7 @@
1.20 typedef struct SDL_TextEditingEvent
1.21 {
1.22 Uint32 type; /**< ::SDL_TEXTEDITING */
1.23 + Uint32 timestamp;
1.24 Uint32 windowID; /**< The window with keyboard focus, if any */
1.25 char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
1.26 int start; /**< The start cursor of selected editing text */
1.27 @@ -176,6 +179,7 @@
1.28 typedef struct SDL_TextInputEvent
1.29 {
1.30 Uint32 type; /**< ::SDL_TEXTINPUT */
1.31 + Uint32 timestamp;
1.32 Uint32 windowID; /**< The window with keyboard focus, if any */
1.33 char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
1.34 } SDL_TextInputEvent;
1.35 @@ -186,6 +190,7 @@
1.36 typedef struct SDL_MouseMotionEvent
1.37 {
1.38 Uint32 type; /**< ::SDL_MOUSEMOTION */
1.39 + Uint32 timestamp;
1.40 Uint32 windowID; /**< The window with mouse focus, if any */
1.41 Uint8 state; /**< The current button state */
1.42 Uint8 padding1;
1.43 @@ -203,6 +208,7 @@
1.44 typedef struct SDL_MouseButtonEvent
1.45 {
1.46 Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
1.47 + Uint32 timestamp;
1.48 Uint32 windowID; /**< The window with mouse focus, if any */
1.49 Uint8 button; /**< The mouse button index */
1.50 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
1.51 @@ -218,6 +224,7 @@
1.52 typedef struct SDL_MouseWheelEvent
1.53 {
1.54 Uint32 type; /**< ::SDL_MOUSEWHEEL */
1.55 + Uint32 timestamp;
1.56 Uint32 windowID; /**< The window with mouse focus, if any */
1.57 int x; /**< The amount scrolled horizontally */
1.58 int y; /**< The amount scrolled vertically */
1.59 @@ -229,6 +236,7 @@
1.60 typedef struct SDL_JoyAxisEvent
1.61 {
1.62 Uint32 type; /**< ::SDL_JOYAXISMOTION */
1.63 + Uint32 timestamp;
1.64 Uint8 which; /**< The joystick device index */
1.65 Uint8 axis; /**< The joystick axis index */
1.66 Uint8 padding1;
1.67 @@ -242,6 +250,7 @@
1.68 typedef struct SDL_JoyBallEvent
1.69 {
1.70 Uint32 type; /**< ::SDL_JOYBALLMOTION */
1.71 + Uint32 timestamp;
1.72 Uint8 which; /**< The joystick device index */
1.73 Uint8 ball; /**< The joystick trackball index */
1.74 Uint8 padding1;
1.75 @@ -256,6 +265,7 @@
1.76 typedef struct SDL_JoyHatEvent
1.77 {
1.78 Uint32 type; /**< ::SDL_JOYHATMOTION */
1.79 + Uint32 timestamp;
1.80 Uint8 which; /**< The joystick device index */
1.81 Uint8 hat; /**< The joystick hat index */
1.82 Uint8 value; /**< The hat position value.
1.83 @@ -274,6 +284,7 @@
1.84 typedef struct SDL_JoyButtonEvent
1.85 {
1.86 Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
1.87 + Uint32 timestamp;
1.88 Uint8 which; /**< The joystick device index */
1.89 Uint8 button; /**< The joystick button index */
1.90 Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
1.91 @@ -288,6 +299,7 @@
1.92 {
1.93 Uint32 type; /**< ::SDL_FINGERMOTION OR
1.94 SDL_FINGERDOWN OR SDL_FINGERUP*/
1.95 + Uint32 timestamp;
1.96 Uint32 windowID; /**< The window with mouse focus, if any */
1.97 SDL_TouchID touchId; /**< The touch device id */
1.98 SDL_FingerID fingerId;
1.99 @@ -309,6 +321,7 @@
1.100 typedef struct SDL_TouchButtonEvent
1.101 {
1.102 Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
1.103 + Uint32 timestamp;
1.104 Uint32 windowID; /**< The window with mouse focus, if any */
1.105 SDL_TouchID touchId; /**< The touch device index */
1.106 Uint8 state; /**< The current button state */
1.107 @@ -324,6 +337,7 @@
1.108 typedef struct SDL_MultiGestureEvent
1.109 {
1.110 Uint32 type; /**< ::SDL_MULTIGESTURE */
1.111 + Uint32 timestamp;
1.112 Uint32 windowID; /**< The window with mouse focus, if any */
1.113 SDL_TouchID touchId; /**< The touch device index */
1.114 float dTheta;
1.115 @@ -338,6 +352,7 @@
1.116 typedef struct SDL_DollarGestureEvent
1.117 {
1.118 Uint32 type; /**< ::SDL_DOLLARGESTURE */
1.119 + Uint32 timestamp;
1.120 Uint32 windowID; /**< The window with mouse focus, if any */
1.121 SDL_TouchID touchId; /**< The touch device index */
1.122 SDL_GestureID gestureId;
1.123 @@ -359,6 +374,7 @@
1.124 typedef struct SDL_DropEvent
1.125 {
1.126 Uint32 type; /**< ::SDL_DROPFILE */
1.127 + Uint32 timestamp;
1.128 char *file; /**< The file name, which should be freed with SDL_free() */
1.129 } SDL_DropEvent;
1.130
1.131 @@ -369,6 +385,7 @@
1.132 typedef struct SDL_QuitEvent
1.133 {
1.134 Uint32 type; /**< ::SDL_QUIT */
1.135 + Uint32 timestamp;
1.136 } SDL_QuitEvent;
1.137
1.138
1.139 @@ -378,6 +395,7 @@
1.140 typedef struct SDL_UserEvent
1.141 {
1.142 Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
1.143 + Uint32 timestamp;
1.144 Uint32 windowID; /**< The associated window if any */
1.145 int code; /**< User defined event code */
1.146 void *data1; /**< User defined data pointer */
1.147 @@ -397,6 +415,7 @@
1.148 typedef struct SDL_SysWMEvent
1.149 {
1.150 Uint32 type; /**< ::SDL_SYSWMEVENT */
1.151 + Uint32 timestamp;
1.152 SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
1.153 } SDL_SysWMEvent;
1.154
1.155 @@ -413,6 +432,7 @@
1.156 typedef struct SDL_ActiveEvent
1.157 {
1.158 Uint32 type;
1.159 + Uint32 timestamp;
1.160 Uint8 gain;
1.161 Uint8 state;
1.162 } SDL_ActiveEvent;
1.163 @@ -420,6 +440,7 @@
1.164 typedef struct SDL_ResizeEvent
1.165 {
1.166 Uint32 type;
1.167 + Uint32 timestamp;
1.168 int w;
1.169 int h;
1.170 } SDL_ResizeEvent;
2.1 --- a/src/events/SDL_events.c Thu Dec 29 05:11:33 2011 -0500
2.2 +++ b/src/events/SDL_events.c Thu Dec 29 05:13:55 2011 -0500
2.3 @@ -358,7 +358,7 @@
2.4 SDL_PushEvent(SDL_Event * event)
2.5 {
2.6 SDL_EventWatcher *curr;
2.7 -
2.8 + event->window.timestamp = SDL_GetTicks();
2.9 if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
2.10 return 0;
2.11 }