|
@@ -68,7 +68,7 @@ typedef struct
|
|
|
} SDL_DisabledEventBlock;
|
|
|
|
|
|
static SDL_DisabledEventBlock *SDL_disabled_events[256];
|
|
|
-static Uint32 SDL_userevents = SDL_USEREVENT;
|
|
|
+static Uint32 SDL_userevents = SDL_EVENT_USER;
|
|
|
|
|
|
/* Private data -- event queue */
|
|
|
typedef struct SDL_EventEntry
|
|
@@ -122,7 +122,7 @@ static void SDLCALL SDL_AutoUpdateSensorsChanged(void *userdata, const char *nam
|
|
|
|
|
|
static void SDLCALL SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
|
|
{
|
|
|
- SDL_SetEventEnabled(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE));
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_POLL_SENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -146,16 +146,16 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
|
|
|
/* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */
|
|
|
if ((SDL_EventLoggingVerbosity < 2) &&
|
|
|
- ((event->type == SDL_MOUSEMOTION) ||
|
|
|
- (event->type == SDL_FINGERMOTION) ||
|
|
|
- (event->type == SDL_GAMEPADTOUCHPADMOTION) ||
|
|
|
- (event->type == SDL_GAMEPADSENSORUPDATE) ||
|
|
|
- (event->type == SDL_SENSORUPDATE))) {
|
|
|
+ ((event->type == SDL_EVENT_MOUSE_MOTION) ||
|
|
|
+ (event->type == SDL_EVENT_FINGER_MOTION) ||
|
|
|
+ (event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION) ||
|
|
|
+ (event->type == SDL_EVENT_GAMEPAD_SENSOR_UPDATE) ||
|
|
|
+ (event->type == SDL_EVENT_SENSOR_UPDATE))) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/* window manager events are even more spammy, and don't provide much useful info. */
|
|
|
- if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_SYSWMEVENT)) {
|
|
|
+ if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_EVENT_SYSWM)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -167,11 +167,11 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
|
|
|
/* !!! FIXME: This code is kinda ugly, sorry. */
|
|
|
|
|
|
- if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) {
|
|
|
+ if ((event->type >= SDL_EVENT_USER) && (event->type <= SDL_EVENT_LAST)) {
|
|
|
char plusstr[16];
|
|
|
- SDL_strlcpy(name, "SDL_USEREVENT", sizeof(name));
|
|
|
- if (event->type > SDL_USEREVENT) {
|
|
|
- (void)SDL_snprintf(plusstr, sizeof(plusstr), "+%u", ((uint)event->type) - SDL_USEREVENT);
|
|
|
+ SDL_strlcpy(name, "SDL_EVENT_USER", sizeof(name));
|
|
|
+ if (event->type > SDL_EVENT_USER) {
|
|
|
+ (void)SDL_snprintf(plusstr, sizeof(plusstr), "+%u", ((uint)event->type) - SDL_EVENT_USER);
|
|
|
} else {
|
|
|
plusstr[0] = '\0';
|
|
|
}
|
|
@@ -184,33 +184,33 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
#define SDL_EVENT_CASE(x) \
|
|
|
case x: \
|
|
|
SDL_strlcpy(name, #x, sizeof(name));
|
|
|
- SDL_EVENT_CASE(SDL_FIRSTEVENT)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_FIRST)
|
|
|
SDL_strlcpy(details, " (THIS IS PROBABLY A BUG!)", sizeof(details));
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_QUIT)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_QUIT)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->quit.timestamp);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_TERMINATING)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_TERMINATING)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_LOWMEMORY)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_LOW_MEMORY)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_WILL_ENTER_BACKGROUND)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DID_ENTER_BACKGROUND)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_WILL_ENTER_FOREGROUND)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DID_ENTER_FOREGROUND)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_LOCALECHANGED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_LOCALE_CHANGED)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_KEYMAPCHANGED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_KEYMAP_CHANGED)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_CLIPBOARD_UPDATE)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_RENDER_TARGETS_RESET)
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_RENDER_DEVICE_RESET)
|
|
|
break;
|
|
|
|
|
|
#define SDL_DISPLAYEVENT_CASE(x) \
|
|
@@ -219,10 +219,10 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u display=%u event=%s data1=%d)", \
|
|
|
(uint)event->display.timestamp, (uint)event->display.display, name, (int)event->display.data1); \
|
|
|
break
|
|
|
- SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_ORIENTATION);
|
|
|
- SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_CONNECTED);
|
|
|
- SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_DISCONNECTED);
|
|
|
- SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_MOVED);
|
|
|
+ SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_ORIENTATION);
|
|
|
+ SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_CONNECTED);
|
|
|
+ SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_DISCONNECTED);
|
|
|
+ SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_MOVED);
|
|
|
#undef SDL_DISPLAYEVENT_CASE
|
|
|
|
|
|
#define SDL_WINDOWEVENT_CASE(x) \
|
|
@@ -231,27 +231,27 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u event=%s data1=%d data2=%d)", \
|
|
|
(uint)event->window.timestamp, (uint)event->window.windowID, name, (int)event->window.data1, (int)event->window.data2); \
|
|
|
break
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ICCPROF_CHANGED);
|
|
|
- SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_DISPLAY_CHANGED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_SHOWN);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_HIDDEN);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_EXPOSED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOVED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_RESIZED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_SIZE_CHANGED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MINIMIZED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MAXIMIZED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_RESTORED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_ENTER);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_LEAVE);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_GAINED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_LOST);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_CLOSE_REQUESTED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_TAKE_FOCUS);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_HIT_TEST);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_ICCPROF_CHANGED);
|
|
|
+ SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_DISPLAY_CHANGED);
|
|
|
#undef SDL_WINDOWEVENT_CASE
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_SYSWMEVENT)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_SYSWM)
|
|
|
/* !!! FIXME: we don't delve further at the moment. */
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->syswm.timestamp);
|
|
|
break;
|
|
@@ -264,25 +264,25 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(uint)event->key.keysym.scancode, \
|
|
|
(uint)event->key.keysym.sym, \
|
|
|
(uint)event->key.keysym.mod)
|
|
|
- SDL_EVENT_CASE(SDL_KEYDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_KEY_DOWN)
|
|
|
PRINT_KEY_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_KEYUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_KEY_UP)
|
|
|
PRINT_KEY_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_KEY_EVENT
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_TEXTEDITING)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_TEXT_EDITING)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)",
|
|
|
(uint)event->edit.timestamp, (uint)event->edit.windowID,
|
|
|
event->edit.text, (int)event->edit.start, (int)event->edit.length);
|
|
|
break;
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_TEXTINPUT)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_TEXT_INPUT)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s')", (uint)event->text.timestamp, (uint)event->text.windowID, event->text.text);
|
|
|
break;
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_MOUSEMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_MOUSE_MOTION)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u state=%u x=%g y=%g xrel=%g yrel=%g)",
|
|
|
(uint)event->motion.timestamp, (uint)event->motion.windowID,
|
|
|
(uint)event->motion.which, (uint)event->motion.state,
|
|
@@ -296,28 +296,28 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(uint)event->button.which, (uint)event->button.button, \
|
|
|
event->button.state == SDL_PRESSED ? "pressed" : "released", \
|
|
|
(uint)event->button.clicks, event->button.x, event->button.y)
|
|
|
- SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONDOWN)
|
|
|
PRINT_MBUTTON_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_MOUSEBUTTONUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONUP)
|
|
|
PRINT_MBUTTON_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_MBUTTON_EVENT
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_MOUSEWHEEL)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_MOUSE_WHEEL)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u x=%g y=%g direction=%s)",
|
|
|
(uint)event->wheel.timestamp, (uint)event->wheel.windowID,
|
|
|
(uint)event->wheel.which, event->wheel.x, event->wheel.y,
|
|
|
event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
|
|
|
break;
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_JOYAXISMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_AXIS_MOTION)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
|
|
(uint)event->jaxis.timestamp, (int)event->jaxis.which,
|
|
|
(uint)event->jaxis.axis, (int)event->jaxis.value);
|
|
|
break;
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_JOYHATMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_HAT_MOTION)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d hat=%u value=%u)",
|
|
|
(uint)event->jhat.timestamp, (int)event->jhat.which,
|
|
|
(uint)event->jhat.hat, (uint)event->jhat.value);
|
|
@@ -327,24 +327,24 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
|
|
(uint)event->jbutton.timestamp, (int)event->jbutton.which, \
|
|
|
(uint)event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released")
|
|
|
- SDL_EVENT_CASE(SDL_JOYBUTTONDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BUTTON_DOWN)
|
|
|
PRINT_JBUTTON_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_JOYBUTTONUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BUTTON_UP)
|
|
|
PRINT_JBUTTON_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_JBUTTON_EVENT
|
|
|
|
|
|
#define PRINT_JOYDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->jdevice.timestamp, (int)event->jdevice.which)
|
|
|
- SDL_EVENT_CASE(SDL_JOYDEVICEADDED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_ADDED)
|
|
|
PRINT_JOYDEV_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_REMOVED)
|
|
|
PRINT_JOYDEV_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_JOYDEV_EVENT
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADAXISMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_AXIS_MOTION)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
|
|
(uint)event->caxis.timestamp, (int)event->caxis.which,
|
|
|
(uint)event->caxis.axis, (int)event->caxis.value);
|
|
@@ -354,22 +354,22 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
|
|
(uint)event->cbutton.timestamp, (int)event->cbutton.which, \
|
|
|
(uint)event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released")
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADBUTTONDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_BUTTON_DOWN)
|
|
|
PRINT_CBUTTON_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADBUTTONUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_BUTTON_UP)
|
|
|
PRINT_CBUTTON_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_CBUTTON_EVENT
|
|
|
|
|
|
#define PRINT_GAMEPADDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->cdevice.timestamp, (int)event->cdevice.which)
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADADDED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_ADDED)
|
|
|
PRINT_GAMEPADDEV_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADREMOVED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_REMOVED)
|
|
|
PRINT_GAMEPADDEV_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADREMAPPED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_REMAPPED)
|
|
|
PRINT_GAMEPADDEV_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_GAMEPADDEV_EVENT
|
|
@@ -379,18 +379,18 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(uint)event->ctouchpad.timestamp, (int)event->ctouchpad.which, \
|
|
|
(int)event->ctouchpad.touchpad, (int)event->ctouchpad.finger, \
|
|
|
event->ctouchpad.x, event->ctouchpad.y, event->ctouchpad.pressure)
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN)
|
|
|
PRINT_CTOUCHPAD_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_UP)
|
|
|
PRINT_CTOUCHPAD_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION)
|
|
|
PRINT_CTOUCHPAD_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_CTOUCHPAD_EVENT
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_GAMEPADSENSORUPDATE)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d sensor=%d data[0]=%f data[1]=%f data[2]=%f)",
|
|
|
(uint)event->csensor.timestamp, (int)event->csensor.which, (int)event->csensor.sensor,
|
|
|
event->csensor.data[0], event->csensor.data[1], event->csensor.data[2]);
|
|
@@ -401,42 +401,42 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
(uint)event->tfinger.timestamp, (long long)event->tfinger.touchId, \
|
|
|
(long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
|
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
|
|
- SDL_EVENT_CASE(SDL_FINGERDOWN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_FINGER_DOWN)
|
|
|
PRINT_FINGER_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_FINGERUP)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_FINGER_UP)
|
|
|
PRINT_FINGER_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_FINGERMOTION)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_FINGER_MOTION)
|
|
|
PRINT_FINGER_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_FINGER_EVENT
|
|
|
|
|
|
#define PRINT_DROP_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint)event->drop.timestamp, (uint)event->drop.windowID)
|
|
|
- SDL_EVENT_CASE(SDL_DROPFILE)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DROP_FILE)
|
|
|
PRINT_DROP_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_DROPTEXT)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DROP_TEXT)
|
|
|
PRINT_DROP_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_DROPBEGIN)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DROP_BEGIN)
|
|
|
PRINT_DROP_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_DROPCOMPLETE)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_DROP_COMPLETE)
|
|
|
PRINT_DROP_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_DROP_EVENT
|
|
|
|
|
|
#define PRINT_AUDIODEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u iscapture=%s)", (uint)event->adevice.timestamp, (uint)event->adevice.which, event->adevice.iscapture ? "true" : "false")
|
|
|
- SDL_EVENT_CASE(SDL_AUDIODEVICEADDED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_AUDIO_DEVICE_ADDED)
|
|
|
PRINT_AUDIODEV_EVENT(event);
|
|
|
break;
|
|
|
- SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_AUDIO_DEVICE_REMOVED)
|
|
|
PRINT_AUDIODEV_EVENT(event);
|
|
|
break;
|
|
|
#undef PRINT_AUDIODEV_EVENT
|
|
|
|
|
|
- SDL_EVENT_CASE(SDL_SENSORUPDATE)
|
|
|
+ SDL_EVENT_CASE(SDL_EVENT_SENSOR_UPDATE)
|
|
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d data[0]=%f data[1]=%f data[2]=%f data[3]=%f data[4]=%f data[5]=%f)",
|
|
|
(uint)event->sensor.timestamp, (int)event->sensor.which,
|
|
|
event->sensor.data[0], event->sensor.data[1], event->sensor.data[2],
|
|
@@ -445,7 +445,7 @@ static void SDL_LogEvent(const SDL_Event *event)
|
|
|
|
|
|
#undef SDL_EVENT_CASE
|
|
|
|
|
|
- case SDL_POLLSENTINEL:
|
|
|
+ case SDL_EVENT_POLL_SENTINEL:
|
|
|
/* No logging necessary for this one */
|
|
|
break;
|
|
|
|
|
@@ -542,7 +542,7 @@ void SDL_StopEventLoop(void)
|
|
|
int SDL_StartEventLoop(void)
|
|
|
{
|
|
|
/* We'll leave the event queue alone, since we might have gotten
|
|
|
- some important events at launch (like SDL_DROPFILE)
|
|
|
+ some important events at launch (like SDL_EVENT_DROP_FILE)
|
|
|
|
|
|
FIXME: Does this introduce any other bugs with events at startup?
|
|
|
*/
|
|
@@ -567,12 +567,12 @@ int SDL_StartEventLoop(void)
|
|
|
#endif /* !SDL_THREADS_DISABLED */
|
|
|
|
|
|
/* Process most event types */
|
|
|
- SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_FALSE);
|
|
|
- SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_FALSE);
|
|
|
- SDL_SetEventEnabled(SDL_SYSWMEVENT, SDL_FALSE);
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_FALSE);
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_SYSWM, SDL_FALSE);
|
|
|
#if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */
|
|
|
- SDL_SetEventEnabled(SDL_DROPFILE, SDL_FALSE);
|
|
|
- SDL_SetEventEnabled(SDL_DROPTEXT, SDL_FALSE);
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_FALSE);
|
|
|
+ SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_FALSE);
|
|
|
#endif
|
|
|
|
|
|
SDL_EventQ.active = SDL_TRUE;
|
|
@@ -607,9 +607,9 @@ static int SDL_AddEvent(SDL_Event *event)
|
|
|
}
|
|
|
|
|
|
entry->event = *event;
|
|
|
- if (event->type == SDL_POLLSENTINEL) {
|
|
|
+ if (event->type == SDL_EVENT_POLL_SENTINEL) {
|
|
|
SDL_AtomicAdd(&SDL_sentinel_pending, 1);
|
|
|
- } else if (event->type == SDL_SYSWMEVENT) {
|
|
|
+ } else if (event->type == SDL_EVENT_SYSWM) {
|
|
|
entry->msg = *event->syswm.msg;
|
|
|
entry->event.syswm.msg = &entry->msg;
|
|
|
}
|
|
@@ -654,7 +654,7 @@ static void SDL_CutEvent(SDL_EventEntry *entry)
|
|
|
SDL_EventQ.tail = entry->prev;
|
|
|
}
|
|
|
|
|
|
- if (entry->event.type == SDL_POLLSENTINEL) {
|
|
|
+ if (entry->event.type == SDL_EVENT_POLL_SENTINEL) {
|
|
|
SDL_AtomicAdd(&SDL_sentinel_pending, -1);
|
|
|
}
|
|
|
|
|
@@ -732,7 +732,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventact
|
|
|
if (minType <= type && type <= maxType) {
|
|
|
if (events) {
|
|
|
events[used] = entry->event;
|
|
|
- if (entry->event.type == SDL_SYSWMEVENT) {
|
|
|
+ if (entry->event.type == SDL_EVENT_SYSWM) {
|
|
|
/* We need to copy the wmmsg somewhere safe.
|
|
|
For now we'll guarantee it's valid at least until
|
|
|
the next call to SDL_PeepEvents()
|
|
@@ -753,7 +753,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventact
|
|
|
SDL_CutEvent(entry);
|
|
|
}
|
|
|
}
|
|
|
- if (type == SDL_POLLSENTINEL) {
|
|
|
+ if (type == SDL_EVENT_POLL_SENTINEL) {
|
|
|
/* Special handling for the sentinel event */
|
|
|
if (!include_sentinel) {
|
|
|
/* Skip it, we don't want to include it */
|
|
@@ -865,10 +865,10 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
|
|
|
|
|
|
SDL_SendPendingSignalEvents(); /* in case we had a signal handler fire, etc. */
|
|
|
|
|
|
- if (push_sentinel && SDL_EventEnabled(SDL_POLLSENTINEL)) {
|
|
|
+ if (push_sentinel && SDL_EventEnabled(SDL_EVENT_POLL_SENTINEL)) {
|
|
|
SDL_Event sentinel;
|
|
|
|
|
|
- sentinel.type = SDL_POLLSENTINEL;
|
|
|
+ sentinel.type = SDL_EVENT_POLL_SENTINEL;
|
|
|
sentinel.common.timestamp = 0;
|
|
|
SDL_PushEvent(&sentinel);
|
|
|
}
|
|
@@ -918,7 +918,7 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
|
|
|
|
|
|
SDL_LockMutex(_this->wakeup_lock);
|
|
|
{
|
|
|
- status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
|
|
+ status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST);
|
|
|
/* If status == 0 we are going to block so wakeup will be needed. */
|
|
|
if (status == 0) {
|
|
|
_this->wakeup_window = wakeup_window;
|
|
@@ -1027,13 +1027,13 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
|
|
}
|
|
|
|
|
|
/* First check for existing events */
|
|
|
- result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel);
|
|
|
+ result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST, include_sentinel);
|
|
|
if (result < 0) {
|
|
|
return 0;
|
|
|
}
|
|
|
if (include_sentinel) {
|
|
|
if (event) {
|
|
|
- if (event->type == SDL_POLLSENTINEL) {
|
|
|
+ if (event->type == SDL_EVENT_POLL_SENTINEL) {
|
|
|
/* Reached the end of a poll cycle, and not willing to wait */
|
|
|
return 0;
|
|
|
}
|
|
@@ -1041,9 +1041,9 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
|
|
/* Need to peek the next event to check for sentinel */
|
|
|
SDL_Event dummy;
|
|
|
|
|
|
- if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) &&
|
|
|
- dummy.type == SDL_POLLSENTINEL) {
|
|
|
- SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_POLLSENTINEL, SDL_POLLSENTINEL, SDL_TRUE);
|
|
|
+ if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST, SDL_TRUE) &&
|
|
|
+ dummy.type == SDL_EVENT_POLL_SENTINEL) {
|
|
|
+ SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_EVENT_POLL_SENTINEL, SDL_EVENT_POLL_SENTINEL, SDL_TRUE);
|
|
|
/* Reached the end of a poll cycle, and not willing to wait */
|
|
|
return 0;
|
|
|
}
|
|
@@ -1085,7 +1085,7 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
|
|
|
|
|
for (;;) {
|
|
|
SDL_PumpEventsInternal(SDL_TRUE);
|
|
|
- switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
|
|
|
+ switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST)) {
|
|
|
case -1:
|
|
|
return 0;
|
|
|
case 0:
|
|
@@ -1158,7 +1158,7 @@ void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
|
|
|
/* Set filter and discard pending events */
|
|
|
SDL_EventOK.callback = filter;
|
|
|
SDL_EventOK.userdata = userdata;
|
|
|
- SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
|
|
+ SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST);
|
|
|
}
|
|
|
SDL_UnlockMutex(SDL_event_watchers_lock);
|
|
|
}
|
|
@@ -1272,7 +1272,7 @@ void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled)
|
|
|
|
|
|
/* turn off drag'n'drop support if we've disabled the events.
|
|
|
This might change some UI details at the OS level. */
|
|
|
- if (type == SDL_DROPFILE || type == SDL_DROPTEXT) {
|
|
|
+ if (type == SDL_EVENT_DROP_FILE || type == SDL_EVENT_DROP_TEXT) {
|
|
|
SDL_ToggleDragAndDropSupport();
|
|
|
}
|
|
|
}
|
|
@@ -1295,7 +1295,7 @@ Uint32 SDL_RegisterEvents(int numevents)
|
|
|
{
|
|
|
Uint32 event_base;
|
|
|
|
|
|
- if ((numevents > 0) && (SDL_userevents + numevents <= SDL_LASTEVENT)) {
|
|
|
+ if ((numevents > 0) && (SDL_userevents + numevents <= SDL_EVENT_LAST)) {
|
|
|
event_base = SDL_userevents;
|
|
|
SDL_userevents += numevents;
|
|
|
} else {
|
|
@@ -1323,10 +1323,10 @@ int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
|
|
|
int posted;
|
|
|
|
|
|
posted = 0;
|
|
|
- if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
|
|
|
+ if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
|
|
SDL_Event event;
|
|
|
SDL_memset(&event, 0, sizeof(event));
|
|
|
- event.type = SDL_SYSWMEVENT;
|
|
|
+ event.type = SDL_EVENT_SYSWM;
|
|
|
event.common.timestamp = 0;
|
|
|
event.syswm.msg = message;
|
|
|
posted = (SDL_PushEvent(&event) > 0);
|
|
@@ -1337,12 +1337,12 @@ int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
|
|
|
|
|
|
int SDL_SendKeymapChangedEvent(void)
|
|
|
{
|
|
|
- return SDL_SendAppEvent(SDL_KEYMAPCHANGED);
|
|
|
+ return SDL_SendAppEvent(SDL_EVENT_KEYMAP_CHANGED);
|
|
|
}
|
|
|
|
|
|
int SDL_SendLocaleChangedEvent(void)
|
|
|
{
|
|
|
- return SDL_SendAppEvent(SDL_LOCALECHANGED);
|
|
|
+ return SDL_SendAppEvent(SDL_EVENT_LOCALE_CHANGED);
|
|
|
}
|
|
|
|
|
|
int SDL_InitEvents(void)
|