Renamed SDL events for clarity

Fixes https://github.com/libsdl-org/SDL/issues/6877
This commit is contained in:
Sam Lantinga 2023-01-23 17:54:09 -08:00
parent 74697bc351
commit 7b50bae524
101 changed files with 1375 additions and 862 deletions

View File

@ -2005,3 +2005,319 @@ expression e;
@@
- e | 0
+ e
@@
@@
- SDL_FIRSTEVENT
+ SDL_EVENT_FIRST
@@
@@
- SDL_QUIT
+ SDL_EVENT_QUIT
@@
@@
- SDL_APP_TERMINATING
+ SDL_EVENT_TERMINATING
@@
@@
- SDL_APP_LOWMEMORY
+ SDL_EVENT_LOW_MEMORY
@@
@@
- SDL_APP_WILLENTERBACKGROUND
+ SDL_EVENT_WILL_ENTER_BACKGROUND
@@
@@
- SDL_APP_DIDENTERBACKGROUND
+ SDL_EVENT_DID_ENTER_BACKGROUND
@@
@@
- SDL_APP_WILLENTERFOREGROUND
+ SDL_EVENT_WILL_ENTER_FOREGROUND
@@
@@
- SDL_APP_DIDENTERFOREGROUND
+ SDL_EVENT_DID_ENTER_FOREGROUND
@@
@@
- SDL_LOCALECHANGED
+ SDL_EVENT_LOCALE_CHANGED
@@
@@
- SDL_DISPLAYEVENT_ORIENTATION
+ SDL_EVENT_DISPLAY_ORIENTATION
@@
@@
- SDL_DISPLAYEVENT_CONNECTED
+ SDL_EVENT_DISPLAY_CONNECTED
@@
@@
- SDL_DISPLAYEVENT_DISCONNECTED
+ SDL_EVENT_DISPLAY_DISCONNECTED
@@
@@
- SDL_DISPLAYEVENT_MOVED
+ SDL_EVENT_DISPLAY_MOVED
@@
@@
- SDL_DISPLAYEVENT_FIRST
+ SDL_EVENT_DISPLAY_FIRST
@@
@@
- SDL_DISPLAYEVENT_LAST
+ SDL_EVENT_DISPLAY_LAST
@@
@@
- SDL_SYSWMEVENT
+ SDL_EVENT_SYSWM
@@
@@
- SDL_WINDOWEVENT_SHOWN
+ SDL_EVENT_WINDOW_SHOWN
@@
@@
- SDL_WINDOWEVENT_HIDDEN
+ SDL_EVENT_WINDOW_HIDDEN
@@
@@
- SDL_WINDOWEVENT_EXPOSED
+ SDL_EVENT_WINDOW_EXPOSED
@@
@@
- SDL_WINDOWEVENT_MOVED
+ SDL_EVENT_WINDOW_MOVED
@@
@@
- SDL_WINDOWEVENT_RESIZED
+ SDL_EVENT_WINDOW_RESIZED
@@
@@
- SDL_WINDOWEVENT_SIZE_CHANGED
+ SDL_EVENT_WINDOW_SIZE_CHANGED
@@
@@
- SDL_WINDOWEVENT_MINIMIZED
+ SDL_EVENT_WINDOW_MINIMIZED
@@
@@
- SDL_WINDOWEVENT_MAXIMIZED
+ SDL_EVENT_WINDOW_MAXIMIZED
@@
@@
- SDL_WINDOWEVENT_RESTORED
+ SDL_EVENT_WINDOW_RESTORED
@@
@@
- SDL_WINDOWEVENT_ENTER
+ SDL_EVENT_WINDOW_MOUSE_ENTER
@@
@@
- SDL_WINDOWEVENT_LEAVE
+ SDL_EVENT_WINDOW_MOUSE_LEAVE
@@
@@
- SDL_WINDOWEVENT_FOCUS_GAINED
+ SDL_EVENT_WINDOW_FOCUS_GAINED
@@
@@
- SDL_WINDOWEVENT_FOCUS_LOST
+ SDL_EVENT_WINDOW_FOCUS_LOST
@@
@@
- SDL_WINDOWEVENT_CLOSE
+ SDL_EVENT_WINDOW_CLOSE_REQUESTED
@@
@@
- SDL_WINDOWEVENT_TAKE_FOCUS
+ SDL_EVENT_WINDOW_TAKE_FOCUS
@@
@@
- SDL_WINDOWEVENT_HIT_TEST
+ SDL_EVENT_WINDOW_HIT_TEST
@@
@@
- SDL_WINDOWEVENT_ICCPROF_CHANGED
+ SDL_EVENT_WINDOW_ICCPROF_CHANGED
@@
@@
- SDL_WINDOWEVENT_DISPLAY_CHANGED
+ SDL_EVENT_WINDOW_DISPLAY_CHANGED
@@
@@
- SDL_WINDOWEVENT_FIRST
+ SDL_EVENT_WINDOW_FIRST
@@
@@
- SDL_WINDOWEVENT_LAST
+ SDL_EVENT_WINDOW_LAST
@@
@@
- SDL_KEYDOWN
+ SDL_EVENT_KEY_DOWN
@@
@@
- SDL_KEYUP
+ SDL_EVENT_KEY_UP
@@
@@
- SDL_TEXTEDITING
+ SDL_EVENT_TEXT_EDITING
@@
@@
- SDL_TEXTINPUT
+ SDL_EVENT_TEXT_INPUT
@@
@@
- SDL_KEYMAPCHANGED
+ SDL_EVENT_KEYMAP_CHANGED
@@
@@
- SDL_TEXTEDITING_EXT
+ SDL_EVENT_TEXTEDITING_EXT
@@
@@
- SDL_MOUSEMOTION
+ SDL_EVENT_MOUSE_MOTION
@@
@@
- SDL_MOUSEBUTTONDOWN
+ SDL_EVENT_MOUSE_BUTTONDOWN
@@
@@
- SDL_MOUSEBUTTONUP
+ SDL_EVENT_MOUSE_BUTTONUP
@@
@@
- SDL_MOUSEWHEEL
+ SDL_EVENT_MOUSE_WHEEL
@@
@@
- SDL_JOYAXISMOTION
+ SDL_EVENT_JOYSTICK_AXIS_MOTION
@@
@@
- SDL_JOYHATMOTION
+ SDL_EVENT_JOYSTICK_HAT_MOTION
@@
@@
- SDL_JOYBUTTONDOWN
+ SDL_EVENT_JOYSTICK_BUTTON_DOWN
@@
@@
- SDL_JOYBUTTONUP
+ SDL_EVENT_JOYSTICK_BUTTON_UP
@@
@@
- SDL_JOYDEVICEADDED
+ SDL_EVENT_JOYSTICK_ADDED
@@
@@
- SDL_JOYDEVICEREMOVED
+ SDL_EVENT_JOYSTICK_REMOVED
@@
@@
- SDL_JOYBATTERYUPDATED
+ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
@@
@@
- SDL_GAMEPADAXISMOTION
+ SDL_EVENT_GAMEPAD_AXIS_MOTION
@@
@@
- SDL_GAMEPADBUTTONDOWN
+ SDL_EVENT_GAMEPAD_BUTTON_DOWN
@@
@@
- SDL_GAMEPADBUTTONUP
+ SDL_EVENT_GAMEPAD_BUTTON_UP
@@
@@
- SDL_GAMEPADADDED
+ SDL_EVENT_GAMEPAD_ADDED
@@
@@
- SDL_GAMEPADREMOVED
+ SDL_EVENT_GAMEPAD_REMOVED
@@
@@
- SDL_GAMEPADREMAPPED
+ SDL_EVENT_GAMEPAD_REMAPPED
@@
@@
- SDL_GAMEPADTOUCHPADDOWN
+ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
@@
@@
- SDL_GAMEPADTOUCHPADMOTION
+ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
@@
@@
- SDL_GAMEPADTOUCHPADUP
+ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
@@
@@
- SDL_GAMEPADSENSORUPDATE
+ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
@@
@@
- SDL_FINGERDOWN
+ SDL_EVENT_FINGER_DOWN
@@
@@
- SDL_FINGERUP
+ SDL_EVENT_FINGER_UP
@@
@@
- SDL_FINGERMOTION
+ SDL_EVENT_FINGER_MOTION
@@
@@
- SDL_CLIPBOARDUPDATE
+ SDL_EVENT_CLIPBOARD_UPDATE
@@
@@
- SDL_DROPFILE
+ SDL_EVENT_DROP_FILE
@@
@@
- SDL_DROPTEXT
+ SDL_EVENT_DROP_TEXT
@@
@@
- SDL_DROPBEGIN
+ SDL_EVENT_DROP_BEGIN
@@
@@
- SDL_DROPCOMPLETE
+ SDL_EVENT_DROP_COMPLETE
@@
@@
- SDL_AUDIODEVICEADDED
+ SDL_EVENT_AUDIO_DEVICE_ADDED
@@
@@
- SDL_AUDIODEVICEREMOVED
+ SDL_EVENT_AUDIO_DEVICE_REMOVED
@@
@@
- SDL_SENSORUPDATE
+ SDL_EVENT_SENSOR_UPDATE
@@
@@
- SDL_RENDER_TARGETS_RESET
+ SDL_EVENT_RENDER_TARGETS_RESET
@@
@@
- SDL_RENDER_DEVICE_RESET
+ SDL_EVENT_RENDER_DEVICE_RESET
@@
@@
- SDL_POLLSENTINEL
+ SDL_EVENT_POLL_SENTINEL
@@
@@
- SDL_USEREVENT
+ SDL_EVENT_USER
@@
@@
- SDL_LASTEVENT
+ SDL_EVENT_LAST

View File

@ -195,20 +195,20 @@ app can continue to operate as it was.
However, there's a chance (on older hardware, or on systems under heavy load),
where the GL context can not be restored. In that case you have to listen for
a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
a specific message (SDL_EVENT_RENDER_DEVICE_RESET) and restore your textures
manually or quit the app.
You should not use the SDL renderer API while the app going in background:
- SDL_APP_WILLENTERBACKGROUND:
- SDL_EVENT_WILL_ENTER_BACKGROUND:
after you read this message, GL context gets backed-up and you should not
use the SDL renderer API.
When this event is received, you have to set the render target to NULL, if you're using it.
(eg call SDL_SetRenderTarget(renderer, NULL))
- SDL_APP_DIDENTERFOREGROUND:
- SDL_EVENT_DID_ENTER_FOREGROUND:
GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET).
receive SDL_EVENT_RENDER_DEVICE_RESET).
Mouse / Touch events
================================================================================
@ -456,12 +456,12 @@ Two legitimate ways:
Activity by calling Activity.finish().
- Android OS can decide to terminate your application by calling onDestroy()
(see Activity life cycle). Your application will receive a SDL_QUIT event you
(see Activity life cycle). Your application will receive an SDL_EVENT_QUIT you
can handle to save things and quit.
Don't call exit() as it stops the activity badly.
NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
NB: "Back button" can be handled as a SDL_EVENT_KEY_DOWN/UP events, with Keycode
SDLK_AC_BACK, for any purpose.
Known issues

View File

@ -73,34 +73,34 @@ e.g.
{
switch (event->type)
{
case SDL_APP_TERMINATING:
case SDL_EVENT_TERMINATING:
/* Terminate the app.
Shut everything down before returning from this function.
*/
return 0;
case SDL_APP_LOWMEMORY:
case SDL_EVENT_LOW_MEMORY:
/* You will get this when your app is paused and iOS wants more memory.
Release as much memory as possible.
*/
return 0;
case SDL_APP_WILLENTERBACKGROUND:
case SDL_EVENT_WILL_ENTER_BACKGROUND:
/* Prepare your app to go into the background. Stop loops, etc.
This gets called when the user hits the home button, or gets a call.
*/
return 0;
case SDL_APP_DIDENTERBACKGROUND:
case SDL_EVENT_DID_ENTER_BACKGROUND:
/* This will get called if the user accepted whatever sent your app to the background.
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
If the user got a phone call and canceled it, you'll instead get an SDL_EVENT_DID_ENTER_FOREGROUND event and restart your loops.
When you get this, you have 5 seconds to save all your state or the app will be terminated.
Your app is NOT active at this point.
*/
return 0;
case SDL_APP_WILLENTERFOREGROUND:
case SDL_EVENT_WILL_ENTER_FOREGROUND:
/* This call happens when your app is coming back to the foreground.
Restore all your state here.
*/
return 0;
case SDL_APP_DIDENTERFOREGROUND:
case SDL_EVENT_DID_ENTER_FOREGROUND:
/* Restart your loops here.
Your app is interactive and getting CPU again.
*/

View File

@ -44,7 +44,7 @@ use the traditional autoconf/automake/make method, or use Xcode.
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
SDL will not register its own. This means that SDL will not terminate using
SDL_Quit if it receives a termination request, it will terminate like a
normal app, and it will not send a SDL_DROPFILE when you request to open a
normal app, and it will not send a SDL_EVENT_DROP_FILE when you request to open a
file with the app. To solve these issues, put the following code in your
NSApplicationDelegate implementation:
@ -52,9 +52,9 @@ NSApplicationDelegate implementation:
```objc
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
if (SDL_GetEventState(SDL_EVENT_QUIT) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_QUIT;
event.type = SDL_EVENT_QUIT;
SDL_PushEvent(&event);
}
@ -63,9 +63,9 @@ NSApplicationDelegate implementation:
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
if (SDL_GetEventState(SDL_EVENT_DROP_FILE) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_DROPFILE;
event.type = SDL_EVENT_DROP_FILE;
event.drop.file = SDL_strdup([filename UTF8String]);
return (SDL_PushEvent(&event) > 0);
}

View File

@ -121,23 +121,66 @@ You should set the event.common.timestamp field before passing an event to SDL_P
Mouse events use floating point values for mouse coordinates and relative motion values. You can get sub-pixel motion depending on the platform and display scaling.
The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_DISPLAYEVENT_FIRST and <= SDL_DISPLAYEVENT_LAST if you need to see whether it's a display event.
The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_EVENT_DISPLAY_FIRST and <= SDL_EVENT_DISPLAY_LAST if you need to see whether it's a display event.
The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_WINDOWEVENT_FIRST and <= SDL_WINDOWEVENT_LAST if you need to see whether it's a window event.
The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event.
SDL_QUERY, SDL_IGNORE, SDL_ENABLE, and SDL_DISABLE have been removed. You can use the functions SDL_SetEventEnabled() and SDL_EventEnabled() to set and query event processing state.
The following symbols have been renamed:
* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADREMAPPED
* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
* SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND
* SDL_APP_DIDENTERFOREGROUND => SDL_EVENT_DID_ENTER_FOREGROUND
* SDL_APP_LOWMEMORY => SDL_EVENT_LOW_MEMORY
* SDL_APP_TERMINATING => SDL_EVENT_TERMINATING
* SDL_APP_WILLENTERBACKGROUND => SDL_EVENT_WILL_ENTER_BACKGROUND
* SDL_APP_WILLENTERFOREGROUND => SDL_EVENT_WILL_ENTER_FOREGROUND
* SDL_AUDIODEVICEADDED => SDL_EVENT_AUDIO_DEVICE_ADDED
* SDL_AUDIODEVICEREMOVED => SDL_EVENT_AUDIO_DEVICE_REMOVED
* SDL_CLIPBOARDUPDATE => SDL_EVENT_CLIPBOARD_UPDATE
* SDL_CONTROLLERAXISMOTION => SDL_EVENT_GAMEPAD_AXIS_MOTION
* SDL_CONTROLLERBUTTONDOWN => SDL_EVENT_GAMEPAD_BUTTON_DOWN
* SDL_CONTROLLERBUTTONUP => SDL_EVENT_GAMEPAD_BUTTON_UP
* SDL_CONTROLLERDEVICEADDED => SDL_EVENT_GAMEPAD_ADDED
* SDL_CONTROLLERDEVICEREMAPPED => SDL_EVENT_GAMEPAD_REMAPPED
* SDL_CONTROLLERDEVICEREMOVED => SDL_EVENT_GAMEPAD_REMOVED
* SDL_CONTROLLERSENSORUPDATE => SDL_EVENT_GAMEPAD_SENSOR_UPDATE
* SDL_CONTROLLERTOUCHPADDOWN => SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
* SDL_CONTROLLERTOUCHPADMOTION => SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
* SDL_CONTROLLERTOUCHPADUP => SDL_EVENT_GAMEPAD_TOUCHPAD_UP
* SDL_DROPBEGIN => SDL_EVENT_DROP_BEGIN
* SDL_DROPCOMPLETE => SDL_EVENT_DROP_COMPLETE
* SDL_DROPFILE => SDL_EVENT_DROP_FILE
* SDL_DROPTEXT => SDL_EVENT_DROP_TEXT
* SDL_FINGERDOWN => SDL_EVENT_FINGER_DOWN
* SDL_FINGERMOTION => SDL_EVENT_FINGER_MOTION
* SDL_FINGERUP => SDL_EVENT_FINGER_UP
* SDL_FIRSTEVENT => SDL_EVENT_FIRST
* SDL_JOYAXISMOTION => SDL_EVENT_JOYSTICK_AXIS_MOTION
* SDL_JOYBATTERYUPDATED => SDL_EVENT_JOYSTICK_BATTERY_UPDATED
* SDL_JOYBUTTONDOWN => SDL_EVENT_JOYSTICK_BUTTON_DOWN
* SDL_JOYBUTTONUP => SDL_EVENT_JOYSTICK_BUTTON_UP
* SDL_JOYDEVICEADDED => SDL_EVENT_JOYSTICK_ADDED
* SDL_JOYDEVICEREMOVED => SDL_EVENT_JOYSTICK_REMOVED
* SDL_JOYHATMOTION => SDL_EVENT_JOYSTICK_HAT_MOTION
* SDL_KEYDOWN => SDL_EVENT_KEY_DOWN
* SDL_KEYMAPCHANGED => SDL_EVENT_KEYMAP_CHANGED
* SDL_KEYUP => SDL_EVENT_KEY_UP
* SDL_LASTEVENT => SDL_EVENT_LAST
* SDL_LOCALECHANGED => SDL_EVENT_LOCALECHANGED
* SDL_MOUSEBUTTONDOWN => SDL_EVENT_MOUSE_BUTTONDOWN
* SDL_MOUSEBUTTONUP => SDL_EVENT_MOUSE_BUTTONUP
* SDL_MOUSEMOTION => SDL_EVENT_MOUSE_MOTION
* SDL_MOUSEWHEEL => SDL_EVENT_MOUSE_WHEEL
* SDL_POLLSENTINEL => SDL_EVENT_POLL_SENTINEL
* SDL_QUIT => SDL_EVENT_QUIT
* SDL_RENDER_DEVICE_RESET => SDL_EVENT_RENDER_DEVICE_RESET
* SDL_RENDER_TARGETS_RESET => SDL_EVENT_RENDER_TARGETS_RESET
* SDL_SENSORUPDATE => SDL_EVENT_SENSOR_UPDATE
* SDL_SYSWMEVENT => SDL_EVENT_SYSWM
* SDL_TEXTEDITING => SDL_EVENT_TEXT_EDITING
* SDL_TEXTEDITING_EXT => SDL_EVENT_TEXTEDITING_EXT
* SDL_TEXTINPUT => SDL_EVENT_TEXT_INPUT
* SDL_USEREVENT => SDL_EVENT_USER
The following structures have been renamed:
* SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
@ -154,11 +197,11 @@ The following functions have been removed:
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.
The SDL_GAMEPADADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
The SDL_EVENT_GAMEPAD_ADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
The functions SDL_GetGamepads(), SDL_GetGamepadInstanceName(), SDL_GetGamepadInstancePath(), SDL_GetGamepadInstancePlayerIndex(), SDL_GetGamepadInstanceGUID(), SDL_GetGamepadInstanceVendor(), SDL_GetGamepadInstanceProduct(), SDL_GetGamepadInstanceProductVersion(), and SDL_GetGamepadInstanceType() have been added to directly query the list of available gamepads.
SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_GAMEPADSENSORUPDATE events.
SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_GAMEPAD_SENSOR_UPDATE events.
The following enums have been renamed:
* SDL_GameControllerAxis => SDL_GamepadAxis
@ -337,7 +380,7 @@ Rather than iterating over joysticks using device index, there is a new function
}
```
The SDL_JOYDEVICEADDED event now provides the joystick instance ID in the `which` member of the jdevice event structure.
The SDL_EVENT_JOYSTICK_ADDED event now provides the joystick instance ID in the `which` member of the jdevice event structure.
The functions SDL_GetJoysticks(), SDL_GetJoystickInstanceName(), SDL_GetJoystickInstancePath(), SDL_GetJoystickInstancePlayerIndex(), SDL_GetJoystickInstanceGUID(), SDL_GetJoystickInstanceVendor(), SDL_GetJoystickInstanceProduct(), SDL_GetJoystickInstanceProductVersion(), and SDL_GetJoystickInstanceType() have been added to directly query the list of available joysticks.
@ -483,6 +526,30 @@ The following functions have been renamed:
* SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatEnumForMasks()
* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormatEnum()
The following symbols have been renamed:
* SDL_DISPLAYEVENT_DISCONNECTED => SDL_EVENT_DISPLAY_DISCONNECTED
* SDL_DISPLAYEVENT_MOVED => SDL_EVENT_DISPLAY_MOVED
* SDL_DISPLAYEVENT_ORIENTATION => SDL_EVENT_DISPLAY_ORIENTATION
* SDL_WINDOWEVENT_CLOSE => SDL_EVENT_WINDOW_CLOSE
* SDL_WINDOWEVENT_DISPLAY_CHANGED => SDL_EVENT_WINDOW_DISPLAY_CHANGED
* SDL_WINDOWEVENT_ENTER => SDL_EVENT_WINDOW_ENTER
* SDL_WINDOWEVENT_EXPOSED => SDL_EVENT_WINDOW_EXPOSED
* SDL_WINDOWEVENT_FOCUS_GAINED => SDL_EVENT_WINDOW_FOCUS_GAINED
* SDL_WINDOWEVENT_FOCUS_LOST => SDL_EVENT_WINDOW_FOCUS_LOST
* SDL_WINDOWEVENT_HIDDEN => SDL_EVENT_WINDOW_HIDDEN
* SDL_WINDOWEVENT_HIT_TEST => SDL_EVENT_WINDOW_HIT_TEST
* SDL_WINDOWEVENT_ICCPROF_CHANGED => SDL_EVENT_WINDOW_ICCPROF_CHANGED
* SDL_WINDOWEVENT_LEAVE => SDL_EVENT_WINDOW_LEAVE
* SDL_WINDOWEVENT_MAXIMIZED => SDL_EVENT_WINDOW_MAXIMIZED
* SDL_WINDOWEVENT_MINIMIZED => SDL_EVENT_WINDOW_MINIMIZED
* SDL_WINDOWEVENT_MOVED => SDL_EVENT_WINDOW_MOVED
* SDL_WINDOWEVENT_RESIZED => SDL_EVENT_WINDOW_RESIZED
* SDL_WINDOWEVENT_RESTORED => SDL_EVENT_WINDOW_RESTORED
* SDL_WINDOWEVENT_SHOWN => SDL_EVENT_WINDOW_SHOWN
* SDL_WINDOWEVENT_SIZE_CHANGED => SDL_EVENT_WINDOW_SIZE_CHANGED
* SDL_WINDOWEVENT_TAKE_FOCUS => SDL_EVENT_WINDOW_TAKE_FOCUS
## SDL_platform.h
The preprocessor symbol `__MACOSX__` has been renamed `__MACOS__`, and `__IPHONEOS__` has been renamed `__IOS__`
@ -748,7 +815,7 @@ Rather than iterating over sensors using device index, there is a new function S
}
```
Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_SENSORUPDATE events.
Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_SENSOR_UPDATE events.
The following functions have been renamed:

View File

@ -127,7 +127,7 @@ Text Input API support
The Text Input API is supported, with translation of scan codes done via the
kernel symbol tables. For this to work, SDL needs access to a valid console.
If you notice there's no SDL_TEXTINPUT message being emitted, double check that
If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that
your app has read access to one of the following:
* /proc/self/fd/0

View File

@ -17,7 +17,7 @@ Unfortunately there is no windows support as of yet. Support for Windows 7 is pl
===========================================================================
Events
===========================================================================
SDL_FINGERDOWN:
SDL_EVENT_FINGER_DOWN:
Sent when a finger (or stylus) is placed on a touch device.
Fields:
* event.tfinger.touchId - the Id of the touch device.
@ -26,17 +26,17 @@ Fields:
* event.tfinger.y - the y coordinate of the touch (0..1)
* event.tfinger.pressure - the pressure of the touch (0..1)
SDL_FINGERMOTION:
SDL_EVENT_FINGER_MOTION:
Sent when a finger (or stylus) is moved on the touch device.
Fields:
Same as SDL_FINGERDOWN but with additional:
Same as SDL_EVENT_FINGER_DOWN but with additional:
* event.tfinger.dx - change in x coordinate during this motion event.
* event.tfinger.dy - change in y coordinate during this motion event.
SDL_FINGERUP:
SDL_EVENT_FINGER_UP:
Sent when a finger (or stylus) is lifted from the touch device.
Fields:
Same as SDL_FINGERDOWN.
Same as SDL_EVENT_FINGER_DOWN.
===========================================================================
@ -66,7 +66,7 @@ The most common reason to access SDL_Finger is to query the fingers outside the
To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_EVENT_FINGER_UP event is _added_ to the event queue, and thus _before_ the SDL_EVENT_FINGER_UP event is polled.
As a result, be very careful to check for NULL return values.
A SDL_Finger has the following fields:

View File

@ -349,7 +349,7 @@ int main(int argc, char **argv)
while (keep_going) {
while (SDL_PollEvent(&evt)) {
if ((evt.type == SDL_KEYDOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
if ((evt.type == SDL_EVENT_KEY_DOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
keep_going = SDL_FALSE;
}
}

View File

@ -54,153 +54,153 @@ extern "C" {
*/
typedef enum
{
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
/* Application events */
SDL_QUIT = 0x100, /**< User-requested quit */
SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
/* These application events have special meaning on iOS, see README-ios.md for details */
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */
SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
/* Display events */
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
SDL_DISPLAYEVENT_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */
SDL_DISPLAYEVENT_DISCONNECTED, /**< Display has been removed from the system */
SDL_DISPLAYEVENT_MOVED, /**< Display has changed position */
SDL_DISPLAYEVENT_FIRST = SDL_DISPLAYEVENT_ORIENTATION,
SDL_DISPLAYEVENT_LAST = SDL_DISPLAYEVENT_DISCONNECTED,
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_EVENT_DISPLAY_CONNECTED, /**< Display has been added to the system */
SDL_EVENT_DISPLAY_DISCONNECTED, /**< Display has been removed from the system */
SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_DISCONNECTED,
/* Window events */
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
SDL_SYSWMEVENT = 0x201, /**< System specific event */
SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
SDL_EVENT_SYSWM = 0x201, /**< System specific event */
SDL_EVENT_WINDOW_SHOWN, /**< Window has been shown */
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be
redrawn */
SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2
*/
SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
SDL_EVENT_WINDOW_SIZE_CHANGED, /**< The window size has changed, either as
a result of an API call or through the
system or user changing the window size. */
SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size
and position */
SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
SDL_WINDOWEVENT_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
SDL_WINDOWEVENT_ICCPROF_CHANGED,/**< The ICC profile of the window's display has changed. */
SDL_WINDOWEVENT_DISPLAY_CHANGED,/**< Window has been moved to display data1. */
SDL_WINDOWEVENT_FIRST = SDL_WINDOWEVENT_SHOWN,
SDL_WINDOWEVENT_LAST = SDL_WINDOWEVENT_DISPLAY_CHANGED,
SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
SDL_EVENT_WINDOW_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
SDL_EVENT_WINDOW_ICCPROF_CHANGED,/**< The ICC profile of the window's display has changed. */
SDL_EVENT_WINDOW_DISPLAY_CHANGED,/**< Window has been moved to display data1. */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_DISPLAY_CHANGED,
/* Keyboard events */
SDL_KEYDOWN = 0x300, /**< Key pressed */
SDL_KEYUP, /**< Key released */
SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
SDL_TEXTINPUT, /**< Keyboard text input */
SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
SDL_EVENT_KEY_UP, /**< Key released */
SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
input language or keyboard layout change.
*/
SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */
SDL_EVENT_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */
/* Mouse events */
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
SDL_EVENT_MOUSE_BUTTONDOWN, /**< Mouse button pressed */
SDL_EVENT_MOUSE_BUTTONUP, /**< Mouse button released */
SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
/* Joystick events */
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
SDL_JOYHATMOTION = 0x602, /**< Joystick hat position change */
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */
SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
SDL_EVENT_JOYSTICK_HAT_MOTION = 0x602, /**< Joystick hat position change */
SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
/* Gamepad events */
SDL_GAMEPADAXISMOTION = 0x650, /**< Gamepad axis motion */
SDL_GAMEPADBUTTONDOWN, /**< Gamepad button pressed */
SDL_GAMEPADBUTTONUP, /**< Gamepad button released */
SDL_GAMEPADADDED, /**< A new gamepad has been inserted into the system */
SDL_GAMEPADREMOVED, /**< An opened gamepad has been removed */
SDL_GAMEPADREMAPPED, /**< The gamepad mapping was updated */
SDL_GAMEPADTOUCHPADDOWN, /**< Gamepad touchpad was touched */
SDL_GAMEPADTOUCHPADMOTION, /**< Gamepad touchpad finger was moved */
SDL_GAMEPADTOUCHPADUP, /**< Gamepad touchpad finger was lifted */
SDL_GAMEPADSENSORUPDATE, /**< Gamepad sensor was updated */
SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
SDL_EVENT_GAMEPAD_REMOVED, /**< An opened gamepad has been removed */
SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
/* Touch events */
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_EVENT_FINGER_DOWN = 0x700,
SDL_EVENT_FINGER_UP,
SDL_EVENT_FINGER_MOTION,
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
/* Clipboard events */
SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard or primary selection changed */
SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */
/* Drag and drop events */
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
SDL_DROPTEXT, /**< text/plain drag-and-drop event */
SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
/* Audio hotplug events */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
/* Sensor events */
SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
/* Internal events */
SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
/** Events ::SDL_EVENT_USER through ::SDL_EVENT_LAST are for your use,
* and should be allocated with SDL_RegisterEvents()
*/
SDL_USEREVENT = 0x8000,
SDL_EVENT_USER = 0x8000,
/**
* This last event is only for bounding internal arrays
*/
SDL_LASTEVENT = 0xFFFF
SDL_EVENT_LAST = 0xFFFF
} SDL_EventType;
/**
@ -240,7 +240,7 @@ typedef struct SDL_WindowEvent
*/
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
Uint32 type; /**< ::SDL_EVENT_KEY_DOWN or ::SDL_EVENT_KEY_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with keyboard focus, if any */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
@ -256,7 +256,7 @@ typedef struct SDL_KeyboardEvent
*/
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
Uint32 type; /**< ::SDL_EVENT_TEXT_EDITING */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
@ -270,7 +270,7 @@ typedef struct SDL_TextEditingEvent
*/
typedef struct SDL_TextEditingExtEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
Uint32 type; /**< ::SDL_EVENT_TEXTEDITING_EXT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
@ -284,7 +284,7 @@ typedef struct SDL_TextEditingExtEvent
*/
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
Uint32 type; /**< ::SDL_EVENT_TEXT_INPUT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
@ -295,7 +295,7 @@ typedef struct SDL_TextInputEvent
*/
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 type; /**< ::SDL_EVENT_MOUSE_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -311,7 +311,7 @@ typedef struct SDL_MouseMotionEvent
*/
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_MOUSE_BUTTONDOWN or ::SDL_EVENT_MOUSE_BUTTONUP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -328,7 +328,7 @@ typedef struct SDL_MouseButtonEvent
*/
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 type; /**< ::SDL_EVENT_MOUSE_WHEEL */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@ -344,7 +344,7 @@ typedef struct SDL_MouseWheelEvent
*/
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_AXIS_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
@ -360,7 +360,7 @@ typedef struct SDL_JoyAxisEvent
*/
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_HAT_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
@ -380,7 +380,7 @@ typedef struct SDL_JoyHatEvent
*/
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_BUTTON_DOWN or ::SDL_EVENT_JOYSTICK_BUTTON_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
@ -394,7 +394,7 @@ typedef struct SDL_JoyButtonEvent
*/
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_ADDED or ::SDL_EVENT_JOYSTICK_REMOVED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
} SDL_JoyDeviceEvent;
@ -404,7 +404,7 @@ typedef struct SDL_JoyDeviceEvent
*/
typedef struct SDL_JoyBatteryEvent
{
Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
SDL_JoystickPowerLevel level; /**< The joystick battery level */
@ -415,7 +415,7 @@ typedef struct SDL_JoyBatteryEvent
*/
typedef struct SDL_GamepadAxisEvent
{
Uint32 type; /**< ::SDL_GAMEPADAXISMOTION */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_AXIS_MOTION */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
@ -432,7 +432,7 @@ typedef struct SDL_GamepadAxisEvent
*/
typedef struct SDL_GamepadButtonEvent
{
Uint32 type; /**< ::SDL_GAMEPADBUTTONDOWN or ::SDL_GAMEPADBUTTONUP */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_BUTTON_DOWN or ::SDL_EVENT_GAMEPAD_BUTTON_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
@ -447,7 +447,7 @@ typedef struct SDL_GamepadButtonEvent
*/
typedef struct SDL_GamepadDeviceEvent
{
Uint32 type; /**< ::SDL_GAMEPADADDED, ::SDL_GAMEPADREMOVED, or ::SDL_GAMEPADREMAPPED */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_ADDED, ::SDL_EVENT_GAMEPAD_REMOVED, or ::SDL_EVENT_GAMEPAD_REMAPPED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
} SDL_GamepadDeviceEvent;
@ -457,7 +457,7 @@ typedef struct SDL_GamepadDeviceEvent
*/
typedef struct SDL_GamepadTouchpadEvent
{
Uint32 type; /**< ::SDL_GAMEPADTOUCHPADDOWN or ::SDL_GAMEPADTOUCHPADMOTION or ::SDL_GAMEPADTOUCHPADUP */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or ::SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or ::SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Sint32 touchpad; /**< The index of the touchpad */
@ -472,7 +472,7 @@ typedef struct SDL_GamepadTouchpadEvent
*/
typedef struct SDL_GamepadSensorEvent
{
Uint32 type; /**< ::SDL_GAMEPADSENSORUPDATE */
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
@ -485,7 +485,7 @@ typedef struct SDL_GamepadSensorEvent
*/
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
Uint32 type; /**< ::SDL_EVENT_AUDIO_DEVICE_ADDED, or ::SDL_EVENT_AUDIO_DEVICE_REMOVED */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_AudioDeviceID which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
@ -500,7 +500,7 @@ typedef struct SDL_AudioDeviceEvent
*/
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 type; /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
@ -520,7 +520,7 @@ typedef struct SDL_TouchFingerEvent
*/
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
Uint32 type; /**< ::SDL_EVENT_DROP_BEGIN or ::SDL_EVENT_DROP_FILE or ::SDL_EVENT_DROP_TEXT or ::SDL_EVENT_DROP_COMPLETE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
SDL_WindowID windowID;/**< The window that was dropped on, if any */
@ -532,7 +532,7 @@ typedef struct SDL_DropEvent
*/
typedef struct SDL_SensorEvent
{
Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 type; /**< ::SDL_EVENT_SENSOR_UPDATE */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_SensorID which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
@ -544,7 +544,7 @@ typedef struct SDL_SensorEvent
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 type; /**< ::SDL_EVENT_QUIT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
} SDL_QuitEvent;
@ -553,7 +553,7 @@ typedef struct SDL_QuitEvent
*/
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 type; /**< ::SDL_EVENT_QUIT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
} SDL_OSEvent;
@ -562,7 +562,7 @@ typedef struct SDL_OSEvent
*/
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 type; /**< ::SDL_EVENT_USER through ::SDL_EVENT_LAST-1 */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID;/**< The associated window if any */
Sint32 code; /**< User defined event code */
@ -582,7 +582,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
*/
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
Uint32 type; /**< ::SDL_EVENT_SYSWM */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
@ -701,9 +701,9 @@ typedef enum
* SDL_GETEVENT, the maximum number of events to retrieve
* \param action action to take; see [[#action|Remarks]] for details
* \param minType minimum value of the event type to be considered;
* SDL_FIRSTEVENT is a safe choice
* SDL_EVENT_FIRST is a safe choice
* \param maxType maximum value of the event type to be considered;
* SDL_LASTEVENT is a safe choice
* SDL_EVENT_LAST is a safe choice
* \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information.
*

View File

@ -132,7 +132,7 @@ extern "C" {
* \brief A variable to control whether we trap the Android back button to handle it manually.
* This is necessary for the right mouse button to work on some Android devices, or
* to be able to trap the back button for use in your code reliably. If set to true,
* the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of
* the back button will show up as an SDL_EVENT_KEY_DOWN / SDL_EVENT_KEY_UP pair with a keycode of
* SDL_SCANCODE_AC_BACK.
*
* The variable can be set to the following values:
@ -557,13 +557,13 @@ extern "C" {
#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES"
/**
* \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
* \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_EVENT_TEXT_EDITING events.
*
* The variable can be set to the following values:
* "0" - SDL_TEXTEDITING events are sent, and it is the application's
* "0" - SDL_EVENT_TEXT_EDITING events are sent, and it is the application's
* responsibility to render the text from these events and
* differentiate it somehow from committed text. (default)
* "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
* "1" - If supported by the IME then SDL_EVENT_TEXT_EDITING events are not sent,
* and text that is being composed will be rendered in its own UI.
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
@ -1211,7 +1211,7 @@ extern "C" {
*
* The variable can be set to the following values:
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
* catches a signal, convert it into an SDL_QUIT event.
* catches a signal, convert it into an SDL_EVENT_QUIT event.
* "1" - SDL will not install a signal handler at all.
*/
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
@ -1279,7 +1279,7 @@ extern "C" {
*
* If set, this will be favored over anything the OS might report for the
* user's preferred locales. Changing this hint at runtime will not generate
* a SDL_LOCALECHANGED event (but if you can change the hint, you can push
* a SDL_EVENT_LOCALE_CHANGED event (but if you can change the hint, you can push
* your own event, if you want).
*
* The format of this hint is a comma-separated list of language and locale,
@ -2138,8 +2138,8 @@ extern "C" {
* the app).
*
* SDL registers its own back-button-press callback with the Windows Phone
* OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
* OS. This callback will emit a pair of SDL key-press events (SDL_EVENT_KEY_DOWN
* and SDL_EVENT_KEY_UP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
* it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
* If the hint's value is set to "1", the back button event's Handled
* property will get set to 'true'. If the hint's value is set to something
@ -2152,8 +2152,8 @@ extern "C" {
*
* In order to get notified when a back button is pressed, SDL apps should
* register a callback function with SDL_AddEventWatch(), and have it listen
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
* for SDL_EVENT_KEY_DOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_EVENT_KEY_UP events can be listened-for. Listening for
* either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
* set by such a callback, will be applied to the OS' current
* back-button-press event.
@ -2290,26 +2290,26 @@ extern "C" {
#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE"
/**
* \brief A variable that decides whether to send SDL_QUIT when closing the final window.
* \brief A variable that decides whether to send SDL_EVENT_QUIT when closing the final window.
*
* By default, SDL sends an SDL_QUIT event when there is only one window
* and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most
* By default, SDL sends an SDL_EVENT_QUIT event when there is only one window
* and it receives an SDL_EVENT_WINDOW_CLOSE_REQUESTED event, under the assumption most
* apps would also take the loss of this window as a signal to terminate the
* program.
*
* However, it's not unreasonable in some cases to have the program continue
* to live on, perhaps to create new windows later.
*
* Changing this hint to "0" will cause SDL to not send an SDL_QUIT event
* Changing this hint to "0" will cause SDL to not send an SDL_EVENT_QUIT event
* when the final window is requesting to close. Note that in this case,
* there are still other legitimate reasons one might get an SDL_QUIT
* there are still other legitimate reasons one might get an SDL_EVENT_QUIT
* event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c)
* on Unix, etc.
*
* The default value is "1". This hint can be changed at any time.
*
* This hint is available since SDL 2.0.22. Before then, you always get
* an SDL_QUIT event when closing the final window.
* an SDL_EVENT_QUIT event when closing the final window.
*/
#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE"

View File

@ -42,7 +42,7 @@ extern "C" {
/**
* \brief The SDL keysym structure, used in key events.
*
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
* \note If you are looking for translated character input, see the ::SDL_EVENT_TEXT_INPUT event.
*/
typedef struct SDL_Keysym
{
@ -247,8 +247,8 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* Start accepting Unicode text input events.
*
* This function will start accepting Unicode text input events in the focused
* SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and
* SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in
* SDL window, and start emitting SDL_TextInputEvent (SDL_EVENT_TEXT_INPUT) and
* SDL_TextEditingEvent (SDL_EVENT_TEXT_EDITING) events. Please use this function in
* pair with SDL_StopTextInput().
*
* On some platforms using this function activates the screen keyboard.

View File

@ -79,7 +79,7 @@ typedef struct SDL_Locale
* This might be a "slow" call that has to query the operating system. It's
* best to ask for this once and save the results. However, this list can
* change, usually because the user has changed a system preference outside of
* your program; SDL will send an SDL_LOCALECHANGED event in this case, if
* your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case, if
* possible, and you can call this function again to get an updated copy of
* preferred locales.
*

View File

@ -50,21 +50,86 @@
#define SDL_NewAudioStream SDL_CreateAudioStream
/* ##SDL_events.h */
#define SDL_CONTROLLERAXISMOTION SDL_GAMEPADAXISMOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_GAMEPADBUTTONDOWN
#define SDL_CONTROLLERBUTTONUP SDL_GAMEPADBUTTONUP
#define SDL_CONTROLLERDEVICEADDED SDL_GAMEPADADDED
#define SDL_CONTROLLERDEVICEREMAPPED SDL_GAMEPADREMAPPED
#define SDL_CONTROLLERDEVICEREMOVED SDL_GAMEPADREMOVED
#define SDL_CONTROLLERSENSORUPDATE SDL_GAMEPADSENSORUPDATE
#define SDL_CONTROLLERTOUCHPADDOWN SDL_GAMEPADTOUCHPADDOWN
#define SDL_CONTROLLERTOUCHPADMOTION SDL_GAMEPADTOUCHPADMOTION
#define SDL_CONTROLLERTOUCHPADUP SDL_GAMEPADTOUCHPADUP
#define SDL_APP_DIDENTERBACKGROUND SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_EVENT_DID_ENTER_FOREGROUND
#define SDL_APP_LOWMEMORY SDL_EVENT_LOW_MEMORY
#define SDL_APP_TERMINATING SDL_EVENT_TERMINATING
#define SDL_APP_WILLENTERBACKGROUND SDL_EVENT_WILL_ENTER_BACKGROUND
#define SDL_APP_WILLENTERFOREGROUND SDL_EVENT_WILL_ENTER_FOREGROUND
#define SDL_AUDIODEVICEADDED SDL_EVENT_AUDIO_DEVICE_ADDED
#define SDL_AUDIODEVICEREMOVED SDL_EVENT_AUDIO_DEVICE_REMOVED
#define SDL_CLIPBOARDUPDATE SDL_EVENT_CLIPBOARD_UPDATE
#define SDL_CONTROLLERAXISMOTION SDL_EVENT_GAMEPAD_AXIS_MOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_EVENT_GAMEPAD_BUTTON_DOWN
#define SDL_CONTROLLERBUTTONUP SDL_EVENT_GAMEPAD_BUTTON_UP
#define SDL_CONTROLLERDEVICEADDED SDL_EVENT_GAMEPAD_ADDED
#define SDL_CONTROLLERDEVICEREMAPPED SDL_EVENT_GAMEPAD_REMAPPED
#define SDL_CONTROLLERDEVICEREMOVED SDL_EVENT_GAMEPAD_REMOVED
#define SDL_CONTROLLERSENSORUPDATE SDL_EVENT_GAMEPAD_SENSOR_UPDATE
#define SDL_CONTROLLERTOUCHPADDOWN SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
#define SDL_CONTROLLERTOUCHPADMOTION SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
#define SDL_CONTROLLERTOUCHPADUP SDL_EVENT_GAMEPAD_TOUCHPAD_UP
#define SDL_ControllerAxisEvent SDL_GamepadAxisEvent
#define SDL_ControllerButtonEvent SDL_GamepadButtonEvent
#define SDL_ControllerDeviceEvent SDL_GamepadDeviceEvent
#define SDL_ControllerSensorEvent SDL_GamepadSensorEvent
#define SDL_ControllerTouchpadEvent SDL_GamepadTouchpadEvent
#define SDL_DISPLAYEVENT_CONNECTED SDL_EVENT_DISPLAY_CONNECTED
#define SDL_DISPLAYEVENT_DISCONNECTED SDL_EVENT_DISPLAY_DISCONNECTED
#define SDL_DISPLAYEVENT_MOVED SDL_EVENT_DISPLAY_MOVED
#define SDL_DISPLAYEVENT_ORIENTATION SDL_EVENT_DISPLAY_ORIENTATION
#define SDL_DROPBEGIN SDL_EVENT_DROP_BEGIN
#define SDL_DROPCOMPLETE SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_EVENT_DROP_TEXT
#define SDL_FINGERDOWN SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_EVENT_FINGER_UP
#define SDL_FIRSTEVENT SDL_EVENT_FIRST
#define SDL_JOYAXISMOTION SDL_EVENT_JOYSTICK_AXIS_MOTION
#define SDL_JOYBATTERYUPDATED SDL_EVENT_JOYSTICK_BATTERY_UPDATED
#define SDL_JOYBUTTONDOWN SDL_EVENT_JOYSTICK_BUTTON_DOWN
#define SDL_JOYBUTTONUP SDL_EVENT_JOYSTICK_BUTTON_UP
#define SDL_JOYDEVICEADDED SDL_EVENT_JOYSTICK_ADDED
#define SDL_JOYDEVICEREMOVED SDL_EVENT_JOYSTICK_REMOVED
#define SDL_JOYHATMOTION SDL_EVENT_JOYSTICK_HAT_MOTION
#define SDL_KEYDOWN SDL_EVENT_KEY_DOWN
#define SDL_KEYMAPCHANGED SDL_EVENT_KEYMAP_CHANGED
#define SDL_KEYUP SDL_EVENT_KEY_UP
#define SDL_LASTEVENT SDL_EVENT_LAST
#define SDL_LOCALECHANGED SDL_EVENT_LOCALE_CHANGED
#define SDL_MOUSEBUTTONDOWN SDL_EVENT_MOUSE_BUTTONDOWN
#define SDL_MOUSEBUTTONUP SDL_EVENT_MOUSE_BUTTONUP
#define SDL_MOUSEMOTION SDL_EVENT_MOUSE_MOTION
#define SDL_MOUSEWHEEL SDL_EVENT_MOUSE_WHEEL
#define SDL_POLLSENTINEL SDL_EVENT_POLL_SENTINEL
#define SDL_QUIT SDL_EVENT_QUIT
#define SDL_RENDER_DEVICE_RESET SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_EVENT_TEXTEDITING_EXT
#define SDL_TEXTINPUT SDL_EVENT_TEXT_INPUT
#define SDL_USEREVENT SDL_EVENT_USER
#define SDL_WINDOWEVENT_CLOSE SDL_EVENT_WINDOW_CLOSE_REQUESTED
#define SDL_WINDOWEVENT_DISPLAY_CHANGED SDL_EVENT_WINDOW_DISPLAY_CHANGED
#define SDL_WINDOWEVENT_ENTER SDL_EVENT_WINDOW_MOUSE_ENTER
#define SDL_WINDOWEVENT_EXPOSED SDL_EVENT_WINDOW_EXPOSED
#define SDL_WINDOWEVENT_FOCUS_GAINED SDL_EVENT_WINDOW_FOCUS_GAINED
#define SDL_WINDOWEVENT_FOCUS_LOST SDL_EVENT_WINDOW_FOCUS_LOST
#define SDL_WINDOWEVENT_HIDDEN SDL_EVENT_WINDOW_HIDDEN
#define SDL_WINDOWEVENT_HIT_TEST SDL_EVENT_WINDOW_HIT_TEST
#define SDL_WINDOWEVENT_ICCPROF_CHANGED SDL_EVENT_WINDOW_ICCPROF_CHANGED
#define SDL_WINDOWEVENT_LEAVE SDL_EVENT_WINDOW_MOUSE_LEAVE
#define SDL_WINDOWEVENT_MAXIMIZED SDL_EVENT_WINDOW_MAXIMIZED
#define SDL_WINDOWEVENT_MINIMIZED SDL_EVENT_WINDOW_MINIMIZED
#define SDL_WINDOWEVENT_MOVED SDL_EVENT_WINDOW_MOVED
#define SDL_WINDOWEVENT_RESIZED SDL_EVENT_WINDOW_RESIZED
#define SDL_WINDOWEVENT_RESTORED SDL_EVENT_WINDOW_RESTORED
#define SDL_WINDOWEVENT_SHOWN SDL_EVENT_WINDOW_SHOWN
#define SDL_WINDOWEVENT_SIZE_CHANGED SDL_EVENT_WINDOW_SIZE_CHANGED
#define SDL_WINDOWEVENT_TAKE_FOCUS SDL_EVENT_WINDOW_TAKE_FOCUS
/* ##SDL_gamepad.h */
#define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
@ -363,6 +428,15 @@
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_APP_DIDENTERBACKGROUND_renamed_SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_APP_DIDENTERFOREGROUND_renamed_SDL_EVENT_DID_ENTER_FOREGROUND
#define SDL_APP_LOWMEMORY SDL_APP_LOWMEMORY_renamed_SDL_EVENT_LOW_MEMORY
#define SDL_APP_TERMINATING SDL_APP_TERMINATING_renamed_SDL_EVENT_TERMINATING
#define SDL_APP_WILLENTERBACKGROUND SDL_APP_WILLENTERBACKGROUND_renamed_SDL_EVENT_WILL_ENTER_BACKGROUND
#define SDL_APP_WILLENTERFOREGROUND SDL_APP_WILLENTERFOREGROUND_renamed_SDL_EVENT_WILL_ENTER_FOREGROUND
#define SDL_AUDIODEVICEADDED SDL_AUDIODEVICEADDED_renamed_SDL_EVENT_AUDIO_DEVICE_ADDED
#define SDL_AUDIODEVICEREMOVED SDL_AUDIODEVICEREMOVED_renamed_SDL_EVENT_AUDIO_DEVICE_REMOVED
#define SDL_CLIPBOARDUPDATE SDL_CLIPBOARDUPDATE_renamed_SDL_EVENT_CLIPBOARD_UPDATE
#define SDL_CONTROLLERAXISMOTION SDL_CONTROLLERAXISMOTION_renamed_SDL_GAMEPADAXISMOTION
#define SDL_CONTROLLERBUTTONDOWN SDL_CONTROLLERBUTTONDOWN_renamed_SDL_GAMEPADBUTTONDOWN
#define SDL_CONTROLLERBUTTONUP SDL_CONTROLLERBUTTONUP_renamed_SDL_GAMEPADBUTTONUP
@ -378,6 +452,62 @@
#define SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent_renamed_SDL_GamepadDeviceEvent
#define SDL_ControllerSensorEvent SDL_ControllerSensorEvent_renamed_SDL_GamepadSensorEvent
#define SDL_ControllerTouchpadEvent SDL_ControllerTouchpadEvent_renamed_SDL_GamepadTouchpadEvent
#define SDL_DISPLAYEVENT_CONNECTED SDL_DISPLAYEVENT_CONNECTED_renamed_SDL_EVENT_DISPLAY_CONNECTED
#define SDL_DISPLAYEVENT_DISCONNECTED SDL_DISPLAYEVENT_DISCONNECTED_renamed_SDL_EVENT_DISPLAY_DISCONNECTED
#define SDL_DISPLAYEVENT_MOVED SDL_DISPLAYEVENT_MOVED_renamed_SDL_EVENT_DISPLAY_MOVED
#define SDL_DISPLAYEVENT_ORIENTATION SDL_DISPLAYEVENT_ORIENTATION_renamed_SDL_EVENT_DISPLAY_ORIENTATION
#define SDL_DROPBEGIN SDL_DROPBEGIN_renamed_SDL_EVENT_DROP_BEGIN
#define SDL_DROPCOMPLETE SDL_DROPCOMPLETE_renamed_SDL_EVENT_DROP_COMPLETE
#define SDL_DROPFILE SDL_DROPFILE_renamed_SDL_EVENT_DROP_FILE
#define SDL_DROPTEXT SDL_DROPTEXT_renamed_SDL_EVENT_DROP_TEXT
#define SDL_FINGERDOWN SDL_FINGERDOWN_renamed_SDL_EVENT_FINGER_DOWN
#define SDL_FINGERMOTION SDL_FINGERMOTION_renamed_SDL_EVENT_FINGER_MOTION
#define SDL_FINGERUP SDL_FINGERUP_renamed_SDL_EVENT_FINGER_UP
#define SDL_FIRSTEVENT SDL_FIRSTEVENT_renamed_SDL_EVENT_FIRST
#define SDL_JOYAXISMOTION SDL_JOYAXISMOTION_renamed_SDL_EVENT_JOYSTICK_AXIS_MOTION
#define SDL_JOYBATTERYUPDATED SDL_JOYBATTERYUPDATED_renamed_SDL_EVENT_JOYSTICK_BATTERY_UPDATED
#define SDL_JOYBUTTONDOWN SDL_JOYBUTTONDOWN_renamed_SDL_EVENT_JOYSTICK_BUTTON_DOWN
#define SDL_JOYBUTTONUP SDL_JOYBUTTONUP_renamed_SDL_EVENT_JOYSTICK_BUTTON_UP
#define SDL_JOYDEVICEADDED SDL_JOYDEVICEADDED_renamed_SDL_EVENT_JOYSTICK_ADDED
#define SDL_JOYDEVICEREMOVED SDL_JOYDEVICEREMOVED_renamed_SDL_EVENT_JOYSTICK_REMOVED
#define SDL_JOYHATMOTION SDL_JOYHATMOTION_renamed_SDL_EVENT_JOYSTICK_HAT_MOTION
#define SDL_KEYDOWN SDL_KEYDOWN_renamed_SDL_EVENT_KEY_DOWN
#define SDL_KEYMAPCHANGED SDL_KEYMAPCHANGED_renamed_SDL_EVENT_KEYMAP_CHANGED
#define SDL_KEYUP SDL_KEYUP_renamed_SDL_EVENT_KEY_UP
#define SDL_LASTEVENT SDL_LASTEVENT_renamed_SDL_EVENT_LAST
#define SDL_LOCALECHANGED SDL_LOCALECHANGED_renamed_SDL_EVENT_LOCALECHANGED
#define SDL_MOUSEBUTTONDOWN SDL_MOUSEBUTTONDOWN_renamed_SDL_EVENT_MOUSE_BUTTONDOWN
#define SDL_MOUSEBUTTONUP SDL_MOUSEBUTTONUP_renamed_SDL_EVENT_MOUSE_BUTTONUP
#define SDL_MOUSEMOTION SDL_MOUSEMOTION_renamed_SDL_EVENT_MOUSE_MOTION
#define SDL_MOUSEWHEEL SDL_MOUSEWHEEL_renamed_SDL_EVENT_MOUSE_WHEEL
#define SDL_POLLSENTINEL SDL_POLLSENTINEL_renamed_SDL_EVENT_POLL_SENTINEL
#define SDL_QUIT SDL_QUIT_renamed_SDL_EVENT_QUIT
#define SDL_RENDER_DEVICE_RESET SDL_RENDER_DEVICE_RESET_renamed_SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_RENDER_TARGETS_RESET_renamed_SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_SENSORUPDATE_renamed_SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_SYSWMEVENT_renamed_SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_TEXTEDITING_renamed_SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_TEXTEDITING_EXT_renamed_SDL_EVENT_TEXTEDITING_EXT
#define SDL_TEXTINPUT SDL_TEXTINPUT_renamed_SDL_EVENT_TEXT_INPUT
#define SDL_USEREVENT SDL_USEREVENT_renamed_SDL_EVENT_USER
#define SDL_WINDOWEVENT_CLOSE SDL_WINDOWEVENT_CLOSE_renamed_SDL_EVENT_WINDOW_CLOSE
#define SDL_WINDOWEVENT_DISPLAY_CHANGED SDL_WINDOWEVENT_DISPLAY_CHANGED_renamed_SDL_EVENT_WINDOW_DISPLAY_CHANGED
#define SDL_WINDOWEVENT_ENTER SDL_WINDOWEVENT_ENTER_renamed_SDL_EVENT_WINDOW_ENTER
#define SDL_WINDOWEVENT_EXPOSED SDL_WINDOWEVENT_EXPOSED_renamed_SDL_EVENT_WINDOW_EXPOSED
#define SDL_WINDOWEVENT_FOCUS_GAINED SDL_WINDOWEVENT_FOCUS_GAINED_renamed_SDL_EVENT_WINDOW_FOCUS_GAINED
#define SDL_WINDOWEVENT_FOCUS_LOST SDL_WINDOWEVENT_FOCUS_LOST_renamed_SDL_EVENT_WINDOW_FOCUS_LOST
#define SDL_WINDOWEVENT_HIDDEN SDL_WINDOWEVENT_HIDDEN_renamed_SDL_EVENT_WINDOW_HIDDEN
#define SDL_WINDOWEVENT_HIT_TEST SDL_WINDOWEVENT_HIT_TEST_renamed_SDL_EVENT_WINDOW_HIT_TEST
#define SDL_WINDOWEVENT_ICCPROF_CHANGED SDL_WINDOWEVENT_ICCPROF_CHANGED_renamed_SDL_EVENT_WINDOW_ICCPROF_CHANGED
#define SDL_WINDOWEVENT_LEAVE SDL_WINDOWEVENT_LEAVE_renamed_SDL_EVENT_WINDOW_LEAVE
#define SDL_WINDOWEVENT_MAXIMIZED SDL_WINDOWEVENT_MAXIMIZED_renamed_SDL_EVENT_WINDOW_MAXIMIZED
#define SDL_WINDOWEVENT_MINIMIZED SDL_WINDOWEVENT_MINIMIZED_renamed_SDL_EVENT_WINDOW_MINIMIZED
#define SDL_WINDOWEVENT_MOVED SDL_WINDOWEVENT_MOVED_renamed_SDL_EVENT_WINDOW_MOVED
#define SDL_WINDOWEVENT_RESIZED SDL_WINDOWEVENT_RESIZED_renamed_SDL_EVENT_WINDOW_RESIZED
#define SDL_WINDOWEVENT_RESTORED SDL_WINDOWEVENT_RESTORED_renamed_SDL_EVENT_WINDOW_RESTORED
#define SDL_WINDOWEVENT_SHOWN SDL_WINDOWEVENT_SHOWN_renamed_SDL_EVENT_WINDOW_SHOWN
#define SDL_WINDOWEVENT_SIZE_CHANGED SDL_WINDOWEVENT_SIZE_CHANGED_renamed_SDL_EVENT_WINDOW_SIZE_CHANGED
#define SDL_WINDOWEVENT_TAKE_FOCUS SDL_WINDOWEVENT_TAKE_FOCUS_renamed_SDL_EVENT_WINDOW_TAKE_FOCUS
/* ##SDL_gamepad.h */
#define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID

View File

@ -34,16 +34,16 @@
/**
* \file SDL_quit.h
*
* An ::SDL_QUIT event is generated when the user tries to close the application
* window. If it is ignored or filtered out, the window will remain open.
* ::SDL_EVENT_QUIT is generated when the user tries to close the application
* window. If it is ignored or filtered out, the window will remain open.
* If it is not ignored or filtered, it is queued normally and the window
* is allowed to close. When the window is closed, screen updates will
* is allowed to close. When the window is closed, screen updates will
* complete, but have no effect.
*
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
* and SIGTERM (system termination request), if handlers do not already
* exist, that generate ::SDL_QUIT events as well. There is no way
* to determine the cause of an ::SDL_QUIT event, but setting a signal
* exist, that generate ::SDL_EVENT_QUIT as well. There is no way
* to determine the cause of an ::SDL_EVENT_QUIT, but setting a signal
* handler in your application will override the default generation of
* quit events for that signal.
*
@ -53,6 +53,6 @@
/* There are no functions directly affecting the quit event */
#define SDL_QuitRequested() \
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_EVENT_QUIT,SDL_EVENT_QUIT) > 0))
#endif /* SDL_quit_h_ */

View File

@ -36,7 +36,7 @@
/**
* \brief SDL_syswm.h
*
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
* Your application has access to a special type of event ::SDL_EVENT_SYSWM,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
* you can enable it with SDL_SetEventEnabled().

View File

@ -414,9 +414,9 @@ void SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpe
const int device_index = iscapture ? add_capture_device(name, spec, handle) : add_output_device(name, spec, handle);
if (device_index != -1) {
/* Post the event, if desired */
if (SDL_EventEnabled(SDL_AUDIODEVICEADDED)) {
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_ADDED)) {
SDL_Event event;
event.type = SDL_AUDIODEVICEADDED;
event.type = SDL_EVENT_AUDIO_DEVICE_ADDED;
event.common.timestamp = 0;
event.adevice.which = device_index;
event.adevice.iscapture = iscapture;
@ -445,9 +445,9 @@ void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device)
current_audio.impl.UnlockDevice(device);
/* Post the event, if desired */
if (SDL_EventEnabled(SDL_AUDIODEVICEREMOVED)) {
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_REMOVED)) {
SDL_Event event;
event.type = SDL_AUDIODEVICEREMOVED;
event.type = SDL_EVENT_AUDIO_DEVICE_REMOVED;
event.common.timestamp = 0;
event.adevice.which = device->id;
event.adevice.iscapture = device->iscapture ? 1 : 0;
@ -491,15 +491,15 @@ void SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle)
}
/* Devices that aren't opened, as of 2.24.0, will post an
SDL_AUDIODEVICEREMOVED event with the `which` field set to zero.
SDL_EVENT_AUDIO_DEVICE_REMOVED event with the `which` field set to zero.
Apps can use this to decide if they need to refresh a list of
available devices instead of closing an opened one.
Note that opened devices will send the non-zero event in
SDL_OpenedAudioDeviceDisconnected(). */
if (!device_was_opened) {
if (SDL_EventEnabled(SDL_AUDIODEVICEREMOVED)) {
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_REMOVED)) {
SDL_Event event;
event.type = SDL_AUDIODEVICEREMOVED;
event.type = SDL_EVENT_AUDIO_DEVICE_REMOVED;
event.common.timestamp = 0;
event.adevice.which = 0;
event.adevice.iscapture = iscapture ? 1 : 0;

View File

@ -902,7 +902,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
if (Android_Window) {
SDL_VideoDisplay *display = SDL_GetDisplay(0);
SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation);
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_ORIENTATION, orientation);
}
SDL_UnlockMutex(Android_ActivityMutex);
@ -1192,7 +1192,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
JNIEnv *env, jclass cls)
{
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY);
}
/* Locale
@ -1200,7 +1200,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)(
JNIEnv *env, jclass cls)
{
SDL_SendAppEvent(SDL_LOCALECHANGED);
SDL_SendAppEvent(SDL_EVENT_LOCALE_CHANGED);
}
/* Send Quit event to "SDLThread" thread */
@ -1208,17 +1208,17 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)(
JNIEnv *env, jclass cls)
{
/* Discard previous events. The user should have handled state storage
* in SDL_APP_WILLENTERBACKGROUND. After nativeSendQuit() is called, no
* events other than SDL_QUIT and SDL_APP_TERMINATING should fire */
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
/* Inject a SDL_QUIT event */
* in SDL_EVENT_WILL_ENTER_BACKGROUND. After nativeSendQuit() is called, no
* events other than SDL_EVENT_QUIT and SDL_EVENT_TERMINATING should fire */
SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST);
/* Inject a SDL_EVENT_QUIT event */
SDL_SendQuit();
SDL_SendAppEvent(SDL_APP_TERMINATING);
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
/* Robustness: clear any pending Pause */
while (SDL_SemTryWait(Android_PauseSem) == 0) {
/* empty */
}
/* Resume the event loop so that the app can catch SDL_QUIT which
/* Resume the event loop so that the app can catch SDL_EVENT_QUIT which
* should now be the top event in the event queue. */
SDL_SemPost(Android_ResumeSem);
}
@ -1285,7 +1285,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)(
if (Android_Window) {
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()");
SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST), 0, 0);
SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST), 0, 0);
}
SDL_UnlockMutex(Android_ActivityMutex);
@ -2625,7 +2625,7 @@ int Android_JNI_GetLocale(char *buf, size_t buflen)
SDL_assert(buflen > 6);
/* Need to re-create the asset manager if locale has changed (SDL_LOCALECHANGED) */
/* Need to re-create the asset manager if locale has changed (SDL_EVENT_LOCALE_CHANGED) */
Internal_Android_Destroy_AssetManager();
if (asset_manager == NULL) {

View File

@ -157,7 +157,7 @@ SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler");
if (quiesced) {
ResetEvent(plmSuspendComplete);
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
// To defer suspension, we must wait to exit this callback.
// IMPORTANT: The app must call SDL_GDKSuspendComplete() to release this lock.
@ -165,7 +165,7 @@ SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler: plmSuspendComplete event signaled.");
} else {
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
}
};
if (RegisterAppStateChangeNotification(rascn, NULL, &hPLM)) {

View File

@ -119,23 +119,23 @@ class SDL_BApp : public BApplication
break;
case BAPP_REPAINT:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_EXPOSED);
break;
case BAPP_MAXIMIZE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MAXIMIZED);
break;
case BAPP_MINIMIZE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MINIMIZED);
break;
case BAPP_SHOW:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_SHOWN);
break;
case BAPP_HIDE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_HIDDEN);
break;
case BAPP_MOUSE_FOCUS:
@ -147,7 +147,7 @@ class SDL_BApp : public BApplication
break;
case BAPP_WINDOW_CLOSE_REQUESTED:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_CLOSE_REQUESTED);
break;
case BAPP_WINDOW_MOVED:
@ -310,7 +310,7 @@ class SDL_BApp : public BApplication
HAIKU_SetKeyState(scancode, state);
SDL_SendKeyboardKey(0, state, HAIKU_GetScancodeFromBeKey(scancode));
if (state == SDL_PRESSED && SDL_EventEnabled(SDL_TEXTINPUT)) {
if (state == SDL_PRESSED && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
const int8 *keyUtf8;
ssize_t count;
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
@ -373,7 +373,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_MOVED, xPos, yPos);
}
void _HandleWindowResized(BMessage *msg)
@ -389,7 +389,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_RESIZED, w, h);
}
bool _GetWinID(BMessage *msg, int32 *winID)

View File

@ -145,17 +145,17 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
const Uint32 latestFlags = WINRT_DetectWindowFlags(window);
if (latestFlags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
/* The window can move during a resize event, such as when maximizing
or resizing from a corner */
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h);
}
}
}
@ -237,7 +237,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender)
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SIZE_CHANGED, w, h);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_SIZE_CHANGED, w, h);
}
#endif
}
@ -370,18 +370,18 @@ bool SDL_WinRTApp::ShouldWaitForAppResumeEvents()
/* Don't wait until the window-hide events finish processing.
* Do note that if an app-suspend event is sent (as indicated
* by SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND
* by SDL_EVENT_WILL_ENTER_BACKGROUND and SDL_EVENT_DID_ENTER_BACKGROUND
* events), then this code may be a moot point, as WinRT's
* own event pump (aka ProcessEvents()) will pause regardless
* of what we do here. This happens on Windows Phone 8, to note.
* Windows 8.x apps, on the other hand, may get a chance to run
* these.
*/
if (IsSDLWindowEventPending(SDL_WINDOWEVENT_HIDDEN)) {
if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_HIDDEN)) {
return false;
} else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_FOCUS_LOST)) {
} else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_FOCUS_LOST)) {
return false;
} else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_MINIMIZED)) {
} else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_MINIMIZED)) {
return false;
}
@ -490,17 +490,17 @@ void SDL_WinRTApp::OnVisibilityChanged(CoreWindow ^ sender, VisibilityChangedEve
SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow);
if (args->Visible) {
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_SHOWN, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0);
if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
} else {
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
// HACK: Prevent SDL's window-hide handling code, which currently
@ -531,7 +531,7 @@ void SDL_WinRTApp::OnWindowActivated(CoreWindow ^ sender, WindowActivatedEventAr
SDL_Window *window = WINRT_GlobalSDLWindow;
if (window) {
if (args->WindowActivationState != CoreWindowActivationState::Deactivated) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
if (SDL_GetKeyboardFocus() != window) {
SDL_SetKeyboardFocus(window);
}
@ -597,12 +597,12 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^
// ... but first, let the app know it's about to go to the background.
// The separation of events may be important, given that the deferral
// runs in a separate thread. This'll make SDL_APP_WILLENTERBACKGROUND
// runs in a separate thread. This'll make SDL_EVENT_WILL_ENTER_BACKGROUND
// the only event among the two that runs in the main thread. Given
// that a few WinRT operations can only be done from the main thread
// (things that access the WinRT CoreWindow are one example of this),
// this could be important.
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
SuspendingDeferral ^ deferral = args->SuspendingOperation->GetDeferral();
create_task([this, deferral]() {
@ -613,7 +613,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^
// event queue won't get received until the WinRT app is resumed.
// SDL_AddEventWatch() may be used to receive app-suspend events on
// WinRT.
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
// Let the Direct3D 11 renderer prepare for the app to be backgrounded.
// This is necessary for Windows 8.1, possibly elsewhere in the future.
@ -636,13 +636,13 @@ void SDL_WinRTApp::OnResuming(Platform::Object ^ sender, Platform::Object ^ args
// Restore any data or state that was unloaded on suspend. By default, data
// and state are persisted when resuming from suspend. Note that these events
// do not occur if the app was previously terminated.
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
}
void SDL_WinRTApp::OnExiting(Platform::Object ^ sender, Platform::Object ^ args)
{
SDL_SendAppEvent(SDL_APP_TERMINATING);
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
}
static void WINRT_LogPointerEvent(const char *header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)

View File

@ -31,9 +31,9 @@ int SDL_SendClipboardUpdate(void)
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_CLIPBOARDUPDATE)) {
if (SDL_EventEnabled(SDL_EVENT_CLIPBOARD_UPDATE)) {
SDL_Event event;
event.type = SDL_CLIPBOARDUPDATE;
event.type = SDL_EVENT_CLIPBOARD_UPDATE;
event.common.timestamp = 0;
posted = (SDL_PushEvent(&event) > 0);
}

View File

@ -32,7 +32,7 @@ int SDL_SendDisplayEvent(SDL_VideoDisplay *display, SDL_EventType displayevent,
return 0;
}
switch (displayevent) {
case SDL_DISPLAYEVENT_ORIENTATION:
case SDL_EVENT_DISPLAY_ORIENTATION:
if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) {
return 0;
}

View File

@ -39,7 +39,7 @@ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const ch
if (need_begin) {
SDL_zero(event);
event.type = SDL_DROPBEGIN;
event.type = SDL_EVENT_DROP_BEGIN;
event.common.timestamp = 0;
event.drop.windowID = window ? window->id : 0;
posted = (SDL_PushEvent(&event) > 0);
@ -60,7 +60,7 @@ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const ch
event.drop.windowID = window ? window->id : 0;
posted = (SDL_PushEvent(&event) > 0);
if (posted && (evtype == SDL_DROPCOMPLETE)) {
if (posted && (evtype == SDL_EVENT_DROP_COMPLETE)) {
if (window) {
window->is_dropping = SDL_FALSE;
} else {
@ -73,15 +73,15 @@ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const ch
int SDL_SendDropFile(SDL_Window *window, const char *file)
{
return SDL_SendDrop(window, SDL_DROPFILE, file);
return SDL_SendDrop(window, SDL_EVENT_DROP_FILE, file);
}
int SDL_SendDropText(SDL_Window *window, const char *text)
{
return SDL_SendDrop(window, SDL_DROPTEXT, text);
return SDL_SendDrop(window, SDL_EVENT_DROP_TEXT, text);
}
int SDL_SendDropComplete(SDL_Window *window)
{
return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL);
return SDL_SendDrop(window, SDL_EVENT_DROP_COMPLETE, NULL);
}

View File

@ -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)

View File

@ -768,11 +768,11 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
}
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST,
0, 0);
/* Ensures IME compositions are committed */
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StopTextInput) {
video->StopTextInput(video);
@ -783,10 +783,10 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
keyboard->focus = window;
if (keyboard->focus) {
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_GAINED,
0, 0);
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StartTextInput) {
video->StartTextInput(video);
@ -816,10 +816,10 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
/* Figure out what type of event this is */
switch (state) {
case SDL_PRESSED:
type = SDL_KEYDOWN;
type = SDL_EVENT_KEY_DOWN;
break;
case SDL_RELEASED:
type = SDL_KEYUP;
type = SDL_EVENT_KEY_UP;
break;
default:
/* Invalid state -- bail */
@ -888,7 +888,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
modifier = SDL_KMOD_NONE;
break;
}
if (SDL_KEYDOWN == type) {
if (SDL_EVENT_KEY_DOWN == type) {
switch (keycode) {
case SDLK_NUMLOCKCLEAR:
keyboard->modstate ^= SDL_KMOD_NUM;
@ -1028,11 +1028,11 @@ int SDL_SendKeyboardText(const char *text)
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_Event event;
size_t pos = 0, advance, length = SDL_strlen(text);
event.type = SDL_TEXTINPUT;
event.type = SDL_EVENT_TEXT_INPUT;
event.common.timestamp = 0;
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
while (pos < length) {
@ -1054,19 +1054,19 @@ int SDL_SendEditingText(const char *text, int start, int length)
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_TEXTEDITING)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_EDITING)) {
SDL_Event event;
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) &&
SDL_strlen(text) >= SDL_arraysize(event.text.text)) {
event.type = SDL_TEXTEDITING_EXT;
event.type = SDL_EVENT_TEXTEDITING_EXT;
event.common.timestamp = 0;
event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0;
event.editExt.text = text ? SDL_strdup(text) : NULL;
event.editExt.start = start;
event.editExt.length = length;
} else {
event.type = SDL_TEXTEDITING;
event.type = SDL_EVENT_TEXT_EDITING;
event.common.timestamp = 0;
event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
event.edit.start = start;

View File

@ -290,14 +290,14 @@ void SDL_SetMouseFocus(SDL_Window *window)
/* See if the current window has lost focus */
if (mouse->focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
SDL_SendWindowEvent(mouse->focus, SDL_EVENT_WINDOW_MOUSE_LEAVE, 0, 0);
}
mouse->focus = window;
mouse->has_position = SDL_FALSE;
if (mouse->focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
SDL_SendWindowEvent(mouse->focus, SDL_EVENT_WINDOW_MOUSE_ENTER, 0, 0);
}
/* Update cursor visibility */
@ -579,9 +579,9 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_MOUSEMOTION)) {
if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) {
SDL_Event event;
event.type = SDL_MOUSEMOTION;
event.type = SDL_EVENT_MOUSE_MOTION;
event.common.timestamp = timestamp;
event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
event.motion.which = mouseID;
@ -687,11 +687,11 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_
/* Figure out which event to perform */
switch (state) {
case SDL_PRESSED:
type = SDL_MOUSEBUTTONDOWN;
type = SDL_EVENT_MOUSE_BUTTONDOWN;
buttonstate |= SDL_BUTTON(button);
break;
case SDL_RELEASED:
type = SDL_MOUSEBUTTONUP;
type = SDL_EVENT_MOUSE_BUTTONUP;
buttonstate &= ~SDL_BUTTON(button);
break;
default:
@ -789,9 +789,9 @@ int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_MOUSEWHEEL)) {
if (SDL_EventEnabled(SDL_EVENT_MOUSE_WHEEL)) {
SDL_Event event;
event.type = SDL_MOUSEWHEEL;
event.type = SDL_EVENT_MOUSE_WHEEL;
event.common.timestamp = timestamp;
event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
event.wheel.which = mouseID;
@ -1053,7 +1053,7 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled)
}
/* Flush pending mouse motion - ideally we would pump events, but that's not always safe */
SDL_FlushEvent(SDL_MOUSEMOTION);
SDL_FlushEvent(SDL_EVENT_MOUSE_MOTION);
return 0;
}

View File

@ -191,5 +191,5 @@ int SDL_SendQuit(void)
#ifdef HAVE_SIGNAL_SUPPORT
send_quit_pending = SDL_FALSE;
#endif
return SDL_SendAppEvent(SDL_QUIT);
return SDL_SendAppEvent(SDL_EVENT_QUIT);
}

View File

@ -319,9 +319,9 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
}
posted = 0;
if (SDL_EventEnabled(SDL_FINGERDOWN)) {
if (SDL_EventEnabled(SDL_EVENT_FINGER_DOWN)) {
SDL_Event event;
event.type = SDL_FINGERDOWN;
event.type = SDL_EVENT_FINGER_DOWN;
event.common.timestamp = timestamp;
event.tfinger.touchId = id;
event.tfinger.fingerId = fingerid;
@ -340,9 +340,9 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
}
posted = 0;
if (SDL_EventEnabled(SDL_FINGERUP)) {
if (SDL_EventEnabled(SDL_EVENT_FINGER_UP)) {
SDL_Event event;
event.type = SDL_FINGERUP;
event.type = SDL_EVENT_FINGER_UP;
event.common.timestamp = timestamp;
event.tfinger.touchId = id;
event.tfinger.fingerId = fingerid;
@ -437,9 +437,9 @@ int SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid,
/* Post the event, if desired */
posted = 0;
if (SDL_EventEnabled(SDL_FINGERMOTION)) {
if (SDL_EventEnabled(SDL_EVENT_FINGER_MOTION)) {
SDL_Event event;
event.type = SDL_FINGERMOTION;
event.type = SDL_EVENT_FINGER_MOTION;
event.common.timestamp = timestamp;
event.tfinger.touchId = id;
event.tfinger.fingerId = fingerid;

View File

@ -36,11 +36,11 @@ static int SDLCALL RemovePendingSizeChangedAndResizedEvents(void *_userdata, SDL
RemovePendingSizeChangedAndResizedEvents_Data *userdata = (RemovePendingSizeChangedAndResizedEvents_Data *)_userdata;
const SDL_Event *new_event = userdata->new_event;
if ((event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
event->type == SDL_WINDOWEVENT_RESIZED) &&
if ((event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
event->type == SDL_EVENT_WINDOW_RESIZED) &&
event->window.windowID == new_event->window.windowID) {
if (event->type == SDL_WINDOWEVENT_RESIZED) {
if (event->type == SDL_EVENT_WINDOW_RESIZED) {
userdata->saw_resized = SDL_TRUE;
}
@ -54,7 +54,7 @@ static int SDLCALL RemovePendingMoveEvents(void *userdata, SDL_Event *event)
{
SDL_Event *new_event = (SDL_Event *)userdata;
if (event->type == SDL_WINDOWEVENT_MOVED &&
if (event->type == SDL_EVENT_WINDOW_MOVED &&
event->window.windowID == new_event->window.windowID) {
/* We're about to post a new move event, drop the old one */
return 0;
@ -66,7 +66,7 @@ static int SDLCALL RemovePendingExposedEvents(void *userdata, SDL_Event *event)
{
SDL_Event *new_event = (SDL_Event *)userdata;
if (event->type == SDL_WINDOWEVENT_EXPOSED &&
if (event->type == SDL_EVENT_WINDOW_EXPOSED &&
event->window.windowID == new_event->window.windowID) {
/* We're about to post a new exposed event, drop the old one */
return 0;
@ -83,21 +83,21 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
return 0;
}
switch (windowevent) {
case SDL_WINDOWEVENT_SHOWN:
case SDL_EVENT_WINDOW_SHOWN:
if (!(window->flags & SDL_WINDOW_HIDDEN)) {
return 0;
}
window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
SDL_OnWindowShown(window);
break;
case SDL_WINDOWEVENT_HIDDEN:
case SDL_EVENT_WINDOW_HIDDEN:
if (window->flags & SDL_WINDOW_HIDDEN) {
return 0;
}
window->flags |= SDL_WINDOW_HIDDEN;
SDL_OnWindowHidden(window);
break;
case SDL_WINDOWEVENT_MOVED:
case SDL_EVENT_WINDOW_MOVED:
if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
return 0;
@ -113,7 +113,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
window->y = data2;
SDL_OnWindowMoved(window);
break;
case SDL_WINDOWEVENT_RESIZED:
case SDL_EVENT_WINDOW_RESIZED:
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->windowed.w = data1;
window->windowed.h = data2;
@ -125,7 +125,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
window->h = data2;
SDL_OnWindowResized(window);
break;
case SDL_WINDOWEVENT_MINIMIZED:
case SDL_EVENT_WINDOW_MINIMIZED:
if (window->flags & SDL_WINDOW_MINIMIZED) {
return 0;
}
@ -133,49 +133,49 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
window->flags |= SDL_WINDOW_MINIMIZED;
SDL_OnWindowMinimized(window);
break;
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_EVENT_WINDOW_MAXIMIZED:
if (window->flags & SDL_WINDOW_MAXIMIZED) {
return 0;
}
window->flags &= ~SDL_WINDOW_MINIMIZED;
window->flags |= SDL_WINDOW_MAXIMIZED;
break;
case SDL_WINDOWEVENT_RESTORED:
case SDL_EVENT_WINDOW_RESTORED:
if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
return 0;
}
window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED);
SDL_OnWindowRestored(window);
break;
case SDL_WINDOWEVENT_ENTER:
case SDL_EVENT_WINDOW_MOUSE_ENTER:
if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
return 0;
}
window->flags |= SDL_WINDOW_MOUSE_FOCUS;
SDL_OnWindowEnter(window);
break;
case SDL_WINDOWEVENT_LEAVE:
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
return 0;
}
window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
SDL_OnWindowLeave(window);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
case SDL_EVENT_WINDOW_FOCUS_GAINED:
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
return 0;
}
window->flags |= SDL_WINDOW_INPUT_FOCUS;
SDL_OnWindowFocusGained(window);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
case SDL_EVENT_WINDOW_FOCUS_LOST:
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
return 0;
}
window->flags &= ~SDL_WINDOW_INPUT_FOCUS;
SDL_OnWindowFocusLost(window);
break;
case SDL_WINDOWEVENT_DISPLAY_CHANGED:
case SDL_EVENT_WINDOW_DISPLAY_CHANGED:
SDL_assert(data1 == window->display_index);
SDL_OnWindowDisplayChanged(window);
break;
@ -194,33 +194,33 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
event.window.windowID = window->id;
/* Fixes queue overflow with resize events that aren't processed */
if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (windowevent == SDL_EVENT_WINDOW_SIZE_CHANGED) {
/* !!! FIXME: in SDL3, let's make RESIZED/SIZE_CHANGED into one event with a flag to distinguish between them, and remove all this tapdancing. */
RemovePendingSizeChangedAndResizedEvents_Data userdata;
userdata.new_event = &event;
userdata.saw_resized = SDL_FALSE;
SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &userdata);
if (userdata.saw_resized) { /* if there was a pending resize, make sure one at the new dimensions remains. */
event.type = SDL_WINDOWEVENT_RESIZED;
event.type = SDL_EVENT_WINDOW_RESIZED;
if (SDL_PushEvent(&event) <= 0) {
return 0; /* oh well. */
}
event.type = SDL_WINDOWEVENT_SIZE_CHANGED; /* then push the actual event next. */
event.type = SDL_EVENT_WINDOW_SIZE_CHANGED; /* then push the actual event next. */
}
}
if (windowevent == SDL_WINDOWEVENT_MOVED) {
if (windowevent == SDL_EVENT_WINDOW_MOVED) {
SDL_FilterEvents(RemovePendingMoveEvents, &event);
}
if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
if (windowevent == SDL_EVENT_WINDOW_EXPOSED) {
SDL_FilterEvents(RemovePendingExposedEvents, &event);
}
posted = (SDL_PushEvent(&event) > 0);
}
if (windowevent == SDL_WINDOWEVENT_CLOSE) {
if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
if (!window->prev && !window->next) {
if (SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, SDL_TRUE)) {
SDL_SendQuit(); /* This is the last window in the list so send the SDL_QUIT event */
SDL_SendQuit(); /* This is the last window in the list so send the SDL_EVENT_QUIT event */
}
}
}

View File

@ -378,7 +378,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
SDL_Gamepad *gamepad;
switch (event->type) {
case SDL_JOYAXISMOTION:
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
{
SDL_AssertJoysticksLocked();
@ -389,8 +389,8 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
}
}
} break;
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
case SDL_EVENT_JOYSTICK_BUTTON_UP:
{
SDL_AssertJoysticksLocked();
@ -401,7 +401,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
}
}
} break;
case SDL_JOYHATMOTION:
case SDL_EVENT_JOYSTICK_HAT_MOTION:
{
SDL_AssertJoysticksLocked();
@ -412,18 +412,18 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
}
}
} break;
case SDL_JOYDEVICEADDED:
case SDL_EVENT_JOYSTICK_ADDED:
{
if (SDL_IsGamepad(event->jdevice.which)) {
SDL_Event deviceevent;
deviceevent.type = SDL_GAMEPADADDED;
deviceevent.type = SDL_EVENT_GAMEPAD_ADDED;
deviceevent.common.timestamp = 0;
deviceevent.cdevice.which = event->jdevice.which;
SDL_PushEvent(&deviceevent);
}
} break;
case SDL_JOYDEVICEREMOVED:
case SDL_EVENT_JOYSTICK_REMOVED:
{
SDL_AssertJoysticksLocked();
@ -438,7 +438,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
{
SDL_Event deviceevent;
deviceevent.type = SDL_GAMEPADREMOVED;
deviceevent.type = SDL_EVENT_GAMEPAD_REMOVED;
deviceevent.common.timestamp = 0;
deviceevent.cdevice.which = event->jdevice.which;
SDL_PushEvent(&deviceevent);
@ -1215,7 +1215,7 @@ static void SDL_PrivateRefreshGamepadMapping(GamepadMapping_t *pGamepadMapping)
{
SDL_Event event;
event.type = SDL_GAMEPADREMAPPED;
event.type = SDL_EVENT_GAMEPAD_REMAPPED;
event.common.timestamp = 0;
event.cdevice.which = gamepad->joystick->instance_id;
SDL_PushEvent(&event);
@ -1902,7 +1902,7 @@ int SDL_InitGamepads(void)
for (i = 0; joysticks[i]; ++i) {
if (SDL_IsGamepad(joysticks[i])) {
SDL_Event deviceevent;
deviceevent.type = SDL_GAMEPADADDED;
deviceevent.type = SDL_EVENT_GAMEPAD_ADDED;
deviceevent.common.timestamp = 0;
deviceevent.cdevice.which = joysticks[i];
SDL_PushEvent(&deviceevent);
@ -3058,9 +3058,9 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
/* translate the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_GAMEPADAXISMOTION)) {
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) {
SDL_Event event;
event.type = SDL_GAMEPADAXISMOTION;
event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION;
event.common.timestamp = timestamp;
event.caxis.which = gamepad->joystick->instance_id;
event.caxis.axis = axis;
@ -3088,10 +3088,10 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
switch (state) {
case SDL_PRESSED:
event.type = SDL_GAMEPADBUTTONDOWN;
event.type = SDL_EVENT_GAMEPAD_BUTTON_DOWN;
break;
case SDL_RELEASED:
event.type = SDL_GAMEPADBUTTONUP;
event.type = SDL_EVENT_GAMEPAD_BUTTON_UP;
break;
default:
/* Invalid state -- bail */
@ -3132,16 +3132,16 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
}
static const Uint32 SDL_gamepad_event_list[] = {
SDL_GAMEPADAXISMOTION,
SDL_GAMEPADBUTTONDOWN,
SDL_GAMEPADBUTTONUP,
SDL_GAMEPADADDED,
SDL_GAMEPADREMOVED,
SDL_GAMEPADREMAPPED,
SDL_GAMEPADTOUCHPADDOWN,
SDL_GAMEPADTOUCHPADMOTION,
SDL_GAMEPADTOUCHPADUP,
SDL_GAMEPADSENSORUPDATE,
SDL_EVENT_GAMEPAD_AXIS_MOTION,
SDL_EVENT_GAMEPAD_BUTTON_DOWN,
SDL_EVENT_GAMEPAD_BUTTON_UP,
SDL_EVENT_GAMEPAD_ADDED,
SDL_EVENT_GAMEPAD_REMOVED,
SDL_EVENT_GAMEPAD_REMAPPED,
SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN,
SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION,
SDL_EVENT_GAMEPAD_TOUCHPAD_UP,
SDL_EVENT_GAMEPAD_SENSOR_UPDATE,
};
void SDL_SetGamepadEventsEnabled(SDL_bool enabled)

View File

@ -1403,7 +1403,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
{
SDL_Event event;
event.type = SDL_JOYDEVICEADDED;
event.type = SDL_EVENT_JOYSTICK_ADDED;
event.common.timestamp = 0;
if (SDL_EventEnabled(event.type)) {
@ -1465,7 +1465,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
}
#if !SDL_EVENTS_DISABLED
event.type = SDL_JOYDEVICEREMOVED;
event.type = SDL_EVENT_JOYSTICK_REMOVED;
event.common.timestamp = 0;
if (SDL_EventEnabled(event.type)) {
@ -1534,9 +1534,9 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_JOYAXISMOTION)) {
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) {
SDL_Event event;
event.type = SDL_JOYAXISMOTION;
event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION;
event.common.timestamp = timestamp;
event.jaxis.which = joystick->instance_id;
event.jaxis.axis = axis;
@ -1576,9 +1576,9 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_JOYHATMOTION)) {
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) {
SDL_Event event;
event.type = SDL_JOYHATMOTION;
event.type = SDL_EVENT_JOYSTICK_HAT_MOTION;
event.common.timestamp = timestamp;
event.jhat.which = joystick->instance_id;
event.jhat.hat = hat;
@ -1599,10 +1599,10 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
switch (state) {
case SDL_PRESSED:
event.type = SDL_JOYBUTTONDOWN;
event.type = SDL_EVENT_JOYSTICK_BUTTON_DOWN;
break;
case SDL_RELEASED:
event.type = SDL_JOYBUTTONUP;
event.type = SDL_EVENT_JOYSTICK_BUTTON_UP;
break;
default:
/* Invalid state -- bail */
@ -1701,13 +1701,13 @@ void SDL_UpdateJoysticks(void)
}
static const Uint32 SDL_joystick_event_list[] = {
SDL_JOYAXISMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_JOYBATTERYUPDATED
SDL_EVENT_JOYSTICK_AXIS_MOTION,
SDL_EVENT_JOYSTICK_HAT_MOTION,
SDL_EVENT_JOYSTICK_BUTTON_DOWN,
SDL_EVENT_JOYSTICK_BUTTON_UP,
SDL_EVENT_JOYSTICK_ADDED,
SDL_EVENT_JOYSTICK_REMOVED,
SDL_EVENT_JOYSTICK_BATTERY_UPDATED
};
void SDL_SetJoystickEventsEnabled(SDL_bool enabled)
@ -2833,9 +2833,9 @@ void SDL_SendJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
if (ePowerLevel != joystick->epowerlevel) {
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_JOYBATTERYUPDATED)) {
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) {
SDL_Event event;
event.type = SDL_JOYBATTERYUPDATED;
event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
event.common.timestamp = 0;
event.jbattery.which = joystick->instance_id;
event.jbattery.level = ePowerLevel;
@ -2914,16 +2914,16 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch
}
if (state == finger_info->state) {
event_type = SDL_GAMEPADTOUCHPADMOTION;
event_type = SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION;
} else if (state) {
event_type = SDL_GAMEPADTOUCHPADDOWN;
event_type = SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN;
} else {
event_type = SDL_GAMEPADTOUCHPADUP;
event_type = SDL_EVENT_GAMEPAD_TOUCHPAD_UP;
}
/* We ignore events if we don't have keyboard focus, except for touch release */
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
if (event_type != SDL_GAMEPADTOUCHPADUP) {
if (event_type != SDL_EVENT_GAMEPAD_TOUCHPAD_UP) {
return 0;
}
}
@ -2977,9 +2977,9 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT
/* Post the event, if desired */
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_GAMEPADSENSORUPDATE)) {
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) {
SDL_Event event;
event.type = SDL_GAMEPADSENSORUPDATE;
event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
event.common.timestamp = timestamp;
event.csensor.which = joystick->instance_id;
event.csensor.sensor = type;

View File

@ -33,7 +33,7 @@
/* as a courtesy to iOS apps, we don't try to draw when in the background, as
that will crash the app. However, these apps _should_ have used
SDL_AddEventWatch to catch SDL_APP_WILLENTERBACKGROUND events and stopped
SDL_AddEventWatch to catch SDL_EVENT_WILL_ENTER_BACKGROUND events and stopped
drawing themselves. Other platforms still draw, as the compositor can use it,
and more importantly: drawing to render targets isn't lost. But I still think
this should probably be removed at some point in the future. --ryan. */
@ -672,7 +672,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
{
SDL_Renderer *renderer = (SDL_Renderer *)userdata;
if (event->type >= SDL_WINDOWEVENT_FIRST && event->type <= SDL_WINDOWEVENT_LAST) {
if (event->type >= SDL_EVENT_WINDOW_FIRST && event->type <= SDL_EVENT_WINDOW_LAST) {
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
if (window == renderer->window) {
if (renderer->WindowEvent) {
@ -683,8 +683,8 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
* window display changes as well! If the new display has a new DPI,
* we need to update the viewport for the new window/drawable ratio.
*/
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
event->type == SDL_WINDOWEVENT_DISPLAY_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
event->type == SDL_EVENT_WINDOW_DISPLAY_CHANGED) {
/* Make sure we're operating on the default render target */
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
if (saved_target) {
@ -737,22 +737,22 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
if (saved_target) {
SDL_SetRenderTarget(renderer, saved_target);
}
} else if (event->type == SDL_WINDOWEVENT_HIDDEN) {
} else if (event->type == SDL_EVENT_WINDOW_HIDDEN) {
renderer->hidden = SDL_TRUE;
} else if (event->type == SDL_WINDOWEVENT_SHOWN) {
} else if (event->type == SDL_EVENT_WINDOW_SHOWN) {
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) {
renderer->hidden = SDL_FALSE;
}
} else if (event->type == SDL_WINDOWEVENT_MINIMIZED) {
} else if (event->type == SDL_EVENT_WINDOW_MINIMIZED) {
renderer->hidden = SDL_TRUE;
} else if (event->type == SDL_WINDOWEVENT_RESTORED ||
event->type == SDL_WINDOWEVENT_MAXIMIZED) {
} else if (event->type == SDL_EVENT_WINDOW_RESTORED ||
event->type == SDL_EVENT_WINDOW_MAXIMIZED) {
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) {
renderer->hidden = SDL_FALSE;
}
}
}
} else if (event->type == SDL_MOUSEMOTION) {
} else if (event->type == SDL_EVENT_MOUSE_MOTION) {
SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID);
if (window == renderer->window) {
int logical_w, logical_h;
@ -772,8 +772,8 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
}
}
}
} else if (event->type == SDL_MOUSEBUTTONDOWN ||
event->type == SDL_MOUSEBUTTONUP) {
} else if (event->type == SDL_EVENT_MOUSE_BUTTONDOWN ||
event->type == SDL_EVENT_MOUSE_BUTTONUP) {
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
if (window == renderer->window) {
int logical_w, logical_h;
@ -787,7 +787,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
event->button.y /= (scale.y * renderer->dpi_scale.y);
}
}
} else if (event->type == SDL_MOUSEWHEEL) {
} else if (event->type == SDL_EVENT_MOUSE_WHEEL) {
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
if (window == renderer->window) {
int logical_w, logical_h;
@ -801,9 +801,9 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
event->wheel.mouseY /= (scale.y * renderer->dpi_scale.y);
}
}
} else if (event->type == SDL_FINGERDOWN ||
event->type == SDL_FINGERUP ||
event->type == SDL_FINGERMOTION) {
} else if (event->type == SDL_EVENT_FINGER_DOWN ||
event->type == SDL_EVENT_FINGER_UP ||
event->type == SDL_EVENT_FINGER_MOTION) {
int logical_w, logical_h;
float physical_w, physical_h;
SDL_DRect viewport;

View File

@ -331,7 +331,7 @@ static void D3D_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event
{
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
data->updateSize = SDL_TRUE;
}
}
@ -1518,7 +1518,7 @@ static int D3D_Reset(SDL_Renderer *renderer)
/* Let the application know that render targets were reset */
{
SDL_Event event;
event.type = SDL_RENDER_TARGETS_RESET;
event.type = SDL_EVENT_RENDER_TARGETS_RESET;
event.common.timestamp = 0;
SDL_PushEvent(&event);
}

View File

@ -873,7 +873,7 @@ D3D11_HandleDeviceLost(SDL_Renderer *renderer)
/* Let the application know that the device has been reset */
{
SDL_Event event;
event.type = SDL_RENDER_DEVICE_RESET;
event.type = SDL_EVENT_RENDER_DEVICE_RESET;
event.common.timestamp = 0;
SDL_PushEvent(&event);
}
@ -1028,7 +1028,7 @@ void D3D11_Trim(SDL_Renderer *renderer)
static void D3D11_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
{
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
D3D11_UpdateForWindowSizeChange(renderer);
}
}

View File

@ -1231,7 +1231,7 @@ D3D12_HandleDeviceLost(SDL_Renderer *renderer)
/* Let the application know that the device has been reset */
{
SDL_Event event;
event.type = SDL_RENDER_DEVICE_RESET;
event.type = SDL_EVENT_RENDER_DEVICE_RESET;
event.common.timestamp = 0;
SDL_PushEvent(&event);
}
@ -1376,7 +1376,7 @@ static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer *renderer)
static void D3D12_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
{
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
D3D12_UpdateForWindowSizeChange(renderer);
}
}

View File

@ -324,8 +324,8 @@ static void GL_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
* changed behind our backs. x/y changes might seem weird but viewport
* resets have been observed on macOS at minimum!
*/
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
event->type == SDL_WINDOWEVENT_MOVED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
event->type == SDL_EVENT_WINDOW_MOVED) {
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
data->drawstate.viewport_dirty = SDL_TRUE;
}

View File

@ -305,7 +305,7 @@ static void GLES2_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *eve
{
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
if (event->type == SDL_WINDOWEVENT_MINIMIZED) {
if (event->type == SDL_EVENT_WINDOW_MINIMIZED) {
/* According to Apple documentation, we need to finish drawing NOW! */
data->glFinish();
}

View File

@ -69,7 +69,7 @@ static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
{
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
data->surface = NULL;
data->window = NULL;
}

View File

@ -485,9 +485,9 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_SENSORUPDATE)) {
if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) {
SDL_Event event;
event.type = SDL_SENSORUPDATE;
event.type = SDL_EVENT_SENSOR_UPDATE;
event.common.timestamp = timestamp;
event.sensor.which = sensor->instance_id;
num_values = SDL_min(num_values, SDL_arraysize(event.sensor.data));

View File

@ -1427,136 +1427,136 @@ static const char *GamepadButtonName(const SDL_GamepadButton button)
static void SDLTest_PrintEvent(SDL_Event *event)
{
switch (event->type) {
case SDL_DISPLAYEVENT_CONNECTED:
case SDL_EVENT_DISPLAY_CONNECTED:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " connected",
event->display.display);
break;
case SDL_DISPLAYEVENT_MOVED:
case SDL_EVENT_DISPLAY_MOVED:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed position",
event->display.display);
break;
case SDL_DISPLAYEVENT_ORIENTATION:
case SDL_EVENT_DISPLAY_ORIENTATION:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed orientation to %s",
event->display.display, DisplayOrientationName(event->display.data1));
break;
case SDL_DISPLAYEVENT_DISCONNECTED:
case SDL_EVENT_DISPLAY_DISCONNECTED:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " disconnected",
event->display.display);
break;
case SDL_WINDOWEVENT_SHOWN:
case SDL_EVENT_WINDOW_SHOWN:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " shown", event->window.windowID);
break;
case SDL_WINDOWEVENT_HIDDEN:
case SDL_EVENT_WINDOW_HIDDEN:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hidden", event->window.windowID);
break;
case SDL_WINDOWEVENT_EXPOSED:
case SDL_EVENT_WINDOW_EXPOSED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " exposed", event->window.windowID);
break;
case SDL_WINDOWEVENT_MOVED:
case SDL_EVENT_WINDOW_MOVED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32,
event->window.windowID, event->window.data1, event->window.data2);
break;
case SDL_WINDOWEVENT_RESIZED:
case SDL_EVENT_WINDOW_RESIZED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32,
event->window.windowID, event->window.data1, event->window.data2);
break;
case SDL_WINDOWEVENT_SIZE_CHANGED:
case SDL_EVENT_WINDOW_SIZE_CHANGED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed size to %" SDL_PRIs32 "x%" SDL_PRIs32,
event->window.windowID, event->window.data1, event->window.data2);
break;
case SDL_WINDOWEVENT_MINIMIZED:
case SDL_EVENT_WINDOW_MINIMIZED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " minimized", event->window.windowID);
break;
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_EVENT_WINDOW_MAXIMIZED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " maximized", event->window.windowID);
break;
case SDL_WINDOWEVENT_RESTORED:
case SDL_EVENT_WINDOW_RESTORED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " restored", event->window.windowID);
break;
case SDL_WINDOWEVENT_ENTER:
case SDL_EVENT_WINDOW_MOUSE_ENTER:
SDL_Log("SDL EVENT: Mouse entered window %" SDL_PRIu32 "",
event->window.windowID);
break;
case SDL_WINDOWEVENT_LEAVE:
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
SDL_Log("SDL EVENT: Mouse left window %" SDL_PRIu32 "", event->window.windowID);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
case SDL_EVENT_WINDOW_FOCUS_GAINED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " gained keyboard focus",
event->window.windowID);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
case SDL_EVENT_WINDOW_FOCUS_LOST:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " lost keyboard focus",
event->window.windowID);
break;
case SDL_WINDOWEVENT_CLOSE:
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " closed", event->window.windowID);
break;
case SDL_WINDOWEVENT_TAKE_FOCUS:
case SDL_EVENT_WINDOW_TAKE_FOCUS:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " take focus", event->window.windowID);
break;
case SDL_WINDOWEVENT_HIT_TEST:
case SDL_EVENT_WINDOW_HIT_TEST:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hit test", event->window.windowID);
break;
case SDL_WINDOWEVENT_ICCPROF_CHANGED:
case SDL_EVENT_WINDOW_ICCPROF_CHANGED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " ICC profile changed", event->window.windowID);
break;
case SDL_WINDOWEVENT_DISPLAY_CHANGED:
case SDL_EVENT_WINDOW_DISPLAY_CHANGED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display changed to %" SDL_PRIs32 "", event->window.windowID, event->window.data1);
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
SDL_Log("SDL EVENT: Keyboard: key pressed in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s",
event->key.windowID,
event->key.keysym.scancode,
SDL_GetScancodeName(event->key.keysym.scancode),
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
break;
case SDL_KEYUP:
case SDL_EVENT_KEY_UP:
SDL_Log("SDL EVENT: Keyboard: key released in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s",
event->key.windowID,
event->key.keysym.scancode,
SDL_GetScancodeName(event->key.keysym.scancode),
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
break;
case SDL_TEXTEDITING:
case SDL_EVENT_TEXT_EDITING:
SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %" SDL_PRIu32,
event->edit.text, event->edit.windowID);
break;
case SDL_TEXTINPUT:
case SDL_EVENT_TEXT_INPUT:
SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %" SDL_PRIu32,
event->text.text, event->text.windowID);
break;
case SDL_KEYMAPCHANGED:
case SDL_EVENT_KEYMAP_CHANGED:
SDL_Log("SDL EVENT: Keymap changed");
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
SDL_Log("SDL EVENT: Mouse: moved to %g,%g (%g,%g) in window %" SDL_PRIu32,
event->motion.x, event->motion.y,
event->motion.xrel, event->motion.yrel,
event->motion.windowID);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
SDL_Log("SDL EVENT: Mouse: button %d pressed at %g,%g with click count %d in window %" SDL_PRIu32,
event->button.button, event->button.x, event->button.y, event->button.clicks,
event->button.windowID);
break;
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTONUP:
SDL_Log("SDL EVENT: Mouse: button %d released at %g,%g with click count %d in window %" SDL_PRIu32,
event->button.button, event->button.x, event->button.y, event->button.clicks,
event->button.windowID);
break;
case SDL_MOUSEWHEEL:
case SDL_EVENT_MOUSE_WHEEL:
SDL_Log("SDL EVENT: Mouse: wheel scrolled %g in x and %g in y (reversed: %" SDL_PRIu32 ") in window %" SDL_PRIu32,
event->wheel.x, event->wheel.y, event->wheel.direction, event->wheel.windowID);
break;
case SDL_JOYDEVICEADDED:
case SDL_EVENT_JOYSTICK_ADDED:
SDL_Log("SDL EVENT: Joystick index %" SDL_PRIu32 " attached",
event->jdevice.which);
break;
case SDL_JOYDEVICEREMOVED:
case SDL_EVENT_JOYSTICK_REMOVED:
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 " removed",
event->jdevice.which);
break;
case SDL_JOYHATMOTION:
case SDL_EVENT_JOYSTICK_HAT_MOTION:
{
const char *position = "UNKNOWN";
switch (event->jhat.value) {
@ -1591,101 +1591,101 @@ static void SDLTest_PrintEvent(SDL_Event *event)
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": hat %d moved to %s",
event->jhat.which, event->jhat.hat, position);
} break;
case SDL_JOYBUTTONDOWN:
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d pressed",
event->jbutton.which, event->jbutton.button);
break;
case SDL_JOYBUTTONUP:
case SDL_EVENT_JOYSTICK_BUTTON_UP:
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d released",
event->jbutton.which, event->jbutton.button);
break;
case SDL_GAMEPADADDED:
case SDL_EVENT_GAMEPAD_ADDED:
SDL_Log("SDL EVENT: Gamepad index %" SDL_PRIu32 " attached",
event->cdevice.which);
break;
case SDL_GAMEPADREMOVED:
case SDL_EVENT_GAMEPAD_REMOVED:
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " removed",
event->cdevice.which);
break;
case SDL_GAMEPADAXISMOTION:
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " axis %d ('%s') value: %d",
event->caxis.which,
event->caxis.axis,
GamepadAxisName((SDL_GamepadAxis)event->caxis.axis),
event->caxis.value);
break;
case SDL_GAMEPADBUTTONDOWN:
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 "button %d ('%s') down",
event->cbutton.which, event->cbutton.button,
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
break;
case SDL_GAMEPADBUTTONUP:
case SDL_EVENT_GAMEPAD_BUTTON_UP:
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " button %d ('%s') up",
event->cbutton.which, event->cbutton.button,
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
break;
case SDL_CLIPBOARDUPDATE:
case SDL_EVENT_CLIPBOARD_UPDATE:
SDL_Log("SDL EVENT: Clipboard updated");
break;
case SDL_FINGERMOTION:
case SDL_EVENT_FINGER_MOTION:
SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
(long)event->tfinger.touchId,
(long)event->tfinger.fingerId,
event->tfinger.x, event->tfinger.y,
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
break;
case SDL_FINGERDOWN:
case SDL_FINGERUP:
case SDL_EVENT_FINGER_DOWN:
case SDL_EVENT_FINGER_UP:
SDL_Log("SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
(event->type == SDL_FINGERDOWN) ? "down" : "up",
(event->type == SDL_EVENT_FINGER_DOWN) ? "down" : "up",
(long)event->tfinger.touchId,
(long)event->tfinger.fingerId,
event->tfinger.x, event->tfinger.y,
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
break;
case SDL_RENDER_DEVICE_RESET:
case SDL_EVENT_RENDER_DEVICE_RESET:
SDL_Log("SDL EVENT: render device reset");
break;
case SDL_RENDER_TARGETS_RESET:
case SDL_EVENT_RENDER_TARGETS_RESET:
SDL_Log("SDL EVENT: render targets reset");
break;
case SDL_APP_TERMINATING:
case SDL_EVENT_TERMINATING:
SDL_Log("SDL EVENT: App terminating");
break;
case SDL_APP_LOWMEMORY:
case SDL_EVENT_LOW_MEMORY:
SDL_Log("SDL EVENT: App running low on memory");
break;
case SDL_APP_WILLENTERBACKGROUND:
case SDL_EVENT_WILL_ENTER_BACKGROUND:
SDL_Log("SDL EVENT: App will enter the background");
break;
case SDL_APP_DIDENTERBACKGROUND:
case SDL_EVENT_DID_ENTER_BACKGROUND:
SDL_Log("SDL EVENT: App entered the background");
break;
case SDL_APP_WILLENTERFOREGROUND:
case SDL_EVENT_WILL_ENTER_FOREGROUND:
SDL_Log("SDL EVENT: App will enter the foreground");
break;
case SDL_APP_DIDENTERFOREGROUND:
case SDL_EVENT_DID_ENTER_FOREGROUND:
SDL_Log("SDL EVENT: App entered the foreground");
break;
case SDL_DROPBEGIN:
case SDL_EVENT_DROP_BEGIN:
SDL_Log("SDL EVENT: Drag and drop beginning");
break;
case SDL_DROPFILE:
case SDL_EVENT_DROP_FILE:
SDL_Log("SDL EVENT: Drag and drop file: '%s'", event->drop.file);
break;
case SDL_DROPTEXT:
case SDL_EVENT_DROP_TEXT:
SDL_Log("SDL EVENT: Drag and drop text: '%s'", event->drop.file);
break;
case SDL_DROPCOMPLETE:
case SDL_EVENT_DROP_COMPLETE:
SDL_Log("SDL EVENT: Drag and drop ending");
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
SDL_Log("SDL EVENT: Quit requested");
break;
case SDL_USEREVENT:
case SDL_EVENT_USER:
SDL_Log("SDL EVENT: User event %" SDL_PRIs32, event->user.code);
break;
default:
@ -1753,15 +1753,15 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
static SDL_MouseMotionEvent lastEvent;
if (state->verbose & VERBOSE_EVENT) {
if (((event->type != SDL_MOUSEMOTION) &&
(event->type != SDL_FINGERMOTION)) ||
if (((event->type != SDL_EVENT_MOUSE_MOTION) &&
(event->type != SDL_EVENT_FINGER_MOTION)) ||
((state->verbose & VERBOSE_MOTION) != 0)) {
SDLTest_PrintEvent(event);
}
}
switch (event->type) {
case SDL_WINDOWEVENT_CLOSE:
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
{
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
if (window) {
@ -1782,7 +1782,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
}
}
} break;
case SDL_WINDOWEVENT_FOCUS_LOST:
case SDL_EVENT_WINDOW_FOCUS_LOST:
if (state->flash_on_focus_loss) {
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
if (window) {
@ -1790,7 +1790,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
}
}
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
{
SDL_bool withControl = !!(event->key.keysym.mod & SDL_KMOD_CTRL);
SDL_bool withShift = !!(event->key.keysym.mod & SDL_KMOD_SHIFT);
@ -2112,15 +2112,15 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
}
break;
}
case SDL_QUIT:
case SDL_EVENT_QUIT:
*done = 1;
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
lastEvent = event->motion;
break;
case SDL_DROPFILE:
case SDL_DROPTEXT:
case SDL_EVENT_DROP_FILE:
case SDL_EVENT_DROP_TEXT:
SDL_free(event->drop.file);
break;
}

View File

@ -618,7 +618,7 @@ int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
}
if (send_event) {
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_CONNECTED, 0);
SDL_SendDisplayEvent(&_this->displays[index], SDL_EVENT_DISPLAY_CONNECTED, 0);
}
} else {
SDL_OutOfMemory();
@ -632,7 +632,7 @@ void SDL_DelVideoDisplay(int index)
return;
}
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0);
SDL_SendDisplayEvent(&_this->displays[index], SDL_EVENT_DISPLAY_DISCONNECTED, 0);
if (index < (_this->num_displays - 1)) {
SDL_free(_this->displays[index].driverdata);
@ -1243,7 +1243,7 @@ int SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
* use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such,
* Android's SetWindowFullscreen will generate the window event for us with the proper final size.
*/
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, fullscreen_mode.w, fullscreen_mode.h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, fullscreen_mode.w, fullscreen_mode.h);
#endif
}
}
@ -1455,10 +1455,10 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
*/
/* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos,
* WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled,
* WM_WINDOWPOSCHANGED will send SDL_EVENT_WINDOW_RESIZED). Also, on Windows with DPI scaling enabled,
* we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch.
*/
SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED,
SDL_SendWindowEvent(other, SDL_EVENT_WINDOW_RESIZED,
fullscreen_mode.w, fullscreen_mode.h);
#endif
} else {
@ -1499,7 +1499,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
{
if (SDL_EventEnabled(SDL_DROPFILE) || SDL_EventEnabled(SDL_DROPTEXT)) {
if (SDL_EventEnabled(SDL_EVENT_DROP_FILE) || SDL_EventEnabled(SDL_EVENT_DROP_TEXT)) {
return SDL_TRUE;
}
return SDL_FALSE;
@ -2299,7 +2299,7 @@ void SDL_SetWindowSize(SDL_Window *window, int w, int h)
_this->SetWindowSize(_this, window);
}
if (window->w != old_w || window->h != old_h) {
/* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
/* We didn't get a SDL_EVENT_WINDOW_RESIZED event (by design) */
SDL_OnWindowResized(window);
}
}
@ -2458,7 +2458,7 @@ void SDL_ShowWindow(SDL_Window *window)
if (_this->ShowWindow) {
_this->ShowWindow(_this, window);
}
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
}
void SDL_HideWindow(SDL_Window *window)
@ -2476,7 +2476,7 @@ void SDL_HideWindow(SDL_Window *window)
_this->HideWindow(_this, window);
}
window->is_hiding = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
}
void SDL_RaiseWindow(SDL_Window *window)
@ -2969,11 +2969,11 @@ void SDL_OnWindowResized(SDL_Window *window)
window->surface_valid = SDL_FALSE;
if (!window->is_destroying) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SIZE_CHANGED, window->w, window->h);
if (display_index != window->display_index && display_index != -1) {
window->display_index = display_index;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_DISPLAY_CHANGED, window->display_index, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_DISPLAY_CHANGED, window->display_index, 0);
}
}
}
@ -2984,7 +2984,7 @@ void SDL_OnWindowMoved(SDL_Window *window)
if (!window->is_destroying && display_index != window->display_index && display_index != -1) {
window->display_index = display_index;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_DISPLAY_CHANGED, window->display_index, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_DISPLAY_CHANGED, window->display_index, 0);
}
}
@ -4260,8 +4260,8 @@ void SDL_StartTextInput(void)
SDL_Window *window;
/* First, enable text events */
SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_TRUE);
SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_TRUE);
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_TRUE);
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_TRUE);
/* Then show the on-screen keyboard, if any */
window = SDL_GetFocusWindow();
@ -4293,7 +4293,7 @@ SDL_bool SDL_TextInputShown(void)
SDL_bool SDL_TextInputActive(void)
{
return SDL_EventEnabled(SDL_TEXTINPUT);
return SDL_EventEnabled(SDL_EVENT_TEXT_INPUT);
}
void SDL_StopTextInput(void)
@ -4312,8 +4312,8 @@ void SDL_StopTextInput(void)
}
/* Finally disable text events */
SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_FALSE);
SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
}
void SDL_SetTextInputRect(const SDL_Rect *rect)
@ -4600,12 +4600,12 @@ float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
*/
void SDL_OnApplicationWillTerminate(void)
{
SDL_SendAppEvent(SDL_APP_TERMINATING);
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
}
void SDL_OnApplicationDidReceiveMemoryWarning(void)
{
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY);
}
void SDL_OnApplicationWillResignActive(void)
@ -4613,32 +4613,32 @@ void SDL_OnApplicationWillResignActive(void)
if (_this) {
SDL_Window *window;
for (window = _this->windows; window != NULL; window = window->next) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
}
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
}
void SDL_OnApplicationDidEnterBackground(void)
{
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
}
void SDL_OnApplicationWillEnterForeground(void)
{
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
}
void SDL_OnApplicationDidBecomeActive(void)
{
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
if (_this) {
SDL_Window *window;
for (window = _this->windows; window != NULL; window = window->next) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
}
}

View File

@ -77,7 +77,7 @@ static void android_egl_context_restore(SDL_Window *window)
/* The context is no longer valid, create a new one */
data->egl_context = (EGLContext)SDL_GL_CreateContext(window);
SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context);
event.type = SDL_RENDER_DEVICE_RESET;
event.type = SDL_EVENT_RENDER_DEVICE_RESET;
event.common.timestamp = 0;
SDL_PushEvent(&event);
}
@ -130,9 +130,9 @@ void Android_PumpEvents_Blocking(_THIS)
videodata->isPaused = 0;
/* Android_ResumeSem was signaled */
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
ANDROIDAUDIO_ResumeDevices();
openslES_ResumeDevices();
@ -140,7 +140,7 @@ void Android_PumpEvents_Blocking(_THIS)
/* Restore the GL Context from here, as this operation is thread dependent */
#if SDL_VIDEO_OPENGL_EGL
if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
if (!isContextExternal && !SDL_HasEvent(SDL_EVENT_QUIT)) {
SDL_LockMutex(Android_ActivityMutex);
android_egl_context_restore(Android_Window);
SDL_UnlockMutex(Android_ActivityMutex);
@ -157,15 +157,15 @@ void Android_PumpEvents_Blocking(_THIS)
/* Android_PauseSem was signaled */
if (videodata->isPausing == 0) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
}
/* We've been signaled to pause (potentially several times), but before we block ourselves,
* we need to make sure that the very last event (of the first pause sequence, if several)
* has reached the app */
if (SDL_NumberOfEvents(SDL_APP_DIDENTERBACKGROUND) > SDL_SemValue(Android_PauseSem)) {
if (SDL_NumberOfEvents(SDL_EVENT_DID_ENTER_BACKGROUND) > SDL_SemValue(Android_PauseSem)) {
videodata->isPausing = 1;
} else {
videodata->isPausing = 0;
@ -212,9 +212,9 @@ void Android_PumpEvents_NonBlocking(_THIS)
videodata->isPaused = 0;
/* Android_ResumeSem was signaled */
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
if (videodata->pauseAudio) {
ANDROIDAUDIO_ResumeDevices();
@ -224,7 +224,7 @@ void Android_PumpEvents_NonBlocking(_THIS)
#if SDL_VIDEO_OPENGL_EGL
/* Restore the GL Context from here, as this operation is thread dependent */
if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
if (!isContextExternal && !SDL_HasEvent(SDL_EVENT_QUIT)) {
SDL_LockMutex(Android_ActivityMutex);
android_egl_context_restore(Android_Window);
SDL_UnlockMutex(Android_ActivityMutex);
@ -241,15 +241,15 @@ void Android_PumpEvents_NonBlocking(_THIS)
/* Android_PauseSem was signaled */
if (videodata->isPausing == 0) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
}
/* We've been signaled to pause (potentially several times), but before we block ourselves,
* we need to make sure that the very last event (of the first pause sequence, if several)
* has reached the app */
if (SDL_NumberOfEvents(SDL_APP_DIDENTERBACKGROUND) > SDL_SemValue(Android_PauseSem)) {
if (SDL_NumberOfEvents(SDL_EVENT_DID_ENTER_BACKGROUND) > SDL_SemValue(Android_PauseSem)) {
videodata->isPausing = 1;
} else {
videodata->isPausing = 0;

View File

@ -279,7 +279,7 @@ void Android_SendResize(SDL_Window *window)
}
if (window) {
/* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
/* Force the current mode to match the resize otherwise the SDL_EVENT_WINDOW_RESTORED event
* will fall back to the old mode */
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
display->display_modes[0].format = Android_ScreenFormat;
@ -288,7 +288,7 @@ void Android_SendResize(SDL_Window *window)
display->display_modes[0].refresh_rate = Android_ScreenRate;
display->current_mode = display->display_modes[0];
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, Android_SurfaceWidth, Android_SurfaceHeight);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, Android_SurfaceWidth, Android_SurfaceHeight);
}
}

View File

@ -147,7 +147,7 @@ void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *di
}
if (old_w != new_w || old_h != new_h) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, new_w, new_h);
}
}

View File

@ -405,7 +405,7 @@ void Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
}
#endif
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
/* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */
[data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
#if 0

View File

@ -41,7 +41,7 @@ static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
* events don't always happen in the same frame (for example when a
* resizable window exits a fullscreen Space via the user pressing the OS
* exit-space button). */
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
@autoreleasepool {
SDL_cocoametalview *view = (__bridge SDL_cocoametalview *)userdata;
if (view.sdlWindowID == event->window.windowID) {

View File

@ -534,9 +534,9 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
if (object == _data.nswindow && [keyPath isEqualToString:@"visible"]) {
int newVisibility = [[change objectForKey:@"new"] intValue];
if (newVisibility) {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
} else {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
}
}
}
@ -553,9 +553,9 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
observingVisible = YES;
if (wasVisible != isVisible) {
if (isVisible) {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
} else {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
}
wasVisible = isVisible;
@ -720,13 +720,13 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
- (BOOL)windowShouldClose:(id)sender
{
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
return NO;
}
- (void)windowDidExpose:(NSNotification *)aNotification
{
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
- (void)windowWillMove:(NSNotification *)aNotification
@ -771,7 +771,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
ScheduleContextUpdates(_data);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
}
- (void)windowDidResize:(NSNotification *)aNotification
@ -808,14 +808,14 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
/* The window can move during a resize event, such as when maximizing
or resizing from a corner */
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h);
zoomed = [nswindow isZoomed];
if (!zoomed) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
} else if (zoomed) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
}
}
@ -825,12 +825,12 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
focusClickPending = 0;
[self onMovingOrFocusClickPendingStateCleared];
}
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
{
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
- (void)windowDidBecomeKey:(NSNotification *)aNotification
@ -913,7 +913,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
- (void)windowDidChangeScreenProfile:(NSNotification *)aNotification
{
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
}
- (void)windowDidChangeScreen:(NSNotification *)aNotification
@ -1227,7 +1227,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
}
if ([self processHitTest:theEvent]) {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0);
return; /* dragging, drop event. */
}
@ -1276,7 +1276,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
}
if ([self processHitTest:theEvent]) {
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0);
return; /* stopped dragging, drop event. */
}
@ -1329,7 +1329,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
window = _data.window;
if ([self processHitTest:theEvent]) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0);
return; /* dragging, drop event. */
}
@ -1553,7 +1553,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
}
SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(_sdlWindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
- (BOOL)wantsUpdateLayer
@ -1569,7 +1569,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
only gets called for window creation and other extraordinary events. */
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
ScheduleContextUpdates((__bridge SDL_WindowData *)_sdlWindow->driverdata);
SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(_sdlWindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
- (void)rightMouseDown:(NSEvent *)theEvent

View File

@ -660,10 +660,10 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse
emscripten_request_pointerlock(window_data->canvas_id, 0); /* try to regrab lost pointer lock. */
}
sdl_button_state = SDL_PRESSED;
sdl_event_type = SDL_MOUSEBUTTONDOWN;
sdl_event_type = SDL_EVENT_MOUSE_BUTTONDOWN;
} else {
sdl_button_state = SDL_RELEASED;
sdl_event_type = SDL_MOUSEBUTTONUP;
sdl_event_type = SDL_EVENT_MOUSE_BUTTONUP;
}
SDL_SendMouseButton(0, window_data->window, 0, sdl_button_state, sdl_button);
@ -695,7 +695,7 @@ static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseE
}
SDL_SetMouseFocus(eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? window_data->window : NULL);
return SDL_EventEnabled(SDL_MOUSEMOTION);
return SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION);
}
static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
@ -717,7 +717,7 @@ static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent
}
SDL_SendMouseWheel(0, window_data->window, 0, (float)wheelEvent->deltaX, -deltaY, SDL_MOUSEWHEEL_NORMAL);
return SDL_EventEnabled(SDL_MOUSEWHEEL);
return SDL_EventEnabled(SDL_EVENT_MOUSE_WHEEL);
}
static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData)
@ -731,7 +731,7 @@ static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent
SDL_ResetKeyboard();
}
sdl_event_type = (eventType == EMSCRIPTEN_EVENT_FOCUS) ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST;
sdl_event_type = (eventType == EMSCRIPTEN_EVENT_FOCUS) ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST;
SDL_SendWindowEvent(window_data->window, sdl_event_type, 0, 0);
return SDL_EventEnabled(sdl_event_type);
}
@ -766,7 +766,7 @@ static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent
SDL_SendTouch(0, deviceId, id, window_data->window, SDL_TRUE, x, y, 1.0f);
/* disable browser scrolling/pinch-to-zoom if app handles touch events */
if (!preventDefault && SDL_EventEnabled(SDL_FINGERDOWN)) {
if (!preventDefault && SDL_EventEnabled(SDL_EVENT_FINGER_DOWN)) {
preventDefault = 1;
}
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
@ -816,7 +816,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
is_nav_key = SDL_TRUE;
}
if ((eventType == EMSCRIPTEN_EVENT_KEYDOWN) && SDL_EventEnabled(SDL_TEXTINPUT) && !is_nav_key) {
if ((eventType == EMSCRIPTEN_EVENT_KEYDOWN) && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT) && !is_nav_key) {
prevent_default = SDL_FALSE;
}
@ -829,7 +829,7 @@ static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboard
if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
SDL_SendKeyboardText(text);
}
return SDL_EventEnabled(SDL_TEXTINPUT);
return SDL_EventEnabled(SDL_EVENT_TEXT_INPUT);
}
static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
@ -891,7 +891,7 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
window_data->window->h = 0;
}
SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(window_data->window, SDL_EVENT_WINDOW_RESIZED, w, h);
}
}
@ -907,7 +907,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat
if (window_data->fullscreen_resize) {
double css_w, css_h;
emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h);
SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, css_w, css_h);
SDL_SendWindowEvent(window_data->window, SDL_EVENT_WINDOW_RESIZED, css_w, css_h);
}
return 0;
@ -916,7 +916,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat
static EM_BOOL Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData)
{
SDL_WindowData *window_data = userData;
SDL_SendWindowEvent(window_data->window, visEvent->hidden ? SDL_WINDOWEVENT_HIDDEN : SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(window_data->window, visEvent->hidden ? SDL_EVENT_WINDOW_HIDDEN : SDL_EVENT_WINDOW_SHOWN, 0, 0);
return 0;
}
@ -924,8 +924,8 @@ static const char *Emscripten_HandleBeforeUnload(int eventType, const void *rese
{
/* This event will need to be handled synchronously, e.g. using
SDL_AddEventWatch, as the page is being closed *now*. */
/* No need to send a SDL_QUIT, the app won't get control again. */
SDL_SendAppEvent(SDL_APP_TERMINATING);
/* No need to send a SDL_EVENT_QUIT, the app won't get control again. */
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
return ""; /* don't trigger confirmation dialog */
}

View File

@ -235,7 +235,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window)
scaled_w = css_w * wdata->pixel_ratio;
scaled_h = css_h * wdata->pixel_ratio;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, css_w, css_h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, css_w, css_h);
}
emscripten_set_canvas_element_size(wdata->canvas_id, scaled_w, scaled_h);

View File

@ -120,23 +120,23 @@ class SDL_BApp : public BApplication
break;
case BAPP_REPAINT:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_EXPOSED);
break;
case BAPP_MAXIMIZE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MAXIMIZED);
break;
case BAPP_MINIMIZE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MINIMIZED);
break;
case BAPP_SHOW:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_SHOWN);
break;
case BAPP_HIDE:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_HIDDEN);
break;
case BAPP_MOUSE_FOCUS:
@ -148,7 +148,7 @@ class SDL_BApp : public BApplication
break;
case BAPP_WINDOW_CLOSE_REQUESTED:
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_CLOSE_REQUESTED);
break;
case BAPP_WINDOW_MOVED:
@ -311,7 +311,7 @@ class SDL_BApp : public BApplication
HAIKU_SetKeyState(scancode, state);
SDL_SendKeyboardKey(0, state, HAIKU_GetScancodeFromBeKey(scancode));
if (state == SDL_PRESSED && SDL_EventEnabled(SDL_TEXTINPUT)) {
if (state == SDL_PRESSED && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
const int8 *keyUtf8;
ssize_t count;
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
@ -374,7 +374,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_MOVED, xPos, yPos);
}
void _HandleWindowResized(BMessage *msg)
@ -390,7 +390,7 @@ class SDL_BApp : public BApplication
return;
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_RESIZED, w, h);
}
bool _GetWinID(BMessage *msg, int32 *winID)

View File

@ -1147,7 +1147,7 @@ static void KMSDRM_DirtySurfaces(SDL_Window *window)
or SetWindowFullscreen, send a fake event for now since the actual
recreation is deferred */
KMSDRM_GetModeToSet(window, &mode);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, mode.hdisplay, mode.vdisplay);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, mode.hdisplay, mode.vdisplay);
}
/* This determines the size of the fb, which comes from the GBM surface
@ -1211,7 +1211,7 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Window *window)
egl_context = (EGLContext)SDL_GL_GetCurrentContext();
ret = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED,
dispdata->mode.hdisplay, dispdata->mode.vdisplay);
windata->egl_surface_dirty = SDL_FALSE;
@ -1543,7 +1543,7 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
SDL_SetKeyboardFocus(window);
/* Tell the app that the window has moved to top-left. */
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, 0, 0);
/* Allocated windata will be freed in KMSDRM_DestroyWindow,
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()

View File

@ -35,7 +35,7 @@ void N3DS_PumpEvents(_THIS)
if (!aptMainLoop()) {
SDL_Event ev;
ev.type = SDL_QUIT;
ev.type = SDL_EVENT_QUIT;
ev.common.timestamp = 0;
SDL_PushEvent(&ev);
return;

View File

@ -572,7 +572,7 @@ void SDL_OnApplicationDidChangeStatusBarOrientation()
default:
break;
}
SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation);
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_ORIENTATION, orientation);
}
}
#endif /* !TARGET_OS_TV */

View File

@ -201,7 +201,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
int w = (int)size.width;
int h = (int)size.height;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h);
}
#if !TARGET_OS_TV

View File

@ -379,7 +379,7 @@ int Wayland_WaitEventTimeout(_THIS, Sint64 timeoutNS)
WAYLAND_wl_display_flush(d->display);
#ifdef SDL_USE_IME
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_TEXTINPUT)) {
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_IME_PumpEvents();
}
#endif
@ -429,7 +429,7 @@ int Wayland_WaitEventTimeout(_THIS, Sint64 timeoutNS)
if (errno == EINTR) {
/* If the wait was interrupted by a signal, we may have generated a
* SDL_QUIT event. Let the caller know to call SDL_PumpEvents(). */
* SDL_EVENT_QUIT event. Let the caller know to call SDL_PumpEvents(). */
return 1;
} else {
return err;
@ -448,7 +448,7 @@ void Wayland_PumpEvents(_THIS)
int err;
#ifdef SDL_USE_IME
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_TEXTINPUT)) {
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_IME_PumpEvents();
}
#endif

View File

@ -650,7 +650,7 @@ static void display_handle_done(void *data,
SDL_free(driverdata->placeholder.name);
SDL_zero(driverdata->placeholder);
} else {
SDL_SendDisplayEvent(dpy, SDL_DISPLAYEVENT_ORIENTATION, driverdata->orientation);
SDL_SendDisplayEvent(dpy, SDL_EVENT_DISPLAY_ORIENTATION, driverdata->orientation);
}
}

View File

@ -620,7 +620,7 @@ static void handle_configure_xdg_toplevel(void *data,
* No, we do not get minimize events from xdg-shell.
*/
SDL_SendWindowEvent(window,
maximized ? SDL_WINDOWEVENT_MAXIMIZED : SDL_WINDOWEVENT_RESTORED,
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
0, 0);
/* Store current floating dimensions for restoring */
@ -670,7 +670,7 @@ static void handle_configure_xdg_toplevel(void *data,
static void handle_close_xdg_toplevel(void *data, struct xdg_toplevel *xdg_toplevel)
{
SDL_WindowData *window = (SDL_WindowData *)data;
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
static const struct xdg_toplevel_listener toplevel_listener_xdg = {
@ -691,7 +691,7 @@ static void handle_configure_xdg_popup(void *data,
static void handle_done_xdg_popup(void *data, struct xdg_popup *xdg_popup)
{
SDL_WindowData *window = (SDL_WindowData *)data;
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
static void handle_repositioned_xdg_popup(void *data,
@ -711,7 +711,7 @@ static const struct xdg_popup_listener popup_listener_xdg = {
static int Wayland_PopupWatch(void *data, SDL_Event *event)
{
if (event->type == SDL_MOUSEMOTION) {
if (event->type == SDL_EVENT_MOUSE_MOTION) {
SDL_Window *window = (SDL_Window *)data;
SDL_WindowData *wind = window->driverdata;
@ -849,13 +849,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
* No, we do not get minimize events from libdecor.
*/
SDL_SendWindowEvent(window,
maximized ? SDL_WINDOWEVENT_MAXIMIZED : SDL_WINDOWEVENT_RESTORED,
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
0, 0);
}
/* Similar to maximized/restore events above, send focus events too! */
SDL_SendWindowEvent(window,
focused ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST,
focused ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST,
0, 0);
/* For fullscreen or fixed-size windows we know our size.
@ -953,14 +953,14 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
static void decoration_frame_close(struct libdecor_frame *frame, void *user_data)
{
SDL_SendWindowEvent(((SDL_WindowData *)user_data)->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(((SDL_WindowData *)user_data)->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
static void decoration_frame_commit(struct libdecor_frame *frame, void *user_data)
{
SDL_WindowData *wind = user_data;
SDL_SendWindowEvent(wind->sdlwindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
static struct libdecor_frame_interface libdecor_frame_interface = {
@ -985,7 +985,7 @@ static void handle_set_generic_property(void *data,
static void handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
{
SDL_WindowData *window = (SDL_WindowData *)data;
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
static const struct qt_extended_surface_listener extended_surface_listener = {
@ -1059,7 +1059,7 @@ static void Wayland_move_window(SDL_Window *window,
*/
SDL_Rect bounds;
SDL_GetDisplayBounds(i, &bounds);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, bounds.x, bounds.y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, bounds.x, bounds.y);
break;
}
}
@ -2053,7 +2053,7 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height, floa
* so we must override the deduplication logic in the video core */
window->w = 0;
window->h = 0;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, width, height);
window->w = width;
window->h = height;
data->needs_resize_event = SDL_FALSE;

View File

@ -716,8 +716,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_WindowData *data;
LRESULT returnCode = -1;
/* Send a SDL_SYSWMEVENT if the application wants them */
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
/* Send a SDL_EVENT_SYSWM if the application wants them */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
@ -764,9 +764,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SHOWWINDOW:
{
if (wParam) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
} else {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
}
} break;
@ -1027,7 +1027,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
/* ALT+F4: Close window */
if (code == SDL_SCANCODE_F4 && ShouldGenerateWindowCloseOnAltF4()) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
}
@ -1264,9 +1264,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
y = rect.top;
WIN_ScreenPointToSDL(&x, &y);
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y);
// Moving the window from one display to another can change the size of the window (in the handling of SDL_WINDOWEVENT_MOVED), so we need to re-query the bounds
// Moving the window from one display to another can change the size of the window (in the handling of SDL_EVENT_WINDOW_MOVED), so we need to re-query the bounds
if (GetClientRect(hwnd, &rect)) {
ClientToScreen(hwnd, (LPPOINT)&rect);
ClientToScreen(hwnd, (LPPOINT)&rect + 1);
@ -1283,7 +1283,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
h = rect.bottom - rect.top;
WIN_ClientPointToSDL(data->window, &w, &h);
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, w, h);
#ifdef HIGHDPI_DEBUG
SDL_Log("WM_WINDOWPOSCHANGED: Windows client rect (pixels): (%d, %d) (%d x %d)\tSDL client rect (points): (%d, %d) (%d x %d) cached dpi %d, windows reported dpi %d",
@ -1305,17 +1305,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
switch (wParam) {
case SIZE_MAXIMIZED:
SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_EVENT_WINDOW_RESTORED, 0, 0);
SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
break;
case SIZE_MINIMIZED:
SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
break;
case SIZE_RESTORED:
SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_EVENT_WINDOW_RESTORED, 0, 0);
break;
default:
break;
@ -1342,7 +1342,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
RECT rect;
if (GetUpdateRect(hwnd, &rect, FALSE)) {
ValidateRect(hwnd, NULL);
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
}
returnCode = 0;
@ -1382,7 +1382,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_CLOSE:
{
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
returnCode = 0;
break;
@ -1523,7 +1523,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
switch (rc) {
#define POST_HIT_TEST(ret) \
{ \
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); \
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); \
return ret; \
}
case SDL_HITTEST_DRAGGABLE:
@ -1652,7 +1652,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Update the cached DPI value for this window */
data->scaling_dpi = newDPI;
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
/* Send a SDL_EVENT_WINDOW_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
Renderers need to get this to know that the framebuffer size changed.
We clear the window size to force the event to be delivered, but what we really
@ -1661,7 +1661,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
*/
data->window->w = 0;
data->window->h = 0;
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SIZE_CHANGED, data->window->w, data->window->h);
}
#ifdef HIGHDPI_DEBUG
@ -1725,9 +1725,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Update the cached DPI value for this window */
data->scaling_dpi = newDPI;
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
/* Send a SDL_EVENT_WINDOW_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
Renderers need to get this to know that the framebuffer size changed. */
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SIZE_CHANGED, data->window->w, data->window->h);
}
return 0;

View File

@ -352,10 +352,10 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info,
SDL_SetDesktopDisplayMode(&_this->displays[i], &mode);
if (WIN_GetDisplayBounds(_this, &_this->displays[i], &bounds) == 0) {
if (SDL_memcmp(&driverdata->bounds, &bounds, sizeof(bounds)) != 0 || moved) {
SDL_SendDisplayEvent(&_this->displays[i], SDL_DISPLAYEVENT_MOVED, 0);
SDL_SendDisplayEvent(&_this->displays[i], SDL_EVENT_DISPLAY_MOVED, 0);
}
}
SDL_SendDisplayEvent(&_this->displays[i], SDL_DISPLAYEVENT_ORIENTATION, orientation);
SDL_SendDisplayEvent(&_this->displays[i], SDL_EVENT_DISPLAY_ORIENTATION, orientation);
}
goto done;
}

View File

@ -1001,7 +1001,7 @@ void WIN_UpdateWindowICCProfile(SDL_Window *window, SDL_bool send_event)
}
data->ICMFileName = SDL_wcsdup(fileName);
if (send_event) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
}
}
}

View File

@ -389,7 +389,7 @@ void WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEve
src_ucs2[0] = args->KeyCode;
src_ucs2[1] = L'\0';
/* Convert the text, then send an SDL_TEXTINPUT event. */
/* Convert the text, then send an SDL_EVENT_TEXT_INPUT event. */
result = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)&src_ucs2, -1, (LPSTR)dest_utf8, sizeof(dest_utf8), NULL, NULL);
if (result > 0) {
SDL_SendKeyboardText(dest_utf8);

View File

@ -329,11 +329,11 @@ static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
if (X11_XGetEventData(videodata->display, cookie)) {
X11_HandleXinput2Event(videodata, cookie);
/* Send a SDL_SYSWMEVENT if the application wants them.
/* Send a SDL_EVENT_SYSWM if the application wants them.
* Since event data is only available until XFreeEventData is called,
* the *only* way for an application to access it is to register an event filter/watcher
* and do all the processing on the SDL_SYSWMEVENT inside the callback. */
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
* and do all the processing on the SDL_EVENT_SYSWM inside the callback. */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
@ -491,8 +491,8 @@ static void X11_DispatchFocusOut(_THIS, SDL_WindowData *data)
static void X11_DispatchMapNotify(SDL_WindowData *data)
{
SDL_Window *window = data->window;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
if (!(window->flags & SDL_WINDOW_HIDDEN) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
SDL_UpdateWindowGrab(window);
}
@ -500,8 +500,8 @@ static void X11_DispatchMapNotify(SDL_WindowData *data)
static void X11_DispatchUnmapNotify(SDL_WindowData *data)
{
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
static void InitiateWindowMove(_THIS, const SDL_WindowData *data, const SDL_Point *point)
@ -814,8 +814,8 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
}
#endif
/* Send a SDL_SYSWMEVENT if the application wants them */
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
/* Send a SDL_EVENT_SYSWM if the application wants them */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
@ -878,12 +878,12 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
X11_XGetWindowAttributes(display, data->xwindow, &attrib);
screennum = X11_XScreenNumberOfScreen(attrib.screen);
if (screennum == 0 && SDL_strcmp(name_of_atom, "_ICC_PROFILE") == 0) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
} else if (SDL_strncmp(name_of_atom, "_ICC_PROFILE_", sizeof("_ICC_PROFILE_") - 1) == 0 && SDL_strlen(name_of_atom) > sizeof("_ICC_PROFILE_") - 1) {
int iccscreennum = SDL_atoi(&name_of_atom[sizeof("_ICC_PROFILE_") - 1]);
if (screennum == iccscreennum) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
}
}
}
@ -1077,7 +1077,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
#endif
#ifdef SDL_USE_IME
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED));
}
#endif
@ -1167,10 +1167,10 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
if (xevent->xconfigure.x != data->last_xconfigure.x ||
xevent->xconfigure.y != data->last_xconfigure.y) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED,
xevent->xconfigure.x, xevent->xconfigure.y);
#ifdef SDL_USE_IME
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
/* Update IME candidate list position */
SDL_IME_UpdateTextRect(NULL);
}
@ -1178,7 +1178,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
}
if (xevent->xconfigure.width != data->last_xconfigure.width ||
xevent->xconfigure.height != data->last_xconfigure.height) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED,
xevent->xconfigure.width,
xevent->xconfigure.height);
}
@ -1279,7 +1279,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
#ifdef DEBUG_XEVENTS
printf("window %p: WM_DELETE_WINDOW\n", data);
#endif
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
break;
} else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
(xevent->xclient.format == 32) &&
@ -1288,7 +1288,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
#ifdef DEBUG_XEVENTS
printf("window %p: WM_TAKE_FOCUS\n", data);
#endif
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_TAKE_FOCUS, 0, 0);
break;
}
} break;
@ -1299,7 +1299,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
#ifdef DEBUG_XEVENTS
printf("window %p: Expose (count = %d)\n", data, xevent->xexpose.count);
#endif
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
} break;
case MotionNotify:
@ -1327,7 +1327,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
int button = xevent->xbutton.button;
if (button == Button1) {
if (ProcessHitTest(_this, data, xevent)) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0);
break; /* don't pass this event on to app. */
}
} else if (button > 7) {
@ -1474,9 +1474,9 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
if (changed & SDL_WINDOW_MAXIMIZED) {
if (flags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
}
} else if (xevent->xproperty.atom == videodata->XKLAVIER_STATE) {
@ -1656,7 +1656,7 @@ int X11_WaitEventTimeout(_THIS, Sint64 timeoutNS)
if (errno == EINTR) {
/* If the wait was interrupted by a signal, we may have generated a
* SDL_QUIT event. Let the caller know to call SDL_PumpEvents(). */
* SDL_EVENT_QUIT event. Let the caller know to call SDL_PumpEvents(). */
return 1;
} else {
return err;
@ -1667,7 +1667,7 @@ int X11_WaitEventTimeout(_THIS, Sint64 timeoutNS)
X11_DispatchEvent(_this, &xevent);
#ifdef SDL_USE_IME
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_IME_PumpEvents();
}
#endif
@ -1708,7 +1708,7 @@ void X11_PumpEvents(_THIS)
}
#ifdef SDL_USE_IME
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
SDL_IME_PumpEvents();
}
#endif

View File

@ -1389,12 +1389,12 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis
if (!caught_x11_error) {
SDL_bool window_changed = SDL_FALSE;
if ((x != orig_x) || (y != orig_y)) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y);
window_changed = SDL_TRUE;
}
if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, attrs.width, attrs.height);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
window_changed = SDL_TRUE;
}

View File

@ -173,10 +173,10 @@ void loop()
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_KEYUP:
case SDL_EVENT_KEY_DOWN:
case SDL_EVENT_KEY_UP:
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
if (event.type == SDL_KEYDOWN) {
if (event.type == SDL_EVENT_KEY_DOWN) {
switch (event.key.keysym.sym) {
case SDLK_BACKSPACE:
SDLTest_TextWindowAddText(textwin, "\b");
@ -189,18 +189,18 @@ void loop()
}
}
break;
case SDL_TEXTEDITING:
case SDL_EVENT_TEXT_EDITING:
PrintText("EDIT", event.edit.text);
break;
case SDL_TEXTEDITING_EXT:
case SDL_EVENT_TEXTEDITING_EXT:
PrintText("EDIT_EXT", event.editExt.text);
SDL_free(event.editExt.text);
break;
case SDL_TEXTINPUT:
case SDL_EVENT_TEXT_INPUT:
PrintText("INPUT", event.text.text);
SDLTest_TextWindowAddText(textwin, "%s", event.text.text);
break;
case SDL_FINGERDOWN:
case SDL_EVENT_FINGER_DOWN:
if (SDL_TextInputActive()) {
SDL_Log("Stopping text input\n");
SDL_StopTextInput();
@ -209,7 +209,7 @@ void loop()
SDL_StartTextInput();
}
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
/* Left button quits the app, other buttons toggles text input */
if (event.button.button == SDL_BUTTON_LEFT) {
done = 1;
@ -223,7 +223,7 @@ void loop()
}
}
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = 1;
break;
default:

View File

@ -174,17 +174,17 @@ void loop()
while (!done && SDL_WaitEvent(&event)) {
SDL_Log("Got event type: %" SDL_PRIu32 "\n", event.type);
switch (event.type) {
case SDL_KEYDOWN:
case SDL_KEYUP:
case SDL_EVENT_KEY_DOWN:
case SDL_EVENT_KEY_UP:
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
break;
case SDL_TEXTEDITING:
case SDL_EVENT_TEXT_EDITING:
PrintText("EDIT", event.text.text);
break;
case SDL_TEXTINPUT:
case SDL_EVENT_TEXT_INPUT:
PrintText("INPUT", event.text.text);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
/* Left button quits the app, other buttons toggles text input */
(void)fprintf(stderr, "mouse button down button: %d (LEFT=%d)\n", event.button.button, SDL_BUTTON_LEFT);
(void)fflush(stderr);
@ -200,7 +200,7 @@ void loop()
}
}
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = 1;
break;
default:
@ -227,7 +227,7 @@ static int SDLCALL ping_thread(void *ptr)
for (cnt = 0; cnt < 10; ++cnt) {
(void)fprintf(stderr, "sending event (%d/%d) from thread.\n", cnt + 1, 10);
(void)fflush(stderr);
sdlevent.type = SDL_KEYDOWN;
sdlevent.type = SDL_EVENT_KEY_DOWN;
sdlevent.key.keysym.sym = SDLK_1;
SDL_PushEvent(&sdlevent);
SDL_Delay(1000 + rand() % 1000);

View File

@ -438,12 +438,12 @@ WatchJoystick(SDL_Joystick *joystick)
while (SDL_PollEvent(&event) > 0) {
switch (event.type) {
case SDL_JOYDEVICEREMOVED:
case SDL_EVENT_JOYSTICK_REMOVED:
if (event.jaxis.which == nJoystickID) {
done = SDL_TRUE;
}
break;
case SDL_JOYAXISMOTION:
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
if (event.jaxis.which == nJoystickID) {
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */
AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis];
@ -484,7 +484,7 @@ WatchJoystick(SDL_Joystick *joystick)
}
}
break;
case SDL_JOYHATMOTION:
case SDL_EVENT_JOYSTICK_HAT_MOTION:
if (event.jhat.which == nJoystickID) {
if (event.jhat.value != SDL_HAT_CENTERED) {
SDL_GameControllerExtendedBind binding;
@ -501,7 +501,7 @@ WatchJoystick(SDL_Joystick *joystick)
}
}
break;
case SDL_JOYBUTTONUP:
case SDL_EVENT_JOYSTICK_BUTTON_UP:
if (event.jbutton.which == nJoystickID) {
SDL_GameControllerExtendedBind binding;
@ -515,12 +515,12 @@ WatchJoystick(SDL_Joystick *joystick)
ConfigureBinding(&binding);
}
break;
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_FINGER_DOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
/* Skip this step */
SetCurrentBinding(s_iCurrentBinding + 1);
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) {
SetCurrentBinding(s_iCurrentBinding - 1);
break;
@ -534,7 +534,7 @@ WatchJoystick(SDL_Joystick *joystick)
break;
}
SDL_FALLTHROUGH;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
default:
@ -763,12 +763,12 @@ int main(int argc, char *argv[])
while (SDL_PollEvent(&event) > 0) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
break;
}
SDL_FALLTHROUGH;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
default:

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
open_audio();
SDL_FlushEvents(SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED);
SDL_FlushEvents(SDL_EVENT_AUDIO_DEVICE_ADDED, SDL_EVENT_AUDIO_DEVICE_REMOVED);
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(loop, 0, 1);
@ -157,11 +157,11 @@ int main(int argc, char *argv[])
SDL_Event event;
while (SDL_PollEvent(&event) > 0) {
if (event.type == SDL_QUIT) {
if (event.type == SDL_EVENT_QUIT) {
done = 1;
}
if ((event.type == SDL_AUDIODEVICEADDED && !event.adevice.iscapture) ||
(event.type == SDL_AUDIODEVICEREMOVED && !event.adevice.iscapture && event.adevice.which == device)) {
if ((event.type == SDL_EVENT_AUDIO_DEVICE_ADDED && !event.adevice.iscapture) ||
(event.type == SDL_EVENT_AUDIO_DEVICE_REMOVED && !event.adevice.iscapture && event.adevice.which == device)) {
reopen_audio();
}
}

View File

@ -25,7 +25,7 @@ Code
{
switch (event.type)
{
case SDL_QUIT:
case SDL_EVENT_QUIT:
return 1;
default:
break;

View File

@ -495,7 +495,7 @@ static int SDLCALL FIFO_Writer(void *_data)
int i;
SDL_Event event;
event.type = SDL_USEREVENT;
event.type = SDL_EVENT_USER;
event.user.windowID = 0;
event.user.code = 0;
event.user.data1 = data;

View File

@ -32,18 +32,18 @@ loop()
SDL_Event e;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
if (e.type == SDL_EVENT_QUIT) {
please_quit = SDL_TRUE;
} else if (e.type == SDL_KEYDOWN) {
} else if (e.type == SDL_EVENT_KEY_DOWN) {
if (e.key.keysym.sym == SDLK_ESCAPE) {
please_quit = SDL_TRUE;
}
} else if (e.type == SDL_MOUSEBUTTONDOWN) {
} else if (e.type == SDL_EVENT_MOUSE_BUTTONDOWN) {
if (e.button.button == 1) {
SDL_PauseAudioDevice(devid_out);
SDL_PlayAudioDevice(devid_in);
}
} else if (e.type == SDL_MOUSEBUTTONUP) {
} else if (e.type == SDL_EVENT_MOUSE_BUTTONUP) {
if (e.button.button == 1) {
SDL_PauseAudioDevice(devid_in);
SDL_PlayAudioDevice(devid_out);

View File

@ -84,13 +84,13 @@ iteration()
SDL_Event e;
SDL_AudioDeviceID dev;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
if (e.type == SDL_EVENT_QUIT) {
done = 1;
} else if (e.type == SDL_KEYUP) {
} else if (e.type == SDL_EVENT_KEY_UP) {
if (e.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
}
} else if (e.type == SDL_AUDIODEVICEADDED) {
} else if (e.type == SDL_EVENT_AUDIO_DEVICE_ADDED) {
int index = e.adevice.which;
int iscapture = e.adevice.iscapture;
const char *name = SDL_GetAudioDeviceName(index, iscapture);
@ -113,7 +113,7 @@ iteration()
SDL_PlayAudioDevice(dev);
}
}
} else if (e.type == SDL_AUDIODEVICEREMOVED) {
} else if (e.type == SDL_EVENT_AUDIO_DEVICE_REMOVED) {
dev = (SDL_AudioDeviceID)e.adevice.which;
SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int)dev);
SDL_CloseAudioDevice(dev);

View File

@ -49,7 +49,7 @@ int events_pushPumpAndPollUserevent(void *arg)
int result;
/* Create user event */
event1.type = SDL_USEREVENT;
event1.type = SDL_EVENT_USER;
event1.user.code = SDLTest_RandomSint32();
event1.user.data1 = (void *)&g_userdataValue1;
event1.user.data2 = (void *)&g_userdataValue2;
@ -80,7 +80,7 @@ int events_addDelEventWatch(void *arg)
SDL_Event event;
/* Create user event */
event.type = SDL_USEREVENT;
event.type = SDL_EVENT_USER;
event.user.code = SDLTest_RandomSint32();
event.user.data1 = (void *)&g_userdataValue1;
event.user.data2 = (void *)&g_userdataValue2;
@ -129,7 +129,7 @@ int events_addDelEventWatchWithUserdata(void *arg)
SDL_Event event;
/* Create user event */
event.type = SDL_USEREVENT;
event.type = SDL_EVENT_USER;
event.user.code = SDLTest_RandomSint32();
event.user.data1 = (void *)&g_userdataValue1;
event.user.data2 = (void *)&g_userdataValue2;

View File

@ -154,7 +154,7 @@ void loop()
/* Check for events */
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_MOUSEBUTTONDOWN) {
if (event.type == SDL_EVENT_MOUSE_BUTTONDOWN) {
if (event.button.button == SDL_BUTTON_LEFT) {
if (num_cursors == 0) {
continue;

View File

@ -63,7 +63,7 @@ void loop()
while (SDL_PollEvent(&e)) {
/* Re-create when window has been resized */
if (e.type == SDL_WINDOWEVENT_SIZE_CHANGED) {
if (e.type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
SDL_DestroyRenderer(renderer);
@ -74,7 +74,7 @@ void loop()
SDL_RenderClear(renderer);
}
if (e.type == SDL_QUIT) {
if (e.type == SDL_EVENT_QUIT) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
@ -82,7 +82,7 @@ void loop()
return;
}
if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
if ((e.type == SDL_EVENT_KEY_DOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();

View File

@ -67,19 +67,19 @@ int main(int argc, char *argv[])
SDL_RenderPresent(renderer);
}
SDL_SetEventEnabled(SDL_DROPFILE, SDL_TRUE);
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_TRUE);
/* Main render loop */
done = 0;
while (!done) {
/* Check for events */
while (SDL_PollEvent(&event)) {
if (event.type == SDL_DROPBEGIN) {
if (event.type == SDL_EVENT_DROP_BEGIN) {
SDL_Log("Drop beginning on window %u", (unsigned int)event.drop.windowID);
} else if (event.type == SDL_DROPCOMPLETE) {
} else if (event.type == SDL_EVENT_DROP_COMPLETE) {
SDL_Log("Drop complete on window %u", (unsigned int)event.drop.windowID);
} else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) {
const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text";
} else if ((event.type == SDL_EVENT_DROP_FILE) || (event.type == SDL_EVENT_DROP_TEXT)) {
const char *typestr = (event.type == SDL_EVENT_DROP_FILE) ? "File" : "Text";
char *dropped_filedir = event.drop.file;
SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int)event.drop.windowID, dropped_filedir);
/* Normally you'd have to do this, but this is freed in SDLTest_CommonEvent() */

View File

@ -560,26 +560,26 @@ void loop(void *arg)
SDL_PumpEvents();
/* Process all currently pending events */
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) == 1) {
switch (event.type) {
case SDL_GAMEPADADDED:
case SDL_EVENT_GAMEPAD_ADDED:
SDL_Log("Gamepad device %" SDL_PRIu32 " added.\n", event.cdevice.which);
AddGamepad(event.cdevice.which, SDL_TRUE);
break;
case SDL_GAMEPADREMOVED:
case SDL_EVENT_GAMEPAD_REMOVED:
SDL_Log("Gamepad device %" SDL_PRIu32 " removed.\n", event.cdevice.which);
DelGamepad(event.cdevice.which);
break;
case SDL_GAMEPADTOUCHPADDOWN:
case SDL_GAMEPADTOUCHPADMOTION:
case SDL_GAMEPADTOUCHPADUP:
case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
case SDL_EVENT_GAMEPAD_TOUCHPAD_UP:
SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
event.ctouchpad.which,
event.ctouchpad.touchpad,
event.ctouchpad.finger,
(event.type == SDL_GAMEPADTOUCHPADDOWN ? "pressed at" : (event.type == SDL_GAMEPADTOUCHPADUP ? "released at" : "moved to")),
(event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN ? "pressed at" : (event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_UP ? "released at" : "moved to")),
event.ctouchpad.x,
event.ctouchpad.y,
event.ctouchpad.pressure);
@ -587,7 +587,7 @@ void loop(void *arg)
#define VERBOSE_SENSORS
#ifdef VERBOSE_SENSORS
case SDL_GAMEPADSENSORUPDATE:
case SDL_EVENT_GAMEPAD_SENSOR_UPDATE:
SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
event.csensor.which,
GetSensorName((SDL_SensorType)event.csensor.sensor),
@ -600,7 +600,7 @@ void loop(void *arg)
#define VERBOSE_AXES
#ifdef VERBOSE_AXES
case SDL_GAMEPADAXISMOTION:
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
SetGamepad(event.caxis.which);
}
@ -608,44 +608,44 @@ void loop(void *arg)
break;
#endif /* VERBOSE_AXES */
case SDL_GAMEPADBUTTONDOWN:
case SDL_GAMEPADBUTTONUP:
if (event.type == SDL_GAMEPADBUTTONDOWN) {
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
case SDL_EVENT_GAMEPAD_BUTTON_UP:
if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN) {
SetGamepad(event.cbutton.which);
}
SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", event.cbutton.which, SDL_GetGamepadStringForButton((SDL_GamepadButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
/* Cycle PS5 trigger effects when the microphone button is pressed */
if (event.type == SDL_GAMEPADBUTTONDOWN &&
if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN &&
event.cbutton.button == SDL_GAMEPAD_BUTTON_MISC1 &&
SDL_GetGamepadType(gamepad) == SDL_GAMEPAD_TYPE_PS5) {
CyclePS5TriggerEffect();
}
break;
case SDL_JOYBATTERYUPDATED:
case SDL_EVENT_JOYSTICK_BATTERY_UPDATED:
SDL_Log("Gamepad %" SDL_PRIu32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
if (virtual_joystick) {
VirtualGamepadMouseDown(event.button.x, event.button.y);
}
break;
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTONUP:
if (virtual_joystick) {
VirtualGamepadMouseUp(event.button.x, event.button.y);
}
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
if (virtual_joystick) {
VirtualGamepadMouseMotion(event.motion.x, event.motion.y);
}
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) {
if (gamepad) {
int player_index = (event.key.keysym.sym - SDLK_0);
@ -666,7 +666,7 @@ void loop(void *arg)
break;
}
SDL_FALLTHROUGH;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
default:

View File

@ -70,7 +70,7 @@ void loop()
/* Check for events */
while (SDL_PollEvent(&event)) {
if (event.type == SDL_MOUSEMOTION) {
if (event.type == SDL_EVENT_MOUSE_MOTION) {
if (event.motion.state) {
float xrel, yrel;
int window_w, window_h;

View File

@ -387,7 +387,7 @@ int main(int argc, char *argv[])
++frames;
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_KEYDOWN) {
if (event.type == SDL_EVENT_KEY_DOWN) {
if (event.key.keysym.sym == SDLK_o) {
swap_interval--;
update_swap_interval = SDL_TRUE;

View File

@ -283,7 +283,7 @@ int main(int argc, char *argv[])
/* Check for events */
++frames;
while (SDL_PollEvent(&event)) {
if (event.type == SDL_WINDOWEVENT_RESIZED) {
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
for (i = 0; i < state->num_windows; ++i) {
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);

View File

@ -567,7 +567,7 @@ loop_threaded()
/* Wait for events */
while (SDL_WaitEvent(&event) && !done) {
if (event.type == SDL_WINDOWEVENT_CLOSE) {
if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
if (window) {
for (i = 0; i < state->num_windows; ++i) {

View File

@ -331,7 +331,7 @@ void loop()
++frames;
while (SDL_PollEvent(&event) && !done) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
{
const int sym = event.key.keysym.sym;
@ -355,7 +355,7 @@ void loop()
break;
}
case SDL_WINDOWEVENT_RESIZED:
case SDL_EVENT_WINDOW_RESIZED:
for (i = 0; i < state->num_windows; ++i) {
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
int w, h;

View File

@ -104,19 +104,19 @@ int main(int argc, char **argv)
nothing_to_do = 0;
switch (e.type) {
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
SDL_Log("button down!\n");
break;
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTONUP:
SDL_Log("button up!\n");
break;
case SDL_WINDOWEVENT_MOVED:
case SDL_EVENT_WINDOW_MOVED:
SDL_Log("Window event moved to (%d, %d)!\n", (int)e.window.data1, (int)e.window.data2);
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if (e.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
} else if (e.key.keysym.sym == SDLK_x) {
@ -130,7 +130,7 @@ int main(int argc, char **argv)
}
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = 1;
break;
}

View File

@ -63,10 +63,10 @@ int main(int argc, char *argv[])
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
case SDL_EVENT_QUIT:
keepGoing = SDL_FALSE;
break;
case SDL_JOYDEVICEADDED:
case SDL_EVENT_JOYSTICK_ADDED:
if (joystick != NULL) {
SDL_Log("Only one joystick supported by this test\n");
} else {
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
}
}
break;
case SDL_JOYDEVICEREMOVED:
case SDL_EVENT_JOYSTICK_REMOVED:
if (instance == event.jdevice.which) {
SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
instance = 0;
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
SDL_Log("Unknown joystick diconnected\n");
}
break;
case SDL_JOYAXISMOTION:
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
/*
// SDL_Log("Axis Move: %d\n", event.jaxis.axis);
*/
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
SDL_HapticRumblePlay(haptic, 0.25, 250);
}
break;
case SDL_JOYBUTTONDOWN:
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
SDL_Log("Button Press: %d\n", event.jbutton.button);
if (enable_haptic && haptic) {
SDL_HapticRumblePlay(haptic, 0.25, 250);
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
keepGoing = SDL_FALSE;
}
break;
case SDL_JOYBUTTONUP:
case SDL_EVENT_JOYSTICK_BUTTON_UP:
SDL_Log("Button Release: %d\n", event.jbutton.button);
break;
}

View File

@ -716,7 +716,7 @@ int main(int argc, char *argv[])
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
switch (event.type) {
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
switch (event.key.keysym.sym) {
case SDLK_RETURN:
text[0] = 0x00;
@ -764,7 +764,7 @@ int main(int argc, char *argv[])
SDL_GetKeyName(event.key.keysym.sym));
break;
case SDL_TEXTINPUT:
case SDL_EVENT_TEXT_INPUT:
if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || markedRect.w < 0) {
break;
}
@ -783,7 +783,7 @@ int main(int argc, char *argv[])
Redraw();
break;
case SDL_TEXTEDITING:
case SDL_EVENT_TEXT_EDITING:
SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n",
event.edit.text, event.edit.start, event.edit.length);

View File

@ -217,11 +217,11 @@ void loop()
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
switch (event.type) {
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
mouse_begin_x = event.button.x;
mouse_begin_y = event.button.y;
break;
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTONUP:
if (event.button.button == 3) {
add_line(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
}
@ -229,7 +229,7 @@ void loop()
add_rect(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
}
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
switch (event.key.keysym.sym) {
case 'l':
if (event.key.keysym.mod & SDL_KMOD_SHIFT) {

View File

@ -111,7 +111,7 @@ void loop(void *arg)
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_JOYDEVICEADDED:
case SDL_EVENT_JOYSTICK_ADDED:
SDL_Log("Joystick device %" SDL_PRIu32 " added.\n", event.jdevice.which);
if (joystick == NULL) {
joystick = SDL_OpenJoystick(event.jdevice.which);
@ -123,7 +123,7 @@ void loop(void *arg)
}
break;
case SDL_JOYDEVICEREMOVED:
case SDL_EVENT_JOYSTICK_REMOVED:
SDL_Log("Joystick device %" SDL_PRIu32 " removed.\n", event.jdevice.which);
if (event.jdevice.which == SDL_GetJoystickInstanceID(joystick)) {
SDL_JoystickID *joysticks;
@ -146,12 +146,12 @@ void loop(void *arg)
}
break;
case SDL_JOYAXISMOTION:
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
SDL_Log("Joystick %" SDL_PRIu32 " axis %d value: %d\n",
event.jaxis.which,
event.jaxis.axis, event.jaxis.value);
break;
case SDL_JOYHATMOTION:
case SDL_EVENT_JOYSTICK_HAT_MOTION:
SDL_Log("Joystick %" SDL_PRIu32 " hat %d value:",
event.jhat.which, event.jhat.hat);
if (event.jhat.value == SDL_HAT_CENTERED) {
@ -171,7 +171,7 @@ void loop(void *arg)
}
SDL_Log("\n");
break;
case SDL_JOYBUTTONDOWN:
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
SDL_Log("Joystick %" SDL_PRIu32 " button %d down\n",
event.jbutton.which, event.jbutton.button);
/* First button triggers a 0.5 second full strength rumble */
@ -179,11 +179,11 @@ void loop(void *arg)
SDL_RumbleJoystick(joystick, 0xFFFF, 0xFFFF, 500);
}
break;
case SDL_JOYBUTTONUP:
case SDL_EVENT_JOYSTICK_BUTTON_UP:
SDL_Log("Joystick %" SDL_PRIu32 " button %d up\n",
event.jbutton.which, event.jbutton.button);
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
/* Press the L key to lag for 3 seconds, to see what happens
when SDL doesn't service the event loop quickly. */
if (event.key.keysym.sym == SDLK_l) {
@ -197,9 +197,9 @@ void loop(void *arg)
break;
}
SDL_FALLTHROUGH;
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
case SDL_QUIT:
case SDL_EVENT_FINGER_DOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
default:

View File

@ -47,10 +47,10 @@ int main(int argc, char **argv)
while (keep_going) {
SDL_Event e;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
if (e.type == SDL_EVENT_QUIT) {
keep_going = SDL_FALSE;
} else if (e.type == SDL_LOCALECHANGED) {
SDL_Log("Saw SDL_LOCALECHANGED event!");
} else if (e.type == SDL_EVENT_LOCALE_CHANGED) {
SDL_Log("Saw SDL_EVENT_LOCALE_CHANGED event!");
log_locales();
}
}

View File

@ -201,7 +201,7 @@ int main(int argc, char *argv[])
}
while (SDL_WaitEvent(&event)) {
if (event.type == SDL_QUIT || event.type == SDL_KEYUP) {
if (event.type == SDL_EVENT_QUIT || event.type == SDL_EVENT_KEY_UP) {
break;
}
}

View File

@ -110,7 +110,7 @@ void loop(void *arg)
/* Check for events */
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_MOUSEWHEEL:
case SDL_EVENT_MOUSE_WHEEL:
if (event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) {
event.wheel.x *= -1;
event.wheel.y *= -1;
@ -127,7 +127,7 @@ void loop(void *arg)
}
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
if (active == NULL) {
break;
}
@ -136,7 +136,7 @@ void loop(void *arg)
active->y2 = event.motion.y;
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
if (active == NULL) {
active = SDL_calloc(1, sizeof(*active));
active->x1 = active->x2 = event.button.x;
@ -170,7 +170,7 @@ void loop(void *arg)
}
break;
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTONUP:
if (active == NULL) {
break;
}
@ -199,8 +199,8 @@ void loop(void *arg)
}
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
case SDL_EVENT_KEY_DOWN:
case SDL_EVENT_KEY_UP:
switch (event.key.keysym.sym) {
case SDLK_LSHIFT:
isRect = (event.key.state == SDL_PRESSED);
@ -211,7 +211,7 @@ void loop(void *arg)
}
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;

View File

@ -180,11 +180,11 @@ int main(int argc, char *argv[])
/* Check for events */
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_WINDOWEVENT_EXPOSED:
case SDL_EVENT_WINDOW_EXPOSED:
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = 1;
break;
default:

View File

@ -75,7 +75,7 @@ void loop()
/* Check for events */
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
}

View File

@ -229,24 +229,24 @@ void loop()
SDLTest_CommonEvent(state, &event, &done);
switch (event.type) {
case SDL_WINDOWEVENT_RESIZED:
case SDL_EVENT_WINDOW_RESIZED:
SDL_SetRenderViewport(renderer, NULL);
window_w = event.window.data1;
window_h = event.window.data2;
displayrect.w = (float)window_w;
displayrect.h = (float)window_h;
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_EVENT_MOUSE_BUTTONDOWN:
displayrect.x = event.button.x - window_w / 2;
displayrect.y = event.button.y - window_h / 2;
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
if (event.motion.state) {
displayrect.x = event.motion.x - window_w / 2;
displayrect.y = event.motion.y - window_h / 2;
}
break;
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if (event.key.keysym.sym == SDLK_SPACE) {
paused = !paused;
break;
@ -494,7 +494,7 @@ int main(int argc, char **argv)
displayrect.h = (float)window_h;
/* Ignore key up events, they don't even get filtered */
SDL_SetEventEnabled(SDL_KEYUP, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_KEY_UP, SDL_FALSE);
/* Main render loop */
frames = 0;

View File

@ -44,7 +44,7 @@ loop()
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
switch (event.type) {
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION:
{
mouseX += event.motion.xrel;
mouseY += event.motion.yrel;

View File

@ -101,14 +101,14 @@ int main(int argc, char **argv)
SDL_PumpEvents();
/* Process all currently pending events */
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) == 1) {
switch (event.type) {
case SDL_SENSORUPDATE:
case SDL_EVENT_SENSOR_UPDATE:
HandleSensorEvent(&event.sensor);
break;
case SDL_MOUSEBUTTONUP:
case SDL_KEYUP:
case SDL_QUIT:
case SDL_EVENT_MOUSE_BUTTONUP:
case SDL_EVENT_KEY_UP:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
default:

View File

@ -493,10 +493,10 @@ int main(int argc, char **argv)
{
SDL_Event event;
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
if (event.type == SDL_EVENT_QUIT) {
done = 1;
}
if (event.type == SDL_KEYDOWN) {
if (event.type == SDL_EVENT_KEY_DOWN) {
if (event.key.keysym.sym == SDLK_SPACE) {
current_shader = (current_shader + 1) % NUM_SHADERS;
}

View File

@ -168,14 +168,14 @@ int main(int argc, char **argv)
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
while (should_exit == 0) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_KEYDOWN) {
if (event.type == SDL_EVENT_KEY_DOWN) {
button_down = 1;
if (event.key.keysym.sym == SDLK_ESCAPE) {
should_exit = 1;
break;
}
}
if (button_down && event.type == SDL_KEYUP) {
if (button_down && event.type == SDL_EVENT_KEY_UP) {
button_down = 0;
current_picture += 1;
if (current_picture >= num_pictures) {
@ -186,7 +186,7 @@ int main(int argc, char **argv)
SDL_SetWindowSize(window, texture_dimensions.w, texture_dimensions.h);
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
}
if (event.type == SDL_QUIT) {
if (event.type == SDL_EVENT_QUIT) {
should_exit = 1;
break;
}

View File

@ -83,7 +83,7 @@ void loop()
/* Check for events */
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT || event.type == SDL_KEYDOWN) {
if (event.type == SDL_EVENT_QUIT || event.type == SDL_EVENT_KEY_DOWN) {
done = 1;
}
}

View File

@ -100,12 +100,12 @@ void loop()
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_EVENT_KEY_DOWN:
if (event.key.keysym.sym == SDLK_ESCAPE) {
done = SDL_TRUE;
}
break;
case SDL_QUIT:
case SDL_EVENT_QUIT:
done = SDL_TRUE;
break;
}

View File

@ -1125,7 +1125,7 @@ int main(int argc, char **argv)
/* Need to destroy the swapchain before the window created
* by SDL.
*/
if (event.type == SDL_WINDOWEVENT_CLOSE) {
if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE);
}
SDLTest_CommonEvent(state, &event, &done);

View File

@ -151,7 +151,7 @@ void loop()
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_WINDOWEVENT_RESIZED) {
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
if (window) {
SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n",
@ -160,7 +160,7 @@ void loop()
event.window.data2);
}
}
if (event.type == SDL_WINDOWEVENT_MOVED) {
if (event.type == SDL_EVENT_WINDOW_MOVED) {
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
if (window) {
SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n",
@ -170,18 +170,18 @@ void loop()
SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
}
}
if (event.type == SDL_WINDOWEVENT_FOCUS_LOST) {
if (event.type == SDL_EVENT_WINDOW_FOCUS_LOST) {
relative_mode = SDL_GetRelativeMouseMode();
if (relative_mode) {
SDL_SetRelativeMouseMode(SDL_FALSE);
}
}
if (event.type == SDL_WINDOWEVENT_FOCUS_GAINED) {
if (event.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
if (relative_mode) {
SDL_SetRelativeMouseMode(SDL_TRUE);
}
}
if (event.type == SDL_KEYUP) {
if (event.type == SDL_EVENT_KEY_UP) {
SDL_bool updateCursor = SDL_FALSE;
if (event.key.keysym.sym == SDLK_LEFT) {
@ -204,7 +204,7 @@ void loop()
SDL_SetCursor(cursor);
}
}
if (event.type == SDL_MOUSEBUTTONUP) {
if (event.type == SDL_EVENT_MOUSE_BUTTONUP) {
SDL_Window *window = SDL_GetMouseFocus();
if (highlighted_mode != -1 && window != NULL) {
const int display_index = SDL_GetWindowDisplayIndex(window);
@ -271,8 +271,8 @@ int main(int argc, char *argv[])
return 1;
}
SDL_SetEventEnabled(SDL_DROPFILE, SDL_TRUE);
SDL_SetEventEnabled(SDL_DROPTEXT, SDL_TRUE);
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_TRUE);
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_TRUE);
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];

Some files were not shown because too many files have changed in this diff Show More