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
+316
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
+6 -6
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
+7 -7
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.
*/
+5 -5
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);
}
+83 -16
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:
+1 -1
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
+6 -6
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:
+1 -1
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;
}
}
+107 -107
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.
*
+16 -16
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"
+3 -3
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.
+1 -1
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.
*
+140 -10
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
+6 -6
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_ */
+1 -1
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().
+7 -7
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;
+11 -11
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) {
+2 -2
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)) {
+9 -9
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)
+23 -23
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)
+2 -2
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);
}
+1 -1
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;
}
+5 -5
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);
}
+110 -110
View File
File diff suppressed because it is too large Load Diff
+12 -12
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;
+9 -9
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;
}
+1 -1
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);
}
+6 -6
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;
+24 -24
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 */
}
}
}
+24 -24
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)
+23 -23
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;
+16 -16
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;
+2 -2
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);
}
+2 -2
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);
}
}
+2 -2
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);
}
}
+2 -2
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;
}
+1 -1
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();
}
+1 -1
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;
}
+2 -2
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));
+69 -69
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;
}
+27 -27
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);
}
}
}
+17 -17
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;
+2 -2
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);
}
}
+1 -1
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);
}
}
+1 -1
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
+1 -1
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) {
+19 -19
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
+13 -13
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 */
}
+1 -1
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);
+9 -9
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)

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