parent
74697bc351
commit
7b50bae524
|
@ -2005,3 +2005,319 @@ expression e;
|
||||||
@@
|
@@
|
||||||
- e | 0
|
- e | 0
|
||||||
+ e
|
+ 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
|
||||||
|
|
|
@ -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),
|
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
|
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.
|
manually or quit the app.
|
||||||
|
|
||||||
You should not use the SDL renderer API while the app going in background:
|
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
|
after you read this message, GL context gets backed-up and you should not
|
||||||
use the SDL renderer API.
|
use the SDL renderer API.
|
||||||
|
|
||||||
When this event is received, you have to set the render target to NULL, if you're using it.
|
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))
|
(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
|
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
|
Mouse / Touch events
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -456,12 +456,12 @@ Two legitimate ways:
|
||||||
Activity by calling Activity.finish().
|
Activity by calling Activity.finish().
|
||||||
|
|
||||||
- Android OS can decide to terminate your application by calling onDestroy()
|
- 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.
|
can handle to save things and quit.
|
||||||
|
|
||||||
Don't call exit() as it stops the activity badly.
|
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.
|
SDLK_AC_BACK, for any purpose.
|
||||||
|
|
||||||
Known issues
|
Known issues
|
||||||
|
|
|
@ -73,34 +73,34 @@ e.g.
|
||||||
{
|
{
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case SDL_APP_TERMINATING:
|
case SDL_EVENT_TERMINATING:
|
||||||
/* Terminate the app.
|
/* Terminate the app.
|
||||||
Shut everything down before returning from this function.
|
Shut everything down before returning from this function.
|
||||||
*/
|
*/
|
||||||
return 0;
|
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.
|
/* You will get this when your app is paused and iOS wants more memory.
|
||||||
Release as much memory as possible.
|
Release as much memory as possible.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERBACKGROUND:
|
case SDL_EVENT_WILL_ENTER_BACKGROUND:
|
||||||
/* Prepare your app to go into the background. Stop loops, etc.
|
/* 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.
|
This gets called when the user hits the home button, or gets a call.
|
||||||
*/
|
*/
|
||||||
return 0;
|
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.
|
/* 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.
|
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.
|
Your app is NOT active at this point.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERFOREGROUND:
|
case SDL_EVENT_WILL_ENTER_FOREGROUND:
|
||||||
/* This call happens when your app is coming back to the foreground.
|
/* This call happens when your app is coming back to the foreground.
|
||||||
Restore all your state here.
|
Restore all your state here.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_DIDENTERFOREGROUND:
|
case SDL_EVENT_DID_ENTER_FOREGROUND:
|
||||||
/* Restart your loops here.
|
/* Restart your loops here.
|
||||||
Your app is interactive and getting CPU again.
|
Your app is interactive and getting CPU again.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,7 +44,7 @@ use the traditional autoconf/automake/make method, or use Xcode.
|
||||||
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
|
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
|
||||||
SDL will not register its own. This means that SDL will not terminate using
|
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
|
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
|
file with the app. To solve these issues, put the following code in your
|
||||||
NSApplicationDelegate implementation:
|
NSApplicationDelegate implementation:
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ NSApplicationDelegate implementation:
|
||||||
```objc
|
```objc
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_EVENT_QUIT) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_QUIT;
|
event.type = SDL_EVENT_QUIT;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ NSApplicationDelegate implementation:
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
- (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;
|
SDL_Event event;
|
||||||
event.type = SDL_DROPFILE;
|
event.type = SDL_EVENT_DROP_FILE;
|
||||||
event.drop.file = SDL_strdup([filename UTF8String]);
|
event.drop.file = SDL_strdup([filename UTF8String]);
|
||||||
return (SDL_PushEvent(&event) > 0);
|
return (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
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.
|
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:
|
The following symbols have been renamed:
|
||||||
* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
|
* SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND
|
||||||
* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
|
* SDL_APP_DIDENTERFOREGROUND => SDL_EVENT_DID_ENTER_FOREGROUND
|
||||||
* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
|
* SDL_APP_LOWMEMORY => SDL_EVENT_LOW_MEMORY
|
||||||
* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
|
* SDL_APP_TERMINATING => SDL_EVENT_TERMINATING
|
||||||
* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADREMAPPED
|
* SDL_APP_WILLENTERBACKGROUND => SDL_EVENT_WILL_ENTER_BACKGROUND
|
||||||
* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
|
* SDL_APP_WILLENTERFOREGROUND => SDL_EVENT_WILL_ENTER_FOREGROUND
|
||||||
* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
|
* SDL_AUDIODEVICEADDED => SDL_EVENT_AUDIO_DEVICE_ADDED
|
||||||
* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
|
* SDL_AUDIODEVICEREMOVED => SDL_EVENT_AUDIO_DEVICE_REMOVED
|
||||||
* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
|
* SDL_CLIPBOARDUPDATE => SDL_EVENT_CLIPBOARD_UPDATE
|
||||||
* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
|
* 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:
|
The following structures have been renamed:
|
||||||
* SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
|
* 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.
|
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.
|
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:
|
The following enums have been renamed:
|
||||||
* SDL_GameControllerAxis => SDL_GamepadAxis
|
* 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.
|
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_MasksToPixelFormatEnum() => SDL_GetPixelFormatEnumForMasks()
|
||||||
* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormatEnum()
|
* 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
|
## SDL_platform.h
|
||||||
|
|
||||||
The preprocessor symbol `__MACOSX__` has been renamed `__MACOS__`, and `__IPHONEOS__` has been renamed `__IOS__`
|
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:
|
The following functions have been renamed:
|
||||||
|
|
|
@ -127,7 +127,7 @@ Text Input API support
|
||||||
|
|
||||||
The Text Input API is supported, with translation of scan codes done via the
|
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.
|
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:
|
your app has read access to one of the following:
|
||||||
|
|
||||||
* /proc/self/fd/0
|
* /proc/self/fd/0
|
||||||
|
|
|
@ -17,7 +17,7 @@ Unfortunately there is no windows support as of yet. Support for Windows 7 is pl
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Events
|
Events
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL_FINGERDOWN:
|
SDL_EVENT_FINGER_DOWN:
|
||||||
Sent when a finger (or stylus) is placed on a touch device.
|
Sent when a finger (or stylus) is placed on a touch device.
|
||||||
Fields:
|
Fields:
|
||||||
* event.tfinger.touchId - the Id of the touch device.
|
* 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.y - the y coordinate of the touch (0..1)
|
||||||
* event.tfinger.pressure - the pressure 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.
|
Sent when a finger (or stylus) is moved on the touch device.
|
||||||
Fields:
|
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.dx - change in x coordinate during this motion event.
|
||||||
* event.tfinger.dy - change in y 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.
|
Sent when a finger (or stylus) is lifted from the touch device.
|
||||||
Fields:
|
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.
|
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.
|
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.
|
As a result, be very careful to check for NULL return values.
|
||||||
|
|
||||||
A SDL_Finger has the following fields:
|
A SDL_Finger has the following fields:
|
||||||
|
|
|
@ -349,7 +349,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
while (keep_going) {
|
while (keep_going) {
|
||||||
while (SDL_PollEvent(&evt)) {
|
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;
|
keep_going = SDL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,153 +54,153 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
|
SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
|
||||||
|
|
||||||
/* Application events */
|
/* 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 */
|
/* 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 iOS in applicationWillTerminate()
|
||||||
Called on Android in onDestroy()
|
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 iOS in applicationDidReceiveMemoryWarning()
|
||||||
Called on Android in onLowMemory()
|
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 iOS in applicationWillResignActive()
|
||||||
Called on Android in onPause()
|
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 iOS in applicationDidEnterBackground()
|
||||||
Called on Android in onPause()
|
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 iOS in applicationWillEnterForeground()
|
||||||
Called on Android in onResume()
|
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 iOS in applicationDidBecomeActive()
|
||||||
Called on Android in onResume()
|
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 */
|
/* Display events */
|
||||||
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
|
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
|
||||||
SDL_DISPLAYEVENT_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
|
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
|
||||||
SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */
|
SDL_EVENT_DISPLAY_CONNECTED, /**< Display has been added to the system */
|
||||||
SDL_DISPLAYEVENT_DISCONNECTED, /**< Display has been removed from the system */
|
SDL_EVENT_DISPLAY_DISCONNECTED, /**< Display has been removed from the system */
|
||||||
SDL_DISPLAYEVENT_MOVED, /**< Display has changed position */
|
SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
|
||||||
SDL_DISPLAYEVENT_FIRST = SDL_DISPLAYEVENT_ORIENTATION,
|
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
|
||||||
SDL_DISPLAYEVENT_LAST = SDL_DISPLAYEVENT_DISCONNECTED,
|
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_DISCONNECTED,
|
||||||
|
|
||||||
/* Window events */
|
/* Window events */
|
||||||
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
|
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
|
||||||
SDL_SYSWMEVENT = 0x201, /**< System specific event */
|
SDL_EVENT_SYSWM = 0x201, /**< System specific event */
|
||||||
SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
|
SDL_EVENT_WINDOW_SHOWN, /**< Window has been shown */
|
||||||
SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
|
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
|
||||||
SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
|
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be
|
||||||
redrawn */
|
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_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
|
||||||
SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
|
SDL_EVENT_WINDOW_SIZE_CHANGED, /**< The window size has changed, either as
|
||||||
a result of an API call or through the
|
a result of an API call or through the
|
||||||
system or user changing the window size. */
|
system or user changing the window size. */
|
||||||
SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
|
SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
|
||||||
SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
|
SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
|
||||||
SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
|
SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size
|
||||||
and position */
|
and position */
|
||||||
SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
|
SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
|
||||||
SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
|
SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
|
||||||
SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
|
SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
|
||||||
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
|
SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
|
||||||
SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
|
SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< 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_EVENT_WINDOW_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_EVENT_WINDOW_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_EVENT_WINDOW_ICCPROF_CHANGED,/**< The ICC profile of the window's display has changed. */
|
||||||
SDL_WINDOWEVENT_DISPLAY_CHANGED,/**< Window has been moved to display data1. */
|
SDL_EVENT_WINDOW_DISPLAY_CHANGED,/**< Window has been moved to display data1. */
|
||||||
SDL_WINDOWEVENT_FIRST = SDL_WINDOWEVENT_SHOWN,
|
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
|
||||||
SDL_WINDOWEVENT_LAST = SDL_WINDOWEVENT_DISPLAY_CHANGED,
|
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_DISPLAY_CHANGED,
|
||||||
|
|
||||||
/* Keyboard events */
|
/* Keyboard events */
|
||||||
SDL_KEYDOWN = 0x300, /**< Key pressed */
|
SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
|
||||||
SDL_KEYUP, /**< Key released */
|
SDL_EVENT_KEY_UP, /**< Key released */
|
||||||
SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
|
SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
|
||||||
SDL_TEXTINPUT, /**< Keyboard text input */
|
SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
|
||||||
SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
|
SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
|
||||||
input language or keyboard layout change.
|
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 */
|
/* Mouse events */
|
||||||
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
|
SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
|
||||||
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
|
SDL_EVENT_MOUSE_BUTTONDOWN, /**< Mouse button pressed */
|
||||||
SDL_MOUSEBUTTONUP, /**< Mouse button released */
|
SDL_EVENT_MOUSE_BUTTONUP, /**< Mouse button released */
|
||||||
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
|
SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
|
||||||
|
|
||||||
/* Joystick events */
|
/* Joystick events */
|
||||||
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
|
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
|
||||||
SDL_JOYHATMOTION = 0x602, /**< Joystick hat position change */
|
SDL_EVENT_JOYSTICK_HAT_MOTION = 0x602, /**< Joystick hat position change */
|
||||||
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
|
SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
|
||||||
SDL_JOYBUTTONUP, /**< Joystick button released */
|
SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
|
||||||
SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
|
SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
|
||||||
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
|
SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
|
||||||
SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */
|
SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
|
||||||
|
|
||||||
/* Gamepad events */
|
/* Gamepad events */
|
||||||
SDL_GAMEPADAXISMOTION = 0x650, /**< Gamepad axis motion */
|
SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
|
||||||
SDL_GAMEPADBUTTONDOWN, /**< Gamepad button pressed */
|
SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
|
||||||
SDL_GAMEPADBUTTONUP, /**< Gamepad button released */
|
SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
|
||||||
SDL_GAMEPADADDED, /**< A new gamepad has been inserted into the system */
|
SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
|
||||||
SDL_GAMEPADREMOVED, /**< An opened gamepad has been removed */
|
SDL_EVENT_GAMEPAD_REMOVED, /**< An opened gamepad has been removed */
|
||||||
SDL_GAMEPADREMAPPED, /**< The gamepad mapping was updated */
|
SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
|
||||||
SDL_GAMEPADTOUCHPADDOWN, /**< Gamepad touchpad was touched */
|
SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
|
||||||
SDL_GAMEPADTOUCHPADMOTION, /**< Gamepad touchpad finger was moved */
|
SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
|
||||||
SDL_GAMEPADTOUCHPADUP, /**< Gamepad touchpad finger was lifted */
|
SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
|
||||||
SDL_GAMEPADSENSORUPDATE, /**< Gamepad sensor was updated */
|
SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
|
||||||
|
|
||||||
/* Touch events */
|
/* Touch events */
|
||||||
SDL_FINGERDOWN = 0x700,
|
SDL_EVENT_FINGER_DOWN = 0x700,
|
||||||
SDL_FINGERUP,
|
SDL_EVENT_FINGER_UP,
|
||||||
SDL_FINGERMOTION,
|
SDL_EVENT_FINGER_MOTION,
|
||||||
|
|
||||||
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
|
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
|
||||||
|
|
||||||
/* Clipboard events */
|
/* 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 */
|
/* Drag and drop events */
|
||||||
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
|
SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
|
||||||
SDL_DROPTEXT, /**< text/plain drag-and-drop event */
|
SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
|
||||||
SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
|
SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
|
||||||
SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
|
SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
|
||||||
|
|
||||||
/* Audio hotplug events */
|
/* Audio hotplug events */
|
||||||
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
|
SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
|
||||||
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
|
SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
|
||||||
|
|
||||||
/* Sensor events */
|
/* Sensor events */
|
||||||
SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
|
SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
|
||||||
|
|
||||||
/* Render events */
|
/* Render events */
|
||||||
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
|
SDL_EVENT_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_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
|
||||||
|
|
||||||
/* Internal events */
|
/* 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()
|
* and should be allocated with SDL_RegisterEvents()
|
||||||
*/
|
*/
|
||||||
SDL_USEREVENT = 0x8000,
|
SDL_EVENT_USER = 0x8000,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This last event is only for bounding internal arrays
|
* This last event is only for bounding internal arrays
|
||||||
*/
|
*/
|
||||||
SDL_LASTEVENT = 0xFFFF
|
SDL_EVENT_LAST = 0xFFFF
|
||||||
} SDL_EventType;
|
} SDL_EventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,7 +240,7 @@ typedef struct SDL_WindowEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_KeyboardEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID;/**< The window with keyboard focus, if any */
|
SDL_WindowID windowID;/**< The window with keyboard focus, if any */
|
||||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||||
|
@ -256,7 +256,7 @@ typedef struct SDL_KeyboardEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_TextEditingEvent
|
typedef struct SDL_TextEditingEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_TEXTEDITING */
|
Uint32 type; /**< ::SDL_EVENT_TEXT_EDITING */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
||||||
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
|
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
|
||||||
|
@ -270,7 +270,7 @@ typedef struct SDL_TextEditingEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_TextEditingExtEvent
|
typedef struct SDL_TextEditingExtEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
|
Uint32 type; /**< ::SDL_EVENT_TEXTEDITING_EXT */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
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 */
|
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
|
typedef struct SDL_TextInputEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_TEXTINPUT */
|
Uint32 type; /**< ::SDL_EVENT_TEXT_INPUT */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
||||||
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
|
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
|
||||||
|
@ -295,7 +295,7 @@ typedef struct SDL_TextInputEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_MouseMotionEvent
|
typedef struct SDL_MouseMotionEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_MOUSEMOTION */
|
Uint32 type; /**< ::SDL_EVENT_MOUSE_MOTION */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
||||||
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||||
|
@ -311,7 +311,7 @@ typedef struct SDL_MouseMotionEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_MouseButtonEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
||||||
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||||
|
@ -328,7 +328,7 @@ typedef struct SDL_MouseButtonEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_MouseWheelEvent
|
typedef struct SDL_MouseWheelEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_MOUSEWHEEL */
|
Uint32 type; /**< ::SDL_EVENT_MOUSE_WHEEL */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
SDL_WindowID windowID;/**< The window with mouse focus, if any */
|
||||||
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||||
|
@ -344,7 +344,7 @@ typedef struct SDL_MouseWheelEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_JoyAxisEvent
|
typedef struct SDL_JoyAxisEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_JOYAXISMOTION */
|
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_AXIS_MOTION */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Uint8 axis; /**< The joystick axis index */
|
Uint8 axis; /**< The joystick axis index */
|
||||||
|
@ -360,7 +360,7 @@ typedef struct SDL_JoyAxisEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_JoyHatEvent
|
typedef struct SDL_JoyHatEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_JOYHATMOTION */
|
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_HAT_MOTION */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Uint8 hat; /**< The joystick hat index */
|
Uint8 hat; /**< The joystick hat index */
|
||||||
|
@ -380,7 +380,7 @@ typedef struct SDL_JoyHatEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_JoyButtonEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Uint8 button; /**< The joystick button index */
|
Uint8 button; /**< The joystick button index */
|
||||||
|
@ -394,7 +394,7 @@ typedef struct SDL_JoyButtonEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_JoyDeviceEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
} SDL_JoyDeviceEvent;
|
} SDL_JoyDeviceEvent;
|
||||||
|
@ -404,7 +404,7 @@ typedef struct SDL_JoyDeviceEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_JoyBatteryEvent
|
typedef struct SDL_JoyBatteryEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
|
Uint32 type; /**< ::SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
SDL_JoystickPowerLevel level; /**< The joystick battery level */
|
SDL_JoystickPowerLevel level; /**< The joystick battery level */
|
||||||
|
@ -415,7 +415,7 @@ typedef struct SDL_JoyBatteryEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_GamepadAxisEvent
|
typedef struct SDL_GamepadAxisEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_GAMEPADAXISMOTION */
|
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_AXIS_MOTION */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
|
Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
|
||||||
|
@ -432,7 +432,7 @@ typedef struct SDL_GamepadAxisEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_GamepadButtonEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
|
Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
|
||||||
|
@ -447,7 +447,7 @@ typedef struct SDL_GamepadButtonEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_GamepadDeviceEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
} SDL_GamepadDeviceEvent;
|
} SDL_GamepadDeviceEvent;
|
||||||
|
@ -457,7 +457,7 @@ typedef struct SDL_GamepadDeviceEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_GamepadTouchpadEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Sint32 touchpad; /**< The index of the touchpad */
|
Sint32 touchpad; /**< The index of the touchpad */
|
||||||
|
@ -472,7 +472,7 @@ typedef struct SDL_GamepadTouchpadEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_GamepadSensorEvent
|
typedef struct SDL_GamepadSensorEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_GAMEPADSENSORUPDATE */
|
Uint32 type; /**< ::SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_JoystickID which; /**< The joystick instance id */
|
SDL_JoystickID which; /**< The joystick instance id */
|
||||||
Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
|
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
|
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() */
|
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 */
|
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. */
|
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
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_TouchID touchId; /**< The touch device id */
|
SDL_TouchID touchId; /**< The touch device id */
|
||||||
SDL_FingerID fingerId;
|
SDL_FingerID fingerId;
|
||||||
|
@ -520,7 +520,7 @@ typedef struct SDL_TouchFingerEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_DropEvent
|
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() */
|
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 */
|
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 */
|
SDL_WindowID windowID;/**< The window that was dropped on, if any */
|
||||||
|
@ -532,7 +532,7 @@ typedef struct SDL_DropEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_SensorEvent
|
typedef struct SDL_SensorEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_SENSORUPDATE */
|
Uint32 type; /**< ::SDL_EVENT_SENSOR_UPDATE */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_SensorID which; /**< The instance ID of the sensor */
|
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() */
|
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
|
typedef struct SDL_QuitEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_QUIT */
|
Uint32 type; /**< ::SDL_EVENT_QUIT */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
} SDL_QuitEvent;
|
} SDL_QuitEvent;
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ typedef struct SDL_QuitEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_OSEvent
|
typedef struct SDL_OSEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_QUIT */
|
Uint32 type; /**< ::SDL_EVENT_QUIT */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
} SDL_OSEvent;
|
} SDL_OSEvent;
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ typedef struct SDL_OSEvent
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_UserEvent
|
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() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_WindowID windowID;/**< The associated window if any */
|
SDL_WindowID windowID;/**< The associated window if any */
|
||||||
Sint32 code; /**< User defined event code */
|
Sint32 code; /**< User defined event code */
|
||||||
|
@ -582,7 +582,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_SysWMEvent
|
typedef struct SDL_SysWMEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_SYSWMEVENT */
|
Uint32 type; /**< ::SDL_EVENT_SYSWM */
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
|
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
|
||||||
} SDL_SysWMEvent;
|
} SDL_SysWMEvent;
|
||||||
|
@ -701,9 +701,9 @@ typedef enum
|
||||||
* SDL_GETEVENT, the maximum number of events to retrieve
|
* SDL_GETEVENT, the maximum number of events to retrieve
|
||||||
* \param action action to take; see [[#action|Remarks]] for details
|
* \param action action to take; see [[#action|Remarks]] for details
|
||||||
* \param minType minimum value of the event type to be considered;
|
* \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;
|
* \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
|
* \returns the number of events actually stored or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
|
|
@ -132,7 +132,7 @@ extern "C" {
|
||||||
* \brief A variable to control whether we trap the Android back button to handle it manually.
|
* \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
|
* 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,
|
* 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.
|
* SDL_SCANCODE_AC_BACK.
|
||||||
*
|
*
|
||||||
* The variable can be set to the following values:
|
* 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"
|
#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:
|
* 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
|
* responsibility to render the text from these events and
|
||||||
* differentiate it somehow from committed text. (default)
|
* 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.
|
* and text that is being composed will be rendered in its own UI.
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
|
#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:
|
* The variable can be set to the following values:
|
||||||
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
|
* "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.
|
* "1" - SDL will not install a signal handler at all.
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
|
#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
|
* 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
|
* 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).
|
* your own event, if you want).
|
||||||
*
|
*
|
||||||
* The format of this hint is a comma-separated list of language and locale,
|
* The format of this hint is a comma-separated list of language and locale,
|
||||||
|
@ -2138,8 +2138,8 @@ extern "C" {
|
||||||
* the app).
|
* the app).
|
||||||
*
|
*
|
||||||
* SDL registers its own back-button-press callback with the Windows Phone
|
* 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
|
* OS. This callback will emit a pair of SDL key-press events (SDL_EVENT_KEY_DOWN
|
||||||
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
|
* 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.
|
* 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
|
* 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
|
* 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
|
* 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
|
* register a callback function with SDL_AddEventWatch(), and have it listen
|
||||||
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
|
* for SDL_EVENT_KEY_DOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
|
||||||
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
|
* (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
|
* 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
|
* set by such a callback, will be applied to the OS' current
|
||||||
* back-button-press event.
|
* back-button-press event.
|
||||||
|
@ -2290,26 +2290,26 @@ extern "C" {
|
||||||
#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE"
|
#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
|
* By default, SDL sends an SDL_EVENT_QUIT event when there is only one window
|
||||||
* and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most
|
* 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
|
* apps would also take the loss of this window as a signal to terminate the
|
||||||
* program.
|
* program.
|
||||||
*
|
*
|
||||||
* However, it's not unreasonable in some cases to have the program continue
|
* However, it's not unreasonable in some cases to have the program continue
|
||||||
* to live on, perhaps to create new windows later.
|
* 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,
|
* 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)
|
* event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c)
|
||||||
* on Unix, etc.
|
* on Unix, etc.
|
||||||
*
|
*
|
||||||
* The default value is "1". This hint can be changed at any time.
|
* 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
|
* 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"
|
#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE"
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* \brief The SDL keysym structure, used in key events.
|
* \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
|
typedef struct SDL_Keysym
|
||||||
{
|
{
|
||||||
|
@ -247,8 +247,8 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
||||||
* Start accepting Unicode text input events.
|
* Start accepting Unicode text input events.
|
||||||
*
|
*
|
||||||
* This function will start accepting Unicode text input events in the focused
|
* This function will start accepting Unicode text input events in the focused
|
||||||
* SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and
|
* SDL window, and start emitting SDL_TextInputEvent (SDL_EVENT_TEXT_INPUT) and
|
||||||
* SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in
|
* SDL_TextEditingEvent (SDL_EVENT_TEXT_EDITING) events. Please use this function in
|
||||||
* pair with SDL_StopTextInput().
|
* pair with SDL_StopTextInput().
|
||||||
*
|
*
|
||||||
* On some platforms using this function activates the screen keyboard.
|
* On some platforms using this function activates the screen keyboard.
|
||||||
|
|
|
@ -79,7 +79,7 @@ typedef struct SDL_Locale
|
||||||
* This might be a "slow" call that has to query the operating system. It's
|
* 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
|
* 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
|
* 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
|
* possible, and you can call this function again to get an updated copy of
|
||||||
* preferred locales.
|
* preferred locales.
|
||||||
*
|
*
|
||||||
|
|
|
@ -50,21 +50,86 @@
|
||||||
#define SDL_NewAudioStream SDL_CreateAudioStream
|
#define SDL_NewAudioStream SDL_CreateAudioStream
|
||||||
|
|
||||||
/* ##SDL_events.h */
|
/* ##SDL_events.h */
|
||||||
#define SDL_CONTROLLERAXISMOTION SDL_GAMEPADAXISMOTION
|
#define SDL_APP_DIDENTERBACKGROUND SDL_EVENT_DID_ENTER_BACKGROUND
|
||||||
#define SDL_CONTROLLERBUTTONDOWN SDL_GAMEPADBUTTONDOWN
|
#define SDL_APP_DIDENTERFOREGROUND SDL_EVENT_DID_ENTER_FOREGROUND
|
||||||
#define SDL_CONTROLLERBUTTONUP SDL_GAMEPADBUTTONUP
|
#define SDL_APP_LOWMEMORY SDL_EVENT_LOW_MEMORY
|
||||||
#define SDL_CONTROLLERDEVICEADDED SDL_GAMEPADADDED
|
#define SDL_APP_TERMINATING SDL_EVENT_TERMINATING
|
||||||
#define SDL_CONTROLLERDEVICEREMAPPED SDL_GAMEPADREMAPPED
|
#define SDL_APP_WILLENTERBACKGROUND SDL_EVENT_WILL_ENTER_BACKGROUND
|
||||||
#define SDL_CONTROLLERDEVICEREMOVED SDL_GAMEPADREMOVED
|
#define SDL_APP_WILLENTERFOREGROUND SDL_EVENT_WILL_ENTER_FOREGROUND
|
||||||
#define SDL_CONTROLLERSENSORUPDATE SDL_GAMEPADSENSORUPDATE
|
#define SDL_AUDIODEVICEADDED SDL_EVENT_AUDIO_DEVICE_ADDED
|
||||||
#define SDL_CONTROLLERTOUCHPADDOWN SDL_GAMEPADTOUCHPADDOWN
|
#define SDL_AUDIODEVICEREMOVED SDL_EVENT_AUDIO_DEVICE_REMOVED
|
||||||
#define SDL_CONTROLLERTOUCHPADMOTION SDL_GAMEPADTOUCHPADMOTION
|
#define SDL_CLIPBOARDUPDATE SDL_EVENT_CLIPBOARD_UPDATE
|
||||||
#define SDL_CONTROLLERTOUCHPADUP SDL_GAMEPADTOUCHPADUP
|
#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_ControllerAxisEvent SDL_GamepadAxisEvent
|
||||||
#define SDL_ControllerButtonEvent SDL_GamepadButtonEvent
|
#define SDL_ControllerButtonEvent SDL_GamepadButtonEvent
|
||||||
#define SDL_ControllerDeviceEvent SDL_GamepadDeviceEvent
|
#define SDL_ControllerDeviceEvent SDL_GamepadDeviceEvent
|
||||||
#define SDL_ControllerSensorEvent SDL_GamepadSensorEvent
|
#define SDL_ControllerSensorEvent SDL_GamepadSensorEvent
|
||||||
#define SDL_ControllerTouchpadEvent SDL_GamepadTouchpadEvent
|
#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 */
|
/* ##SDL_gamepad.h */
|
||||||
#define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
|
#define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
|
||||||
|
@ -363,6 +428,15 @@
|
||||||
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
|
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
|
||||||
|
|
||||||
/* ##SDL_events.h */
|
/* ##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_CONTROLLERAXISMOTION SDL_CONTROLLERAXISMOTION_renamed_SDL_GAMEPADAXISMOTION
|
||||||
#define SDL_CONTROLLERBUTTONDOWN SDL_CONTROLLERBUTTONDOWN_renamed_SDL_GAMEPADBUTTONDOWN
|
#define SDL_CONTROLLERBUTTONDOWN SDL_CONTROLLERBUTTONDOWN_renamed_SDL_GAMEPADBUTTONDOWN
|
||||||
#define SDL_CONTROLLERBUTTONUP SDL_CONTROLLERBUTTONUP_renamed_SDL_GAMEPADBUTTONUP
|
#define SDL_CONTROLLERBUTTONUP SDL_CONTROLLERBUTTONUP_renamed_SDL_GAMEPADBUTTONUP
|
||||||
|
@ -378,6 +452,62 @@
|
||||||
#define SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent_renamed_SDL_GamepadDeviceEvent
|
#define SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent_renamed_SDL_GamepadDeviceEvent
|
||||||
#define SDL_ControllerSensorEvent SDL_ControllerSensorEvent_renamed_SDL_GamepadSensorEvent
|
#define SDL_ControllerSensorEvent SDL_ControllerSensorEvent_renamed_SDL_GamepadSensorEvent
|
||||||
#define SDL_ControllerTouchpadEvent SDL_ControllerTouchpadEvent_renamed_SDL_GamepadTouchpadEvent
|
#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 */
|
/* ##SDL_gamepad.h */
|
||||||
#define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID
|
#define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID
|
||||||
|
|
|
@ -34,16 +34,16 @@
|
||||||
/**
|
/**
|
||||||
* \file SDL_quit.h
|
* \file SDL_quit.h
|
||||||
*
|
*
|
||||||
* An ::SDL_QUIT event is generated when the user tries to close the application
|
* ::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.
|
* 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
|
* 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.
|
* complete, but have no effect.
|
||||||
*
|
*
|
||||||
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
||||||
* and SIGTERM (system termination request), if handlers do not already
|
* and SIGTERM (system termination request), if handlers do not already
|
||||||
* exist, that generate ::SDL_QUIT events as well. There is no way
|
* exist, that generate ::SDL_EVENT_QUIT as well. There is no way
|
||||||
* to determine the cause of an ::SDL_QUIT event, but setting a signal
|
* to determine the cause of an ::SDL_EVENT_QUIT, but setting a signal
|
||||||
* handler in your application will override the default generation of
|
* handler in your application will override the default generation of
|
||||||
* quit events for that signal.
|
* quit events for that signal.
|
||||||
*
|
*
|
||||||
|
@ -53,6 +53,6 @@
|
||||||
/* There are no functions directly affecting the quit event */
|
/* There are no functions directly affecting the quit event */
|
||||||
|
|
||||||
#define SDL_QuitRequested() \
|
#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_ */
|
#endif /* SDL_quit_h_ */
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
/**
|
/**
|
||||||
* \brief SDL_syswm.h
|
* \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
|
* which contains window-manager specific information and arrives whenever
|
||||||
* an unhandled window event occurs. This event is ignored by default, but
|
* an unhandled window event occurs. This event is ignored by default, but
|
||||||
* you can enable it with SDL_SetEventEnabled().
|
* you can enable it with SDL_SetEventEnabled().
|
||||||
|
|
|
@ -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);
|
const int device_index = iscapture ? add_capture_device(name, spec, handle) : add_output_device(name, spec, handle);
|
||||||
if (device_index != -1) {
|
if (device_index != -1) {
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
if (SDL_EventEnabled(SDL_AUDIODEVICEADDED)) {
|
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_ADDED)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_AUDIODEVICEADDED;
|
event.type = SDL_EVENT_AUDIO_DEVICE_ADDED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.adevice.which = device_index;
|
event.adevice.which = device_index;
|
||||||
event.adevice.iscapture = iscapture;
|
event.adevice.iscapture = iscapture;
|
||||||
|
@ -445,9 +445,9 @@ void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device)
|
||||||
current_audio.impl.UnlockDevice(device);
|
current_audio.impl.UnlockDevice(device);
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
if (SDL_EventEnabled(SDL_AUDIODEVICEREMOVED)) {
|
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_REMOVED)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_AUDIODEVICEREMOVED;
|
event.type = SDL_EVENT_AUDIO_DEVICE_REMOVED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.adevice.which = device->id;
|
event.adevice.which = device->id;
|
||||||
event.adevice.iscapture = device->iscapture ? 1 : 0;
|
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
|
/* 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
|
Apps can use this to decide if they need to refresh a list of
|
||||||
available devices instead of closing an opened one.
|
available devices instead of closing an opened one.
|
||||||
Note that opened devices will send the non-zero event in
|
Note that opened devices will send the non-zero event in
|
||||||
SDL_OpenedAudioDeviceDisconnected(). */
|
SDL_OpenedAudioDeviceDisconnected(). */
|
||||||
if (!device_was_opened) {
|
if (!device_was_opened) {
|
||||||
if (SDL_EventEnabled(SDL_AUDIODEVICEREMOVED)) {
|
if (SDL_EventEnabled(SDL_EVENT_AUDIO_DEVICE_REMOVED)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_AUDIODEVICEREMOVED;
|
event.type = SDL_EVENT_AUDIO_DEVICE_REMOVED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.adevice.which = 0;
|
event.adevice.which = 0;
|
||||||
event.adevice.iscapture = iscapture ? 1 : 0;
|
event.adevice.iscapture = iscapture ? 1 : 0;
|
||||||
|
|
|
@ -902,7 +902,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
|
||||||
|
|
||||||
if (Android_Window) {
|
if (Android_Window) {
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplay(0);
|
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);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
@ -1192,7 +1192,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
|
||||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
|
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
|
||||||
JNIEnv *env, jclass cls)
|
JNIEnv *env, jclass cls)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locale
|
/* Locale
|
||||||
|
@ -1200,7 +1200,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
|
||||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)(
|
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)(
|
||||||
JNIEnv *env, jclass cls)
|
JNIEnv *env, jclass cls)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_LOCALECHANGED);
|
SDL_SendAppEvent(SDL_EVENT_LOCALE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send Quit event to "SDLThread" thread */
|
/* Send Quit event to "SDLThread" thread */
|
||||||
|
@ -1208,17 +1208,17 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)(
|
||||||
JNIEnv *env, jclass cls)
|
JNIEnv *env, jclass cls)
|
||||||
{
|
{
|
||||||
/* Discard previous events. The user should have handled state storage
|
/* Discard previous events. The user should have handled state storage
|
||||||
* in SDL_APP_WILLENTERBACKGROUND. After nativeSendQuit() is called, no
|
* in SDL_EVENT_WILL_ENTER_BACKGROUND. After nativeSendQuit() is called, no
|
||||||
* events other than SDL_QUIT and SDL_APP_TERMINATING should fire */
|
* events other than SDL_EVENT_QUIT and SDL_EVENT_TERMINATING should fire */
|
||||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST);
|
||||||
/* Inject a SDL_QUIT event */
|
/* Inject a SDL_EVENT_QUIT event */
|
||||||
SDL_SendQuit();
|
SDL_SendQuit();
|
||||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
|
||||||
/* Robustness: clear any pending Pause */
|
/* Robustness: clear any pending Pause */
|
||||||
while (SDL_SemTryWait(Android_PauseSem) == 0) {
|
while (SDL_SemTryWait(Android_PauseSem) == 0) {
|
||||||
/* empty */
|
/* 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. */
|
* should now be the top event in the event queue. */
|
||||||
SDL_SemPost(Android_ResumeSem);
|
SDL_SemPost(Android_ResumeSem);
|
||||||
}
|
}
|
||||||
|
@ -1285,7 +1285,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)(
|
||||||
|
|
||||||
if (Android_Window) {
|
if (Android_Window) {
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()");
|
__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);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
@ -2625,7 +2625,7 @@ int Android_JNI_GetLocale(char *buf, size_t buflen)
|
||||||
|
|
||||||
SDL_assert(buflen > 6);
|
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();
|
Internal_Android_Destroy_AssetManager();
|
||||||
|
|
||||||
if (asset_manager == NULL) {
|
if (asset_manager == NULL) {
|
||||||
|
|
|
@ -157,7 +157,7 @@ SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
|
||||||
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler");
|
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler");
|
||||||
if (quiesced) {
|
if (quiesced) {
|
||||||
ResetEvent(plmSuspendComplete);
|
ResetEvent(plmSuspendComplete);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
|
||||||
|
|
||||||
// To defer suspension, we must wait to exit this callback.
|
// To defer suspension, we must wait to exit this callback.
|
||||||
// IMPORTANT: The app must call SDL_GDKSuspendComplete() to release this lock.
|
// 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.");
|
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler: plmSuspendComplete event signaled.");
|
||||||
} else {
|
} else {
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (RegisterAppStateChangeNotification(rascn, NULL, &hPLM)) {
|
if (RegisterAppStateChangeNotification(rascn, NULL, &hPLM)) {
|
||||||
|
|
|
@ -119,23 +119,23 @@ class SDL_BApp : public BApplication
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_REPAINT:
|
case BAPP_REPAINT:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_EXPOSED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MAXIMIZE:
|
case BAPP_MAXIMIZE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MAXIMIZED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MINIMIZE:
|
case BAPP_MINIMIZE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MINIMIZED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_SHOW:
|
case BAPP_SHOW:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_SHOWN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_HIDE:
|
case BAPP_HIDE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_HIDDEN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MOUSE_FOCUS:
|
case BAPP_MOUSE_FOCUS:
|
||||||
|
@ -147,7 +147,7 @@ class SDL_BApp : public BApplication
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_WINDOW_CLOSE_REQUESTED:
|
case BAPP_WINDOW_CLOSE_REQUESTED:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_CLOSE_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_WINDOW_MOVED:
|
case BAPP_WINDOW_MOVED:
|
||||||
|
@ -310,7 +310,7 @@ class SDL_BApp : public BApplication
|
||||||
HAIKU_SetKeyState(scancode, state);
|
HAIKU_SetKeyState(scancode, state);
|
||||||
SDL_SendKeyboardKey(0, state, HAIKU_GetScancodeFromBeKey(scancode));
|
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;
|
const int8 *keyUtf8;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
||||||
|
@ -373,7 +373,7 @@ class SDL_BApp : public BApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win = GetSDLWindow(winID);
|
win = GetSDLWindow(winID);
|
||||||
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
|
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_MOVED, xPos, yPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _HandleWindowResized(BMessage *msg)
|
void _HandleWindowResized(BMessage *msg)
|
||||||
|
@ -389,7 +389,7 @@ class SDL_BApp : public BApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win = GetSDLWindow(winID);
|
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)
|
bool _GetWinID(BMessage *msg, int32 *winID)
|
||||||
|
|
|
@ -145,17 +145,17 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
|
||||||
|
|
||||||
const Uint32 latestFlags = WINRT_DetectWindowFlags(window);
|
const Uint32 latestFlags = WINRT_DetectWindowFlags(window);
|
||||||
if (latestFlags & SDL_WINDOW_MAXIMIZED) {
|
if (latestFlags & SDL_WINDOW_MAXIMIZED) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||||
} else {
|
} 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);
|
WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
|
||||||
/* The window can move during a resize event, such as when maximizing
|
/* The window can move during a resize event, such as when maximizing
|
||||||
or resizing from a corner */
|
or resizing from a corner */
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
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;
|
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
|
||||||
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
|
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
|
||||||
int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -370,18 +370,18 @@ bool SDL_WinRTApp::ShouldWaitForAppResumeEvents()
|
||||||
|
|
||||||
/* Don't wait until the window-hide events finish processing.
|
/* Don't wait until the window-hide events finish processing.
|
||||||
* Do note that if an app-suspend event is sent (as indicated
|
* 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
|
* events), then this code may be a moot point, as WinRT's
|
||||||
* own event pump (aka ProcessEvents()) will pause regardless
|
* own event pump (aka ProcessEvents()) will pause regardless
|
||||||
* of what we do here. This happens on Windows Phone 8, to note.
|
* 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
|
* Windows 8.x apps, on the other hand, may get a chance to run
|
||||||
* these.
|
* these.
|
||||||
*/
|
*/
|
||||||
if (IsSDLWindowEventPending(SDL_WINDOWEVENT_HIDDEN)) {
|
if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_HIDDEN)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_FOCUS_LOST)) {
|
} else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_FOCUS_LOST)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_MINIMIZED)) {
|
} else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_MINIMIZED)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,17 +490,17 @@ void SDL_WinRTApp::OnVisibilityChanged(CoreWindow ^ sender, VisibilityChangedEve
|
||||||
SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
|
SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
|
||||||
Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow);
|
Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow);
|
||||||
if (args->Visible) {
|
if (args->Visible) {
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0);
|
||||||
if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) {
|
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 {
|
} else {
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: Prevent SDL's window-hide handling code, which currently
|
// 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;
|
SDL_Window *window = WINRT_GlobalSDLWindow;
|
||||||
if (window) {
|
if (window) {
|
||||||
if (args->WindowActivationState != CoreWindowActivationState::Deactivated) {
|
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) {
|
if (SDL_GetKeyboardFocus() != window) {
|
||||||
SDL_SetKeyboardFocus(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.
|
// ... 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
|
// 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
|
// 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
|
// that a few WinRT operations can only be done from the main thread
|
||||||
// (things that access the WinRT CoreWindow are one example of this),
|
// (things that access the WinRT CoreWindow are one example of this),
|
||||||
// this could be important.
|
// this could be important.
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
|
||||||
|
|
||||||
SuspendingDeferral ^ deferral = args->SuspendingOperation->GetDeferral();
|
SuspendingDeferral ^ deferral = args->SuspendingOperation->GetDeferral();
|
||||||
create_task([this, deferral]() {
|
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.
|
// event queue won't get received until the WinRT app is resumed.
|
||||||
// SDL_AddEventWatch() may be used to receive app-suspend events on
|
// SDL_AddEventWatch() may be used to receive app-suspend events on
|
||||||
// WinRT.
|
// 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.
|
// Let the Direct3D 11 renderer prepare for the app to be backgrounded.
|
||||||
// This is necessary for Windows 8.1, possibly elsewhere in the future.
|
// 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
|
// 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
|
// and state are persisted when resuming from suspend. Note that these events
|
||||||
// do not occur if the app was previously terminated.
|
// do not occur if the app was previously terminated.
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_WinRTApp::OnExiting(Platform::Object ^ sender, Platform::Object ^ args)
|
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)
|
static void WINRT_LogPointerEvent(const char *header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)
|
||||||
|
|
|
@ -31,9 +31,9 @@ int SDL_SendClipboardUpdate(void)
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_CLIPBOARDUPDATE)) {
|
if (SDL_EventEnabled(SDL_EVENT_CLIPBOARD_UPDATE)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_CLIPBOARDUPDATE;
|
event.type = SDL_EVENT_CLIPBOARD_UPDATE;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ int SDL_SendDisplayEvent(SDL_VideoDisplay *display, SDL_EventType displayevent,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (displayevent) {
|
switch (displayevent) {
|
||||||
case SDL_DISPLAYEVENT_ORIENTATION:
|
case SDL_EVENT_DISPLAY_ORIENTATION:
|
||||||
if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) {
|
if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const ch
|
||||||
|
|
||||||
if (need_begin) {
|
if (need_begin) {
|
||||||
SDL_zero(event);
|
SDL_zero(event);
|
||||||
event.type = SDL_DROPBEGIN;
|
event.type = SDL_EVENT_DROP_BEGIN;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.drop.windowID = window ? window->id : 0;
|
event.drop.windowID = window ? window->id : 0;
|
||||||
posted = (SDL_PushEvent(&event) > 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;
|
event.drop.windowID = window ? window->id : 0;
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
|
|
||||||
if (posted && (evtype == SDL_DROPCOMPLETE)) {
|
if (posted && (evtype == SDL_EVENT_DROP_COMPLETE)) {
|
||||||
if (window) {
|
if (window) {
|
||||||
window->is_dropping = SDL_FALSE;
|
window->is_dropping = SDL_FALSE;
|
||||||
} else {
|
} 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)
|
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)
|
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)
|
int SDL_SendDropComplete(SDL_Window *window)
|
||||||
{
|
{
|
||||||
return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL);
|
return SDL_SendDrop(window, SDL_EVENT_DROP_COMPLETE, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ typedef struct
|
||||||
} SDL_DisabledEventBlock;
|
} SDL_DisabledEventBlock;
|
||||||
|
|
||||||
static SDL_DisabledEventBlock *SDL_disabled_events[256];
|
static SDL_DisabledEventBlock *SDL_disabled_events[256];
|
||||||
static Uint32 SDL_userevents = SDL_USEREVENT;
|
static Uint32 SDL_userevents = SDL_EVENT_USER;
|
||||||
|
|
||||||
/* Private data -- event queue */
|
/* Private data -- event queue */
|
||||||
typedef struct SDL_EventEntry
|
typedef struct SDL_EventEntry
|
||||||
|
@ -122,7 +122,7 @@ static void SDLCALL SDL_AutoUpdateSensorsChanged(void *userdata, const char *nam
|
||||||
|
|
||||||
static void SDLCALL SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
static void SDLCALL SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||||
{
|
{
|
||||||
SDL_SetEventEnabled(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE));
|
SDL_SetEventEnabled(SDL_EVENT_POLL_SENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,16 +146,16 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
|
|
||||||
/* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */
|
/* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */
|
||||||
if ((SDL_EventLoggingVerbosity < 2) &&
|
if ((SDL_EventLoggingVerbosity < 2) &&
|
||||||
((event->type == SDL_MOUSEMOTION) ||
|
((event->type == SDL_EVENT_MOUSE_MOTION) ||
|
||||||
(event->type == SDL_FINGERMOTION) ||
|
(event->type == SDL_EVENT_FINGER_MOTION) ||
|
||||||
(event->type == SDL_GAMEPADTOUCHPADMOTION) ||
|
(event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION) ||
|
||||||
(event->type == SDL_GAMEPADSENSORUPDATE) ||
|
(event->type == SDL_EVENT_GAMEPAD_SENSOR_UPDATE) ||
|
||||||
(event->type == SDL_SENSORUPDATE))) {
|
(event->type == SDL_EVENT_SENSOR_UPDATE))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* window manager events are even more spammy, and don't provide much useful info. */
|
/* window manager events are even more spammy, and don't provide much useful info. */
|
||||||
if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_SYSWMEVENT)) {
|
if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_EVENT_SYSWM)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,11 +167,11 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
|
|
||||||
/* !!! FIXME: This code is kinda ugly, sorry. */
|
/* !!! FIXME: This code is kinda ugly, sorry. */
|
||||||
|
|
||||||
if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) {
|
if ((event->type >= SDL_EVENT_USER) && (event->type <= SDL_EVENT_LAST)) {
|
||||||
char plusstr[16];
|
char plusstr[16];
|
||||||
SDL_strlcpy(name, "SDL_USEREVENT", sizeof(name));
|
SDL_strlcpy(name, "SDL_EVENT_USER", sizeof(name));
|
||||||
if (event->type > SDL_USEREVENT) {
|
if (event->type > SDL_EVENT_USER) {
|
||||||
(void)SDL_snprintf(plusstr, sizeof(plusstr), "+%u", ((uint)event->type) - SDL_USEREVENT);
|
(void)SDL_snprintf(plusstr, sizeof(plusstr), "+%u", ((uint)event->type) - SDL_EVENT_USER);
|
||||||
} else {
|
} else {
|
||||||
plusstr[0] = '\0';
|
plusstr[0] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -184,33 +184,33 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
#define SDL_EVENT_CASE(x) \
|
#define SDL_EVENT_CASE(x) \
|
||||||
case x: \
|
case x: \
|
||||||
SDL_strlcpy(name, #x, sizeof(name));
|
SDL_strlcpy(name, #x, sizeof(name));
|
||||||
SDL_EVENT_CASE(SDL_FIRSTEVENT)
|
SDL_EVENT_CASE(SDL_EVENT_FIRST)
|
||||||
SDL_strlcpy(details, " (THIS IS PROBABLY A BUG!)", sizeof(details));
|
SDL_strlcpy(details, " (THIS IS PROBABLY A BUG!)", sizeof(details));
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_QUIT)
|
SDL_EVENT_CASE(SDL_EVENT_QUIT)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->quit.timestamp);
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->quit.timestamp);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_TERMINATING)
|
SDL_EVENT_CASE(SDL_EVENT_TERMINATING)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_LOWMEMORY)
|
SDL_EVENT_CASE(SDL_EVENT_LOW_MEMORY)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND)
|
SDL_EVENT_CASE(SDL_EVENT_WILL_ENTER_BACKGROUND)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND)
|
SDL_EVENT_CASE(SDL_EVENT_DID_ENTER_BACKGROUND)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND)
|
SDL_EVENT_CASE(SDL_EVENT_WILL_ENTER_FOREGROUND)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND)
|
SDL_EVENT_CASE(SDL_EVENT_DID_ENTER_FOREGROUND)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_LOCALECHANGED)
|
SDL_EVENT_CASE(SDL_EVENT_LOCALE_CHANGED)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_KEYMAPCHANGED)
|
SDL_EVENT_CASE(SDL_EVENT_KEYMAP_CHANGED)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE)
|
SDL_EVENT_CASE(SDL_EVENT_CLIPBOARD_UPDATE)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET)
|
SDL_EVENT_CASE(SDL_EVENT_RENDER_TARGETS_RESET)
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET)
|
SDL_EVENT_CASE(SDL_EVENT_RENDER_DEVICE_RESET)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define SDL_DISPLAYEVENT_CASE(x) \
|
#define SDL_DISPLAYEVENT_CASE(x) \
|
||||||
|
@ -219,10 +219,10 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u display=%u event=%s data1=%d)", \
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u display=%u event=%s data1=%d)", \
|
||||||
(uint)event->display.timestamp, (uint)event->display.display, name, (int)event->display.data1); \
|
(uint)event->display.timestamp, (uint)event->display.display, name, (int)event->display.data1); \
|
||||||
break
|
break
|
||||||
SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_ORIENTATION);
|
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_ORIENTATION);
|
||||||
SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_CONNECTED);
|
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_CONNECTED);
|
||||||
SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_DISCONNECTED);
|
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_DISCONNECTED);
|
||||||
SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_MOVED);
|
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_MOVED);
|
||||||
#undef SDL_DISPLAYEVENT_CASE
|
#undef SDL_DISPLAYEVENT_CASE
|
||||||
|
|
||||||
#define SDL_WINDOWEVENT_CASE(x) \
|
#define SDL_WINDOWEVENT_CASE(x) \
|
||||||
|
@ -231,27 +231,27 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u event=%s data1=%d data2=%d)", \
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u event=%s data1=%d data2=%d)", \
|
||||||
(uint)event->window.timestamp, (uint)event->window.windowID, name, (int)event->window.data1, (int)event->window.data2); \
|
(uint)event->window.timestamp, (uint)event->window.windowID, name, (int)event->window.data1, (int)event->window.data2); \
|
||||||
break
|
break
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_SHOWN);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_HIDDEN);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_EXPOSED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOVED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_RESIZED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_SIZE_CHANGED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MINIMIZED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MAXIMIZED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_RESTORED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_ENTER);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_LEAVE);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_GAINED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_LOST);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_CLOSE_REQUESTED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_TAKE_FOCUS);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_HIT_TEST);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ICCPROF_CHANGED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_ICCPROF_CHANGED);
|
||||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_DISPLAY_CHANGED);
|
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_DISPLAY_CHANGED);
|
||||||
#undef SDL_WINDOWEVENT_CASE
|
#undef SDL_WINDOWEVENT_CASE
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_SYSWMEVENT)
|
SDL_EVENT_CASE(SDL_EVENT_SYSWM)
|
||||||
/* !!! FIXME: we don't delve further at the moment. */
|
/* !!! FIXME: we don't delve further at the moment. */
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->syswm.timestamp);
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->syswm.timestamp);
|
||||||
break;
|
break;
|
||||||
|
@ -264,25 +264,25 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(uint)event->key.keysym.scancode, \
|
(uint)event->key.keysym.scancode, \
|
||||||
(uint)event->key.keysym.sym, \
|
(uint)event->key.keysym.sym, \
|
||||||
(uint)event->key.keysym.mod)
|
(uint)event->key.keysym.mod)
|
||||||
SDL_EVENT_CASE(SDL_KEYDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_KEY_DOWN)
|
||||||
PRINT_KEY_EVENT(event);
|
PRINT_KEY_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_KEYUP)
|
SDL_EVENT_CASE(SDL_EVENT_KEY_UP)
|
||||||
PRINT_KEY_EVENT(event);
|
PRINT_KEY_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_KEY_EVENT
|
#undef PRINT_KEY_EVENT
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_TEXTEDITING)
|
SDL_EVENT_CASE(SDL_EVENT_TEXT_EDITING)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)",
|
||||||
(uint)event->edit.timestamp, (uint)event->edit.windowID,
|
(uint)event->edit.timestamp, (uint)event->edit.windowID,
|
||||||
event->edit.text, (int)event->edit.start, (int)event->edit.length);
|
event->edit.text, (int)event->edit.start, (int)event->edit.length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_TEXTINPUT)
|
SDL_EVENT_CASE(SDL_EVENT_TEXT_INPUT)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s')", (uint)event->text.timestamp, (uint)event->text.windowID, event->text.text);
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u text='%s')", (uint)event->text.timestamp, (uint)event->text.windowID, event->text.text);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_MOUSEMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_MOUSE_MOTION)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u state=%u x=%g y=%g xrel=%g yrel=%g)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u state=%u x=%g y=%g xrel=%g yrel=%g)",
|
||||||
(uint)event->motion.timestamp, (uint)event->motion.windowID,
|
(uint)event->motion.timestamp, (uint)event->motion.windowID,
|
||||||
(uint)event->motion.which, (uint)event->motion.state,
|
(uint)event->motion.which, (uint)event->motion.state,
|
||||||
|
@ -296,28 +296,28 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(uint)event->button.which, (uint)event->button.button, \
|
(uint)event->button.which, (uint)event->button.button, \
|
||||||
event->button.state == SDL_PRESSED ? "pressed" : "released", \
|
event->button.state == SDL_PRESSED ? "pressed" : "released", \
|
||||||
(uint)event->button.clicks, event->button.x, event->button.y)
|
(uint)event->button.clicks, event->button.x, event->button.y)
|
||||||
SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONDOWN)
|
||||||
PRINT_MBUTTON_EVENT(event);
|
PRINT_MBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_MOUSEBUTTONUP)
|
SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONUP)
|
||||||
PRINT_MBUTTON_EVENT(event);
|
PRINT_MBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_MBUTTON_EVENT
|
#undef PRINT_MBUTTON_EVENT
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_MOUSEWHEEL)
|
SDL_EVENT_CASE(SDL_EVENT_MOUSE_WHEEL)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u x=%g y=%g direction=%s)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u x=%g y=%g direction=%s)",
|
||||||
(uint)event->wheel.timestamp, (uint)event->wheel.windowID,
|
(uint)event->wheel.timestamp, (uint)event->wheel.windowID,
|
||||||
(uint)event->wheel.which, event->wheel.x, event->wheel.y,
|
(uint)event->wheel.which, event->wheel.x, event->wheel.y,
|
||||||
event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
|
event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_JOYAXISMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_AXIS_MOTION)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
||||||
(uint)event->jaxis.timestamp, (int)event->jaxis.which,
|
(uint)event->jaxis.timestamp, (int)event->jaxis.which,
|
||||||
(uint)event->jaxis.axis, (int)event->jaxis.value);
|
(uint)event->jaxis.axis, (int)event->jaxis.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_JOYHATMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_HAT_MOTION)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d hat=%u value=%u)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d hat=%u value=%u)",
|
||||||
(uint)event->jhat.timestamp, (int)event->jhat.which,
|
(uint)event->jhat.timestamp, (int)event->jhat.which,
|
||||||
(uint)event->jhat.hat, (uint)event->jhat.value);
|
(uint)event->jhat.hat, (uint)event->jhat.value);
|
||||||
|
@ -327,24 +327,24 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
||||||
(uint)event->jbutton.timestamp, (int)event->jbutton.which, \
|
(uint)event->jbutton.timestamp, (int)event->jbutton.which, \
|
||||||
(uint)event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released")
|
(uint)event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released")
|
||||||
SDL_EVENT_CASE(SDL_JOYBUTTONDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BUTTON_DOWN)
|
||||||
PRINT_JBUTTON_EVENT(event);
|
PRINT_JBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_JOYBUTTONUP)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BUTTON_UP)
|
||||||
PRINT_JBUTTON_EVENT(event);
|
PRINT_JBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_JBUTTON_EVENT
|
#undef PRINT_JBUTTON_EVENT
|
||||||
|
|
||||||
#define PRINT_JOYDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->jdevice.timestamp, (int)event->jdevice.which)
|
#define PRINT_JOYDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->jdevice.timestamp, (int)event->jdevice.which)
|
||||||
SDL_EVENT_CASE(SDL_JOYDEVICEADDED)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_ADDED)
|
||||||
PRINT_JOYDEV_EVENT(event);
|
PRINT_JOYDEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED)
|
SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_REMOVED)
|
||||||
PRINT_JOYDEV_EVENT(event);
|
PRINT_JOYDEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_JOYDEV_EVENT
|
#undef PRINT_JOYDEV_EVENT
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADAXISMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_AXIS_MOTION)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
||||||
(uint)event->caxis.timestamp, (int)event->caxis.which,
|
(uint)event->caxis.timestamp, (int)event->caxis.which,
|
||||||
(uint)event->caxis.axis, (int)event->caxis.value);
|
(uint)event->caxis.axis, (int)event->caxis.value);
|
||||||
|
@ -354,22 +354,22 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \
|
||||||
(uint)event->cbutton.timestamp, (int)event->cbutton.which, \
|
(uint)event->cbutton.timestamp, (int)event->cbutton.which, \
|
||||||
(uint)event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released")
|
(uint)event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released")
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADBUTTONDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_BUTTON_DOWN)
|
||||||
PRINT_CBUTTON_EVENT(event);
|
PRINT_CBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADBUTTONUP)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_BUTTON_UP)
|
||||||
PRINT_CBUTTON_EVENT(event);
|
PRINT_CBUTTON_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_CBUTTON_EVENT
|
#undef PRINT_CBUTTON_EVENT
|
||||||
|
|
||||||
#define PRINT_GAMEPADDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->cdevice.timestamp, (int)event->cdevice.which)
|
#define PRINT_GAMEPADDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->cdevice.timestamp, (int)event->cdevice.which)
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADADDED)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_ADDED)
|
||||||
PRINT_GAMEPADDEV_EVENT(event);
|
PRINT_GAMEPADDEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADREMOVED)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_REMOVED)
|
||||||
PRINT_GAMEPADDEV_EVENT(event);
|
PRINT_GAMEPADDEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADREMAPPED)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_REMAPPED)
|
||||||
PRINT_GAMEPADDEV_EVENT(event);
|
PRINT_GAMEPADDEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_GAMEPADDEV_EVENT
|
#undef PRINT_GAMEPADDEV_EVENT
|
||||||
|
@ -379,18 +379,18 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(uint)event->ctouchpad.timestamp, (int)event->ctouchpad.which, \
|
(uint)event->ctouchpad.timestamp, (int)event->ctouchpad.which, \
|
||||||
(int)event->ctouchpad.touchpad, (int)event->ctouchpad.finger, \
|
(int)event->ctouchpad.touchpad, (int)event->ctouchpad.finger, \
|
||||||
event->ctouchpad.x, event->ctouchpad.y, event->ctouchpad.pressure)
|
event->ctouchpad.x, event->ctouchpad.y, event->ctouchpad.pressure)
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN)
|
||||||
PRINT_CTOUCHPAD_EVENT(event);
|
PRINT_CTOUCHPAD_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADUP)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_UP)
|
||||||
PRINT_CTOUCHPAD_EVENT(event);
|
PRINT_CTOUCHPAD_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION)
|
||||||
PRINT_CTOUCHPAD_EVENT(event);
|
PRINT_CTOUCHPAD_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_CTOUCHPAD_EVENT
|
#undef PRINT_CTOUCHPAD_EVENT
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_GAMEPADSENSORUPDATE)
|
SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d sensor=%d data[0]=%f data[1]=%f data[2]=%f)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d sensor=%d data[0]=%f data[1]=%f data[2]=%f)",
|
||||||
(uint)event->csensor.timestamp, (int)event->csensor.which, (int)event->csensor.sensor,
|
(uint)event->csensor.timestamp, (int)event->csensor.which, (int)event->csensor.sensor,
|
||||||
event->csensor.data[0], event->csensor.data[1], event->csensor.data[2]);
|
event->csensor.data[0], event->csensor.data[1], event->csensor.data[2]);
|
||||||
|
@ -401,42 +401,42 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
(uint)event->tfinger.timestamp, (long long)event->tfinger.touchId, \
|
(uint)event->tfinger.timestamp, (long long)event->tfinger.touchId, \
|
||||||
(long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
(long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
||||||
SDL_EVENT_CASE(SDL_FINGERDOWN)
|
SDL_EVENT_CASE(SDL_EVENT_FINGER_DOWN)
|
||||||
PRINT_FINGER_EVENT(event);
|
PRINT_FINGER_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_FINGERUP)
|
SDL_EVENT_CASE(SDL_EVENT_FINGER_UP)
|
||||||
PRINT_FINGER_EVENT(event);
|
PRINT_FINGER_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_FINGERMOTION)
|
SDL_EVENT_CASE(SDL_EVENT_FINGER_MOTION)
|
||||||
PRINT_FINGER_EVENT(event);
|
PRINT_FINGER_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_FINGER_EVENT
|
#undef PRINT_FINGER_EVENT
|
||||||
|
|
||||||
#define PRINT_DROP_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint)event->drop.timestamp, (uint)event->drop.windowID)
|
#define PRINT_DROP_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint)event->drop.timestamp, (uint)event->drop.windowID)
|
||||||
SDL_EVENT_CASE(SDL_DROPFILE)
|
SDL_EVENT_CASE(SDL_EVENT_DROP_FILE)
|
||||||
PRINT_DROP_EVENT(event);
|
PRINT_DROP_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_DROPTEXT)
|
SDL_EVENT_CASE(SDL_EVENT_DROP_TEXT)
|
||||||
PRINT_DROP_EVENT(event);
|
PRINT_DROP_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_DROPBEGIN)
|
SDL_EVENT_CASE(SDL_EVENT_DROP_BEGIN)
|
||||||
PRINT_DROP_EVENT(event);
|
PRINT_DROP_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_DROPCOMPLETE)
|
SDL_EVENT_CASE(SDL_EVENT_DROP_COMPLETE)
|
||||||
PRINT_DROP_EVENT(event);
|
PRINT_DROP_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_DROP_EVENT
|
#undef PRINT_DROP_EVENT
|
||||||
|
|
||||||
#define PRINT_AUDIODEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u iscapture=%s)", (uint)event->adevice.timestamp, (uint)event->adevice.which, event->adevice.iscapture ? "true" : "false")
|
#define PRINT_AUDIODEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u iscapture=%s)", (uint)event->adevice.timestamp, (uint)event->adevice.which, event->adevice.iscapture ? "true" : "false")
|
||||||
SDL_EVENT_CASE(SDL_AUDIODEVICEADDED)
|
SDL_EVENT_CASE(SDL_EVENT_AUDIO_DEVICE_ADDED)
|
||||||
PRINT_AUDIODEV_EVENT(event);
|
PRINT_AUDIODEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED)
|
SDL_EVENT_CASE(SDL_EVENT_AUDIO_DEVICE_REMOVED)
|
||||||
PRINT_AUDIODEV_EVENT(event);
|
PRINT_AUDIODEV_EVENT(event);
|
||||||
break;
|
break;
|
||||||
#undef PRINT_AUDIODEV_EVENT
|
#undef PRINT_AUDIODEV_EVENT
|
||||||
|
|
||||||
SDL_EVENT_CASE(SDL_SENSORUPDATE)
|
SDL_EVENT_CASE(SDL_EVENT_SENSOR_UPDATE)
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d data[0]=%f data[1]=%f data[2]=%f data[3]=%f data[4]=%f data[5]=%f)",
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d data[0]=%f data[1]=%f data[2]=%f data[3]=%f data[4]=%f data[5]=%f)",
|
||||||
(uint)event->sensor.timestamp, (int)event->sensor.which,
|
(uint)event->sensor.timestamp, (int)event->sensor.which,
|
||||||
event->sensor.data[0], event->sensor.data[1], event->sensor.data[2],
|
event->sensor.data[0], event->sensor.data[1], event->sensor.data[2],
|
||||||
|
@ -445,7 +445,7 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
|
|
||||||
#undef SDL_EVENT_CASE
|
#undef SDL_EVENT_CASE
|
||||||
|
|
||||||
case SDL_POLLSENTINEL:
|
case SDL_EVENT_POLL_SENTINEL:
|
||||||
/* No logging necessary for this one */
|
/* No logging necessary for this one */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ void SDL_StopEventLoop(void)
|
||||||
int SDL_StartEventLoop(void)
|
int SDL_StartEventLoop(void)
|
||||||
{
|
{
|
||||||
/* We'll leave the event queue alone, since we might have gotten
|
/* We'll leave the event queue alone, since we might have gotten
|
||||||
some important events at launch (like SDL_DROPFILE)
|
some important events at launch (like SDL_EVENT_DROP_FILE)
|
||||||
|
|
||||||
FIXME: Does this introduce any other bugs with events at startup?
|
FIXME: Does this introduce any other bugs with events at startup?
|
||||||
*/
|
*/
|
||||||
|
@ -567,12 +567,12 @@ int SDL_StartEventLoop(void)
|
||||||
#endif /* !SDL_THREADS_DISABLED */
|
#endif /* !SDL_THREADS_DISABLED */
|
||||||
|
|
||||||
/* Process most event types */
|
/* Process most event types */
|
||||||
SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_FALSE);
|
||||||
SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
|
||||||
SDL_SetEventEnabled(SDL_SYSWMEVENT, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_SYSWM, SDL_FALSE);
|
||||||
#if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */
|
#if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */
|
||||||
SDL_SetEventEnabled(SDL_DROPFILE, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_FALSE);
|
||||||
SDL_SetEventEnabled(SDL_DROPTEXT, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_EventQ.active = SDL_TRUE;
|
SDL_EventQ.active = SDL_TRUE;
|
||||||
|
@ -607,9 +607,9 @@ static int SDL_AddEvent(SDL_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->event = *event;
|
entry->event = *event;
|
||||||
if (event->type == SDL_POLLSENTINEL) {
|
if (event->type == SDL_EVENT_POLL_SENTINEL) {
|
||||||
SDL_AtomicAdd(&SDL_sentinel_pending, 1);
|
SDL_AtomicAdd(&SDL_sentinel_pending, 1);
|
||||||
} else if (event->type == SDL_SYSWMEVENT) {
|
} else if (event->type == SDL_EVENT_SYSWM) {
|
||||||
entry->msg = *event->syswm.msg;
|
entry->msg = *event->syswm.msg;
|
||||||
entry->event.syswm.msg = &entry->msg;
|
entry->event.syswm.msg = &entry->msg;
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ static void SDL_CutEvent(SDL_EventEntry *entry)
|
||||||
SDL_EventQ.tail = entry->prev;
|
SDL_EventQ.tail = entry->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->event.type == SDL_POLLSENTINEL) {
|
if (entry->event.type == SDL_EVENT_POLL_SENTINEL) {
|
||||||
SDL_AtomicAdd(&SDL_sentinel_pending, -1);
|
SDL_AtomicAdd(&SDL_sentinel_pending, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventact
|
||||||
if (minType <= type && type <= maxType) {
|
if (minType <= type && type <= maxType) {
|
||||||
if (events) {
|
if (events) {
|
||||||
events[used] = entry->event;
|
events[used] = entry->event;
|
||||||
if (entry->event.type == SDL_SYSWMEVENT) {
|
if (entry->event.type == SDL_EVENT_SYSWM) {
|
||||||
/* We need to copy the wmmsg somewhere safe.
|
/* We need to copy the wmmsg somewhere safe.
|
||||||
For now we'll guarantee it's valid at least until
|
For now we'll guarantee it's valid at least until
|
||||||
the next call to SDL_PeepEvents()
|
the next call to SDL_PeepEvents()
|
||||||
|
@ -753,7 +753,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventact
|
||||||
SDL_CutEvent(entry);
|
SDL_CutEvent(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == SDL_POLLSENTINEL) {
|
if (type == SDL_EVENT_POLL_SENTINEL) {
|
||||||
/* Special handling for the sentinel event */
|
/* Special handling for the sentinel event */
|
||||||
if (!include_sentinel) {
|
if (!include_sentinel) {
|
||||||
/* Skip it, we don't want to include it */
|
/* Skip it, we don't want to include it */
|
||||||
|
@ -865,10 +865,10 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
|
||||||
|
|
||||||
SDL_SendPendingSignalEvents(); /* in case we had a signal handler fire, etc. */
|
SDL_SendPendingSignalEvents(); /* in case we had a signal handler fire, etc. */
|
||||||
|
|
||||||
if (push_sentinel && SDL_EventEnabled(SDL_POLLSENTINEL)) {
|
if (push_sentinel && SDL_EventEnabled(SDL_EVENT_POLL_SENTINEL)) {
|
||||||
SDL_Event sentinel;
|
SDL_Event sentinel;
|
||||||
|
|
||||||
sentinel.type = SDL_POLLSENTINEL;
|
sentinel.type = SDL_EVENT_POLL_SENTINEL;
|
||||||
sentinel.common.timestamp = 0;
|
sentinel.common.timestamp = 0;
|
||||||
SDL_PushEvent(&sentinel);
|
SDL_PushEvent(&sentinel);
|
||||||
}
|
}
|
||||||
|
@ -918,7 +918,7 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
|
||||||
|
|
||||||
SDL_LockMutex(_this->wakeup_lock);
|
SDL_LockMutex(_this->wakeup_lock);
|
||||||
{
|
{
|
||||||
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST);
|
||||||
/* If status == 0 we are going to block so wakeup will be needed. */
|
/* If status == 0 we are going to block so wakeup will be needed. */
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
_this->wakeup_window = wakeup_window;
|
_this->wakeup_window = wakeup_window;
|
||||||
|
@ -1027,13 +1027,13 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First check for existing events */
|
/* First check for existing events */
|
||||||
result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel);
|
result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST, include_sentinel);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (include_sentinel) {
|
if (include_sentinel) {
|
||||||
if (event) {
|
if (event) {
|
||||||
if (event->type == SDL_POLLSENTINEL) {
|
if (event->type == SDL_EVENT_POLL_SENTINEL) {
|
||||||
/* Reached the end of a poll cycle, and not willing to wait */
|
/* Reached the end of a poll cycle, and not willing to wait */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1041,9 +1041,9 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
||||||
/* Need to peek the next event to check for sentinel */
|
/* Need to peek the next event to check for sentinel */
|
||||||
SDL_Event dummy;
|
SDL_Event dummy;
|
||||||
|
|
||||||
if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) &&
|
if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST, SDL_TRUE) &&
|
||||||
dummy.type == SDL_POLLSENTINEL) {
|
dummy.type == SDL_EVENT_POLL_SENTINEL) {
|
||||||
SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_POLLSENTINEL, SDL_POLLSENTINEL, SDL_TRUE);
|
SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_EVENT_POLL_SENTINEL, SDL_EVENT_POLL_SENTINEL, SDL_TRUE);
|
||||||
/* Reached the end of a poll cycle, and not willing to wait */
|
/* Reached the end of a poll cycle, and not willing to wait */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1085,7 +1085,7 @@ int SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
SDL_PumpEventsInternal(SDL_TRUE);
|
SDL_PumpEventsInternal(SDL_TRUE);
|
||||||
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
|
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST)) {
|
||||||
case -1:
|
case -1:
|
||||||
return 0;
|
return 0;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -1158,7 +1158,7 @@ void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
|
||||||
/* Set filter and discard pending events */
|
/* Set filter and discard pending events */
|
||||||
SDL_EventOK.callback = filter;
|
SDL_EventOK.callback = filter;
|
||||||
SDL_EventOK.userdata = userdata;
|
SDL_EventOK.userdata = userdata;
|
||||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST);
|
||||||
}
|
}
|
||||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||||
}
|
}
|
||||||
|
@ -1272,7 +1272,7 @@ void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled)
|
||||||
|
|
||||||
/* turn off drag'n'drop support if we've disabled the events.
|
/* turn off drag'n'drop support if we've disabled the events.
|
||||||
This might change some UI details at the OS level. */
|
This might change some UI details at the OS level. */
|
||||||
if (type == SDL_DROPFILE || type == SDL_DROPTEXT) {
|
if (type == SDL_EVENT_DROP_FILE || type == SDL_EVENT_DROP_TEXT) {
|
||||||
SDL_ToggleDragAndDropSupport();
|
SDL_ToggleDragAndDropSupport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1295,7 +1295,7 @@ Uint32 SDL_RegisterEvents(int numevents)
|
||||||
{
|
{
|
||||||
Uint32 event_base;
|
Uint32 event_base;
|
||||||
|
|
||||||
if ((numevents > 0) && (SDL_userevents + numevents <= SDL_LASTEVENT)) {
|
if ((numevents > 0) && (SDL_userevents + numevents <= SDL_EVENT_LAST)) {
|
||||||
event_base = SDL_userevents;
|
event_base = SDL_userevents;
|
||||||
SDL_userevents += numevents;
|
SDL_userevents += numevents;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1323,10 +1323,10 @@ int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
|
||||||
int posted;
|
int posted;
|
||||||
|
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
|
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_memset(&event, 0, sizeof(event));
|
SDL_memset(&event, 0, sizeof(event));
|
||||||
event.type = SDL_SYSWMEVENT;
|
event.type = SDL_EVENT_SYSWM;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.syswm.msg = message;
|
event.syswm.msg = message;
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
|
@ -1337,12 +1337,12 @@ int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
|
||||||
|
|
||||||
int SDL_SendKeymapChangedEvent(void)
|
int SDL_SendKeymapChangedEvent(void)
|
||||||
{
|
{
|
||||||
return SDL_SendAppEvent(SDL_KEYMAPCHANGED);
|
return SDL_SendAppEvent(SDL_EVENT_KEYMAP_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SendLocaleChangedEvent(void)
|
int SDL_SendLocaleChangedEvent(void)
|
||||||
{
|
{
|
||||||
return SDL_SendAppEvent(SDL_LOCALECHANGED);
|
return SDL_SendAppEvent(SDL_EVENT_LOCALE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_InitEvents(void)
|
int SDL_InitEvents(void)
|
||||||
|
|
|
@ -768,11 +768,11 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
|
||||||
SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
|
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);
|
0, 0);
|
||||||
|
|
||||||
/* Ensures IME compositions are committed */
|
/* Ensures IME compositions are committed */
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_VideoDevice *video = SDL_GetVideoDevice();
|
SDL_VideoDevice *video = SDL_GetVideoDevice();
|
||||||
if (video && video->StopTextInput) {
|
if (video && video->StopTextInput) {
|
||||||
video->StopTextInput(video);
|
video->StopTextInput(video);
|
||||||
|
@ -783,10 +783,10 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
|
||||||
keyboard->focus = window;
|
keyboard->focus = window;
|
||||||
|
|
||||||
if (keyboard->focus) {
|
if (keyboard->focus) {
|
||||||
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
|
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_GAINED,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_VideoDevice *video = SDL_GetVideoDevice();
|
SDL_VideoDevice *video = SDL_GetVideoDevice();
|
||||||
if (video && video->StartTextInput) {
|
if (video && video->StartTextInput) {
|
||||||
video->StartTextInput(video);
|
video->StartTextInput(video);
|
||||||
|
@ -816,10 +816,10 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
|
||||||
/* Figure out what type of event this is */
|
/* Figure out what type of event this is */
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SDL_PRESSED:
|
case SDL_PRESSED:
|
||||||
type = SDL_KEYDOWN;
|
type = SDL_EVENT_KEY_DOWN;
|
||||||
break;
|
break;
|
||||||
case SDL_RELEASED:
|
case SDL_RELEASED:
|
||||||
type = SDL_KEYUP;
|
type = SDL_EVENT_KEY_UP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Invalid state -- bail */
|
/* Invalid state -- bail */
|
||||||
|
@ -888,7 +888,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
|
||||||
modifier = SDL_KMOD_NONE;
|
modifier = SDL_KMOD_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SDL_KEYDOWN == type) {
|
if (SDL_EVENT_KEY_DOWN == type) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case SDLK_NUMLOCKCLEAR:
|
case SDLK_NUMLOCKCLEAR:
|
||||||
keyboard->modstate ^= SDL_KMOD_NUM;
|
keyboard->modstate ^= SDL_KMOD_NUM;
|
||||||
|
@ -1028,11 +1028,11 @@ int SDL_SendKeyboardText(const char *text)
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
size_t pos = 0, advance, length = SDL_strlen(text);
|
size_t pos = 0, advance, length = SDL_strlen(text);
|
||||||
|
|
||||||
event.type = SDL_TEXTINPUT;
|
event.type = SDL_EVENT_TEXT_INPUT;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||||
while (pos < length) {
|
while (pos < length) {
|
||||||
|
@ -1054,19 +1054,19 @@ int SDL_SendEditingText(const char *text, int start, int length)
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_TEXTEDITING)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_EDITING)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) &&
|
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) &&
|
||||||
SDL_strlen(text) >= SDL_arraysize(event.text.text)) {
|
SDL_strlen(text) >= SDL_arraysize(event.text.text)) {
|
||||||
event.type = SDL_TEXTEDITING_EXT;
|
event.type = SDL_EVENT_TEXTEDITING_EXT;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||||
event.editExt.text = text ? SDL_strdup(text) : NULL;
|
event.editExt.text = text ? SDL_strdup(text) : NULL;
|
||||||
event.editExt.start = start;
|
event.editExt.start = start;
|
||||||
event.editExt.length = length;
|
event.editExt.length = length;
|
||||||
} else {
|
} else {
|
||||||
event.type = SDL_TEXTEDITING;
|
event.type = SDL_EVENT_TEXT_EDITING;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||||
event.edit.start = start;
|
event.edit.start = start;
|
||||||
|
|
|
@ -290,14 +290,14 @@ void SDL_SetMouseFocus(SDL_Window *window)
|
||||||
|
|
||||||
/* See if the current window has lost focus */
|
/* See if the current window has lost focus */
|
||||||
if (mouse->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->focus = window;
|
||||||
mouse->has_position = SDL_FALSE;
|
mouse->has_position = SDL_FALSE;
|
||||||
|
|
||||||
if (mouse->focus) {
|
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 */
|
/* Update cursor visibility */
|
||||||
|
@ -579,9 +579,9 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_MOUSEMOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_MOUSEMOTION;
|
event.type = SDL_EVENT_MOUSE_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
|
event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
|
||||||
event.motion.which = mouseID;
|
event.motion.which = mouseID;
|
||||||
|
@ -687,11 +687,11 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_
|
||||||
/* Figure out which event to perform */
|
/* Figure out which event to perform */
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SDL_PRESSED:
|
case SDL_PRESSED:
|
||||||
type = SDL_MOUSEBUTTONDOWN;
|
type = SDL_EVENT_MOUSE_BUTTONDOWN;
|
||||||
buttonstate |= SDL_BUTTON(button);
|
buttonstate |= SDL_BUTTON(button);
|
||||||
break;
|
break;
|
||||||
case SDL_RELEASED:
|
case SDL_RELEASED:
|
||||||
type = SDL_MOUSEBUTTONUP;
|
type = SDL_EVENT_MOUSE_BUTTONUP;
|
||||||
buttonstate &= ~SDL_BUTTON(button);
|
buttonstate &= ~SDL_BUTTON(button);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -789,9 +789,9 @@ int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_MOUSEWHEEL)) {
|
if (SDL_EventEnabled(SDL_EVENT_MOUSE_WHEEL)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_MOUSEWHEEL;
|
event.type = SDL_EVENT_MOUSE_WHEEL;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
|
event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
|
||||||
event.wheel.which = mouseID;
|
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 */
|
/* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,5 +191,5 @@ int SDL_SendQuit(void)
|
||||||
#ifdef HAVE_SIGNAL_SUPPORT
|
#ifdef HAVE_SIGNAL_SUPPORT
|
||||||
send_quit_pending = SDL_FALSE;
|
send_quit_pending = SDL_FALSE;
|
||||||
#endif
|
#endif
|
||||||
return SDL_SendAppEvent(SDL_QUIT);
|
return SDL_SendAppEvent(SDL_EVENT_QUIT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,9 +319,9 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
|
||||||
}
|
}
|
||||||
|
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_FINGERDOWN)) {
|
if (SDL_EventEnabled(SDL_EVENT_FINGER_DOWN)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_FINGERDOWN;
|
event.type = SDL_EVENT_FINGER_DOWN;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerId = fingerid;
|
||||||
|
@ -340,9 +340,9 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
|
||||||
}
|
}
|
||||||
|
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_FINGERUP)) {
|
if (SDL_EventEnabled(SDL_EVENT_FINGER_UP)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_FINGERUP;
|
event.type = SDL_EVENT_FINGER_UP;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerId = fingerid;
|
||||||
|
@ -437,9 +437,9 @@ int SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid,
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
if (SDL_EventEnabled(SDL_FINGERMOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_FINGER_MOTION)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_FINGERMOTION;
|
event.type = SDL_EVENT_FINGER_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerId = fingerid;
|
||||||
|
|
|
@ -36,11 +36,11 @@ static int SDLCALL RemovePendingSizeChangedAndResizedEvents(void *_userdata, SDL
|
||||||
RemovePendingSizeChangedAndResizedEvents_Data *userdata = (RemovePendingSizeChangedAndResizedEvents_Data *)_userdata;
|
RemovePendingSizeChangedAndResizedEvents_Data *userdata = (RemovePendingSizeChangedAndResizedEvents_Data *)_userdata;
|
||||||
const SDL_Event *new_event = userdata->new_event;
|
const SDL_Event *new_event = userdata->new_event;
|
||||||
|
|
||||||
if ((event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
if ((event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
|
||||||
event->type == SDL_WINDOWEVENT_RESIZED) &&
|
event->type == SDL_EVENT_WINDOW_RESIZED) &&
|
||||||
event->window.windowID == new_event->window.windowID) {
|
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;
|
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;
|
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) {
|
event->window.windowID == new_event->window.windowID) {
|
||||||
/* We're about to post a new move event, drop the old one */
|
/* We're about to post a new move event, drop the old one */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -66,7 +66,7 @@ static int SDLCALL RemovePendingExposedEvents(void *userdata, SDL_Event *event)
|
||||||
{
|
{
|
||||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
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) {
|
event->window.windowID == new_event->window.windowID) {
|
||||||
/* We're about to post a new exposed event, drop the old one */
|
/* We're about to post a new exposed event, drop the old one */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -83,21 +83,21 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (windowevent) {
|
switch (windowevent) {
|
||||||
case SDL_WINDOWEVENT_SHOWN:
|
case SDL_EVENT_WINDOW_SHOWN:
|
||||||
if (!(window->flags & SDL_WINDOW_HIDDEN)) {
|
if (!(window->flags & SDL_WINDOW_HIDDEN)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
|
window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
|
||||||
SDL_OnWindowShown(window);
|
SDL_OnWindowShown(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_HIDDEN:
|
case SDL_EVENT_WINDOW_HIDDEN:
|
||||||
if (window->flags & SDL_WINDOW_HIDDEN) {
|
if (window->flags & SDL_WINDOW_HIDDEN) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags |= SDL_WINDOW_HIDDEN;
|
window->flags |= SDL_WINDOW_HIDDEN;
|
||||||
SDL_OnWindowHidden(window);
|
SDL_OnWindowHidden(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_EVENT_WINDOW_MOVED:
|
||||||
if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
|
if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
|
||||||
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
|
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -113,7 +113,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
window->y = data2;
|
window->y = data2;
|
||||||
SDL_OnWindowMoved(window);
|
SDL_OnWindowMoved(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
|
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||||
window->windowed.w = data1;
|
window->windowed.w = data1;
|
||||||
window->windowed.h = data2;
|
window->windowed.h = data2;
|
||||||
|
@ -125,7 +125,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
window->h = data2;
|
window->h = data2;
|
||||||
SDL_OnWindowResized(window);
|
SDL_OnWindowResized(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MINIMIZED:
|
case SDL_EVENT_WINDOW_MINIMIZED:
|
||||||
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -133,49 +133,49 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
window->flags |= SDL_WINDOW_MINIMIZED;
|
window->flags |= SDL_WINDOW_MINIMIZED;
|
||||||
SDL_OnWindowMinimized(window);
|
SDL_OnWindowMinimized(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
case SDL_EVENT_WINDOW_MAXIMIZED:
|
||||||
if (window->flags & SDL_WINDOW_MAXIMIZED) {
|
if (window->flags & SDL_WINDOW_MAXIMIZED) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags &= ~SDL_WINDOW_MINIMIZED;
|
window->flags &= ~SDL_WINDOW_MINIMIZED;
|
||||||
window->flags |= SDL_WINDOW_MAXIMIZED;
|
window->flags |= SDL_WINDOW_MAXIMIZED;
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESTORED:
|
case SDL_EVENT_WINDOW_RESTORED:
|
||||||
if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
|
if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED);
|
window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED);
|
||||||
SDL_OnWindowRestored(window);
|
SDL_OnWindowRestored(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_ENTER:
|
case SDL_EVENT_WINDOW_MOUSE_ENTER:
|
||||||
if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
|
if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags |= SDL_WINDOW_MOUSE_FOCUS;
|
window->flags |= SDL_WINDOW_MOUSE_FOCUS;
|
||||||
SDL_OnWindowEnter(window);
|
SDL_OnWindowEnter(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_LEAVE:
|
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||||
if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
|
if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
|
window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
|
||||||
SDL_OnWindowLeave(window);
|
SDL_OnWindowLeave(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||||
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
|
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags |= SDL_WINDOW_INPUT_FOCUS;
|
window->flags |= SDL_WINDOW_INPUT_FOCUS;
|
||||||
SDL_OnWindowFocusGained(window);
|
SDL_OnWindowFocusGained(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
||||||
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
window->flags &= ~SDL_WINDOW_INPUT_FOCUS;
|
window->flags &= ~SDL_WINDOW_INPUT_FOCUS;
|
||||||
SDL_OnWindowFocusLost(window);
|
SDL_OnWindowFocusLost(window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_DISPLAY_CHANGED:
|
case SDL_EVENT_WINDOW_DISPLAY_CHANGED:
|
||||||
SDL_assert(data1 == window->display_index);
|
SDL_assert(data1 == window->display_index);
|
||||||
SDL_OnWindowDisplayChanged(window);
|
SDL_OnWindowDisplayChanged(window);
|
||||||
break;
|
break;
|
||||||
|
@ -194,33 +194,33 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
event.window.windowID = window->id;
|
event.window.windowID = window->id;
|
||||||
|
|
||||||
/* Fixes queue overflow with resize events that aren't processed */
|
/* 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. */
|
/* !!! 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;
|
RemovePendingSizeChangedAndResizedEvents_Data userdata;
|
||||||
userdata.new_event = &event;
|
userdata.new_event = &event;
|
||||||
userdata.saw_resized = SDL_FALSE;
|
userdata.saw_resized = SDL_FALSE;
|
||||||
SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &userdata);
|
SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &userdata);
|
||||||
if (userdata.saw_resized) { /* if there was a pending resize, make sure one at the new dimensions remains. */
|
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) {
|
if (SDL_PushEvent(&event) <= 0) {
|
||||||
return 0; /* oh well. */
|
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);
|
SDL_FilterEvents(RemovePendingMoveEvents, &event);
|
||||||
}
|
}
|
||||||
if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
|
if (windowevent == SDL_EVENT_WINDOW_EXPOSED) {
|
||||||
SDL_FilterEvents(RemovePendingExposedEvents, &event);
|
SDL_FilterEvents(RemovePendingExposedEvents, &event);
|
||||||
}
|
}
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowevent == SDL_WINDOWEVENT_CLOSE) {
|
if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
|
||||||
if (!window->prev && !window->next) {
|
if (!window->prev && !window->next) {
|
||||||
if (SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, SDL_TRUE)) {
|
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 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
||||||
SDL_Gamepad *gamepad;
|
SDL_Gamepad *gamepad;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
|
||||||
{
|
{
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
|
@ -389,8 +389,8 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||||
{
|
{
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_EVENT_JOYSTICK_HAT_MOTION:
|
||||||
{
|
{
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
|
@ -412,18 +412,18 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SDL_JOYDEVICEADDED:
|
case SDL_EVENT_JOYSTICK_ADDED:
|
||||||
{
|
{
|
||||||
if (SDL_IsGamepad(event->jdevice.which)) {
|
if (SDL_IsGamepad(event->jdevice.which)) {
|
||||||
SDL_Event deviceevent;
|
SDL_Event deviceevent;
|
||||||
|
|
||||||
deviceevent.type = SDL_GAMEPADADDED;
|
deviceevent.type = SDL_EVENT_GAMEPAD_ADDED;
|
||||||
deviceevent.common.timestamp = 0;
|
deviceevent.common.timestamp = 0;
|
||||||
deviceevent.cdevice.which = event->jdevice.which;
|
deviceevent.cdevice.which = event->jdevice.which;
|
||||||
SDL_PushEvent(&deviceevent);
|
SDL_PushEvent(&deviceevent);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SDL_JOYDEVICEREMOVED:
|
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||||
{
|
{
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
||||||
{
|
{
|
||||||
SDL_Event deviceevent;
|
SDL_Event deviceevent;
|
||||||
|
|
||||||
deviceevent.type = SDL_GAMEPADREMOVED;
|
deviceevent.type = SDL_EVENT_GAMEPAD_REMOVED;
|
||||||
deviceevent.common.timestamp = 0;
|
deviceevent.common.timestamp = 0;
|
||||||
deviceevent.cdevice.which = event->jdevice.which;
|
deviceevent.cdevice.which = event->jdevice.which;
|
||||||
SDL_PushEvent(&deviceevent);
|
SDL_PushEvent(&deviceevent);
|
||||||
|
@ -1215,7 +1215,7 @@ static void SDL_PrivateRefreshGamepadMapping(GamepadMapping_t *pGamepadMapping)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
event.type = SDL_GAMEPADREMAPPED;
|
event.type = SDL_EVENT_GAMEPAD_REMAPPED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.cdevice.which = gamepad->joystick->instance_id;
|
event.cdevice.which = gamepad->joystick->instance_id;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
|
@ -1902,7 +1902,7 @@ int SDL_InitGamepads(void)
|
||||||
for (i = 0; joysticks[i]; ++i) {
|
for (i = 0; joysticks[i]; ++i) {
|
||||||
if (SDL_IsGamepad(joysticks[i])) {
|
if (SDL_IsGamepad(joysticks[i])) {
|
||||||
SDL_Event deviceevent;
|
SDL_Event deviceevent;
|
||||||
deviceevent.type = SDL_GAMEPADADDED;
|
deviceevent.type = SDL_EVENT_GAMEPAD_ADDED;
|
||||||
deviceevent.common.timestamp = 0;
|
deviceevent.common.timestamp = 0;
|
||||||
deviceevent.cdevice.which = joysticks[i];
|
deviceevent.cdevice.which = joysticks[i];
|
||||||
SDL_PushEvent(&deviceevent);
|
SDL_PushEvent(&deviceevent);
|
||||||
|
@ -3058,9 +3058,9 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
|
||||||
/* translate the event, if desired */
|
/* translate the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_GAMEPADAXISMOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_GAMEPADAXISMOTION;
|
event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.caxis.which = gamepad->joystick->instance_id;
|
event.caxis.which = gamepad->joystick->instance_id;
|
||||||
event.caxis.axis = axis;
|
event.caxis.axis = axis;
|
||||||
|
@ -3088,10 +3088,10 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SDL_PRESSED:
|
case SDL_PRESSED:
|
||||||
event.type = SDL_GAMEPADBUTTONDOWN;
|
event.type = SDL_EVENT_GAMEPAD_BUTTON_DOWN;
|
||||||
break;
|
break;
|
||||||
case SDL_RELEASED:
|
case SDL_RELEASED:
|
||||||
event.type = SDL_GAMEPADBUTTONUP;
|
event.type = SDL_EVENT_GAMEPAD_BUTTON_UP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Invalid state -- bail */
|
/* 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[] = {
|
static const Uint32 SDL_gamepad_event_list[] = {
|
||||||
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,
|
||||||
};
|
};
|
||||||
|
|
||||||
void SDL_SetGamepadEventsEnabled(SDL_bool enabled)
|
void SDL_SetGamepadEventsEnabled(SDL_bool enabled)
|
||||||
|
|
|
@ -1403,7 +1403,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
event.type = SDL_JOYDEVICEADDED;
|
event.type = SDL_EVENT_JOYSTICK_ADDED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
|
|
||||||
if (SDL_EventEnabled(event.type)) {
|
if (SDL_EventEnabled(event.type)) {
|
||||||
|
@ -1465,7 +1465,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
event.type = SDL_JOYDEVICEREMOVED;
|
event.type = SDL_EVENT_JOYSTICK_REMOVED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
|
|
||||||
if (SDL_EventEnabled(event.type)) {
|
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 */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_JOYAXISMOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_JOYAXISMOTION;
|
event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.jaxis.which = joystick->instance_id;
|
event.jaxis.which = joystick->instance_id;
|
||||||
event.jaxis.axis = axis;
|
event.jaxis.axis = axis;
|
||||||
|
@ -1576,9 +1576,9 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_JOYHATMOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_JOYHATMOTION;
|
event.type = SDL_EVENT_JOYSTICK_HAT_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.jhat.which = joystick->instance_id;
|
event.jhat.which = joystick->instance_id;
|
||||||
event.jhat.hat = hat;
|
event.jhat.hat = hat;
|
||||||
|
@ -1599,10 +1599,10 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SDL_PRESSED:
|
case SDL_PRESSED:
|
||||||
event.type = SDL_JOYBUTTONDOWN;
|
event.type = SDL_EVENT_JOYSTICK_BUTTON_DOWN;
|
||||||
break;
|
break;
|
||||||
case SDL_RELEASED:
|
case SDL_RELEASED:
|
||||||
event.type = SDL_JOYBUTTONUP;
|
event.type = SDL_EVENT_JOYSTICK_BUTTON_UP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Invalid state -- bail */
|
/* Invalid state -- bail */
|
||||||
|
@ -1701,13 +1701,13 @@ void SDL_UpdateJoysticks(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Uint32 SDL_joystick_event_list[] = {
|
static const Uint32 SDL_joystick_event_list[] = {
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
void SDL_SetJoystickEventsEnabled(SDL_bool enabled)
|
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 */
|
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
|
||||||
if (ePowerLevel != joystick->epowerlevel) {
|
if (ePowerLevel != joystick->epowerlevel) {
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_JOYBATTERYUPDATED)) {
|
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_JOYBATTERYUPDATED;
|
event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
event.jbattery.which = joystick->instance_id;
|
event.jbattery.which = joystick->instance_id;
|
||||||
event.jbattery.level = ePowerLevel;
|
event.jbattery.level = ePowerLevel;
|
||||||
|
@ -2914,16 +2914,16 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == finger_info->state) {
|
if (state == finger_info->state) {
|
||||||
event_type = SDL_GAMEPADTOUCHPADMOTION;
|
event_type = SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION;
|
||||||
} else if (state) {
|
} else if (state) {
|
||||||
event_type = SDL_GAMEPADTOUCHPADDOWN;
|
event_type = SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN;
|
||||||
} else {
|
} 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 */
|
/* We ignore events if we don't have keyboard focus, except for touch release */
|
||||||
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
|
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
|
||||||
if (event_type != SDL_GAMEPADTOUCHPADUP) {
|
if (event_type != SDL_EVENT_GAMEPAD_TOUCHPAD_UP) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2977,9 +2977,9 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT
|
||||||
|
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_GAMEPADSENSORUPDATE)) {
|
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_GAMEPADSENSORUPDATE;
|
event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.csensor.which = joystick->instance_id;
|
event.csensor.which = joystick->instance_id;
|
||||||
event.csensor.sensor = type;
|
event.csensor.sensor = type;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
/* as a courtesy to iOS apps, we don't try to draw when in the background, as
|
/* 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
|
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,
|
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
|
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. */
|
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;
|
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);
|
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
|
||||||
if (window == renderer->window) {
|
if (window == renderer->window) {
|
||||||
if (renderer->WindowEvent) {
|
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,
|
* 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.
|
* we need to update the viewport for the new window/drawable ratio.
|
||||||
*/
|
*/
|
||||||
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
|
||||||
event->type == SDL_WINDOWEVENT_DISPLAY_CHANGED) {
|
event->type == SDL_EVENT_WINDOW_DISPLAY_CHANGED) {
|
||||||
/* Make sure we're operating on the default render target */
|
/* Make sure we're operating on the default render target */
|
||||||
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
|
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
|
||||||
if (saved_target) {
|
if (saved_target) {
|
||||||
|
@ -737,22 +737,22 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||||
if (saved_target) {
|
if (saved_target) {
|
||||||
SDL_SetRenderTarget(renderer, 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;
|
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)) {
|
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) {
|
||||||
renderer->hidden = SDL_FALSE;
|
renderer->hidden = SDL_FALSE;
|
||||||
}
|
}
|
||||||
} else if (event->type == SDL_WINDOWEVENT_MINIMIZED) {
|
} else if (event->type == SDL_EVENT_WINDOW_MINIMIZED) {
|
||||||
renderer->hidden = SDL_TRUE;
|
renderer->hidden = SDL_TRUE;
|
||||||
} else if (event->type == SDL_WINDOWEVENT_RESTORED ||
|
} else if (event->type == SDL_EVENT_WINDOW_RESTORED ||
|
||||||
event->type == SDL_WINDOWEVENT_MAXIMIZED) {
|
event->type == SDL_EVENT_WINDOW_MAXIMIZED) {
|
||||||
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) {
|
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) {
|
||||||
renderer->hidden = SDL_FALSE;
|
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);
|
SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID);
|
||||||
if (window == renderer->window) {
|
if (window == renderer->window) {
|
||||||
int logical_w, logical_h;
|
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 ||
|
} else if (event->type == SDL_EVENT_MOUSE_BUTTONDOWN ||
|
||||||
event->type == SDL_MOUSEBUTTONUP) {
|
event->type == SDL_EVENT_MOUSE_BUTTONUP) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
|
||||||
if (window == renderer->window) {
|
if (window == renderer->window) {
|
||||||
int logical_w, logical_h;
|
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);
|
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);
|
SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
|
||||||
if (window == renderer->window) {
|
if (window == renderer->window) {
|
||||||
int logical_w, logical_h;
|
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);
|
event->wheel.mouseY /= (scale.y * renderer->dpi_scale.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event->type == SDL_FINGERDOWN ||
|
} else if (event->type == SDL_EVENT_FINGER_DOWN ||
|
||||||
event->type == SDL_FINGERUP ||
|
event->type == SDL_EVENT_FINGER_UP ||
|
||||||
event->type == SDL_FINGERMOTION) {
|
event->type == SDL_EVENT_FINGER_MOTION) {
|
||||||
int logical_w, logical_h;
|
int logical_w, logical_h;
|
||||||
float physical_w, physical_h;
|
float physical_w, physical_h;
|
||||||
SDL_DRect viewport;
|
SDL_DRect viewport;
|
||||||
|
|
|
@ -331,7 +331,7 @@ static void D3D_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
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;
|
data->updateSize = SDL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1518,7 +1518,7 @@ static int D3D_Reset(SDL_Renderer *renderer)
|
||||||
/* Let the application know that render targets were reset */
|
/* Let the application know that render targets were reset */
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_RENDER_TARGETS_RESET;
|
event.type = SDL_EVENT_RENDER_TARGETS_RESET;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -873,7 +873,7 @@ D3D11_HandleDeviceLost(SDL_Renderer *renderer)
|
||||||
/* Let the application know that the device has been reset */
|
/* Let the application know that the device has been reset */
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_RENDER_DEVICE_RESET;
|
event.type = SDL_EVENT_RENDER_DEVICE_RESET;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
@ -1028,7 +1028,7 @@ void D3D11_Trim(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D11_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
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);
|
D3D11_UpdateForWindowSizeChange(renderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,7 +1231,7 @@ D3D12_HandleDeviceLost(SDL_Renderer *renderer)
|
||||||
/* Let the application know that the device has been reset */
|
/* Let the application know that the device has been reset */
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_RENDER_DEVICE_RESET;
|
event.type = SDL_EVENT_RENDER_DEVICE_RESET;
|
||||||
event.common.timestamp = 0;
|
event.common.timestamp = 0;
|
||||||
SDL_PushEvent(&event);
|
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)
|
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);
|
D3D12_UpdateForWindowSizeChange(renderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* changed behind our backs. x/y changes might seem weird but viewport
|
||||||
* resets have been observed on macOS at minimum!
|
* resets have been observed on macOS at minimum!
|
||||||
*/
|
*/
|
||||||
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED ||
|
||||||
event->type == SDL_WINDOWEVENT_MOVED) {
|
event->type == SDL_EVENT_WINDOW_MOVED) {
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
||||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ static void GLES2_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *eve
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
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! */
|
/* According to Apple documentation, we need to finish drawing NOW! */
|
||||||
data->glFinish();
|
data->glFinish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
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->surface = NULL;
|
||||||
data->window = NULL;
|
data->window = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,9 +485,9 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim
|
||||||
/* Post the event, if desired */
|
/* Post the event, if desired */
|
||||||
posted = 0;
|
posted = 0;
|
||||||
#if !SDL_EVENTS_DISABLED
|
#if !SDL_EVENTS_DISABLED
|
||||||
if (SDL_EventEnabled(SDL_SENSORUPDATE)) {
|
if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_SENSORUPDATE;
|
event.type = SDL_EVENT_SENSOR_UPDATE;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.sensor.which = sensor->instance_id;
|
event.sensor.which = sensor->instance_id;
|
||||||
num_values = SDL_min(num_values, SDL_arraysize(event.sensor.data));
|
num_values = SDL_min(num_values, SDL_arraysize(event.sensor.data));
|
||||||
|
|
|
@ -1427,136 +1427,136 @@ static const char *GamepadButtonName(const SDL_GamepadButton button)
|
||||||
static void SDLTest_PrintEvent(SDL_Event *event)
|
static void SDLTest_PrintEvent(SDL_Event *event)
|
||||||
{
|
{
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_DISPLAYEVENT_CONNECTED:
|
case SDL_EVENT_DISPLAY_CONNECTED:
|
||||||
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " connected",
|
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " connected",
|
||||||
event->display.display);
|
event->display.display);
|
||||||
break;
|
break;
|
||||||
case SDL_DISPLAYEVENT_MOVED:
|
case SDL_EVENT_DISPLAY_MOVED:
|
||||||
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed position",
|
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed position",
|
||||||
event->display.display);
|
event->display.display);
|
||||||
break;
|
break;
|
||||||
case SDL_DISPLAYEVENT_ORIENTATION:
|
case SDL_EVENT_DISPLAY_ORIENTATION:
|
||||||
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed orientation to %s",
|
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed orientation to %s",
|
||||||
event->display.display, DisplayOrientationName(event->display.data1));
|
event->display.display, DisplayOrientationName(event->display.data1));
|
||||||
break;
|
break;
|
||||||
case SDL_DISPLAYEVENT_DISCONNECTED:
|
case SDL_EVENT_DISPLAY_DISCONNECTED:
|
||||||
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " disconnected",
|
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " disconnected",
|
||||||
event->display.display);
|
event->display.display);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_SHOWN:
|
case SDL_EVENT_WINDOW_SHOWN:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " shown", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " shown", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_HIDDEN:
|
case SDL_EVENT_WINDOW_HIDDEN:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hidden", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hidden", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_EXPOSED:
|
case SDL_EVENT_WINDOW_EXPOSED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " exposed", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " exposed", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_EVENT_WINDOW_MOVED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32,
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32,
|
||||||
event->window.windowID, event->window.data1, event->window.data2);
|
event->window.windowID, event->window.data1, event->window.data2);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32,
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32,
|
||||||
event->window.windowID, event->window.data1, event->window.data2);
|
event->window.windowID, event->window.data1, event->window.data2);
|
||||||
break;
|
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,
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed size to %" SDL_PRIs32 "x%" SDL_PRIs32,
|
||||||
event->window.windowID, event->window.data1, event->window.data2);
|
event->window.windowID, event->window.data1, event->window.data2);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MINIMIZED:
|
case SDL_EVENT_WINDOW_MINIMIZED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " minimized", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " minimized", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
case SDL_EVENT_WINDOW_MAXIMIZED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " maximized", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " maximized", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESTORED:
|
case SDL_EVENT_WINDOW_RESTORED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " restored", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " restored", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_ENTER:
|
case SDL_EVENT_WINDOW_MOUSE_ENTER:
|
||||||
SDL_Log("SDL EVENT: Mouse entered window %" SDL_PRIu32 "",
|
SDL_Log("SDL EVENT: Mouse entered window %" SDL_PRIu32 "",
|
||||||
event->window.windowID);
|
event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_LEAVE:
|
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||||
SDL_Log("SDL EVENT: Mouse left window %" SDL_PRIu32 "", event->window.windowID);
|
SDL_Log("SDL EVENT: Mouse left window %" SDL_PRIu32 "", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " gained keyboard focus",
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " gained keyboard focus",
|
||||||
event->window.windowID);
|
event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " lost keyboard focus",
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " lost keyboard focus",
|
||||||
event->window.windowID);
|
event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " closed", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " closed", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_TAKE_FOCUS:
|
case SDL_EVENT_WINDOW_TAKE_FOCUS:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " take focus", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " take focus", event->window.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_HIT_TEST:
|
case SDL_EVENT_WINDOW_HIT_TEST:
|
||||||
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hit test", event->window.windowID);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " hit test", event->window.windowID);
|
||||||
break;
|
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);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " ICC profile changed", event->window.windowID);
|
||||||
break;
|
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);
|
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display changed to %" SDL_PRIs32 "", event->window.windowID, event->window.data1);
|
||||||
break;
|
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",
|
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.windowID,
|
||||||
event->key.keysym.scancode,
|
event->key.keysym.scancode,
|
||||||
SDL_GetScancodeName(event->key.keysym.scancode),
|
SDL_GetScancodeName(event->key.keysym.scancode),
|
||||||
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
|
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
|
||||||
break;
|
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",
|
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.windowID,
|
||||||
event->key.keysym.scancode,
|
event->key.keysym.scancode,
|
||||||
SDL_GetScancodeName(event->key.keysym.scancode),
|
SDL_GetScancodeName(event->key.keysym.scancode),
|
||||||
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
|
event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTEDITING:
|
case SDL_EVENT_TEXT_EDITING:
|
||||||
SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %" SDL_PRIu32,
|
SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %" SDL_PRIu32,
|
||||||
event->edit.text, event->edit.windowID);
|
event->edit.text, event->edit.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT:
|
case SDL_EVENT_TEXT_INPUT:
|
||||||
SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %" SDL_PRIu32,
|
SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %" SDL_PRIu32,
|
||||||
event->text.text, event->text.windowID);
|
event->text.text, event->text.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_KEYMAPCHANGED:
|
case SDL_EVENT_KEYMAP_CHANGED:
|
||||||
SDL_Log("SDL EVENT: Keymap changed");
|
SDL_Log("SDL EVENT: Keymap changed");
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
SDL_Log("SDL EVENT: Mouse: moved to %g,%g (%g,%g) in window %" SDL_PRIu32,
|
SDL_Log("SDL EVENT: Mouse: moved to %g,%g (%g,%g) in window %" SDL_PRIu32,
|
||||||
event->motion.x, event->motion.y,
|
event->motion.x, event->motion.y,
|
||||||
event->motion.xrel, event->motion.yrel,
|
event->motion.xrel, event->motion.yrel,
|
||||||
event->motion.windowID);
|
event->motion.windowID);
|
||||||
break;
|
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,
|
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.button, event->button.x, event->button.y, event->button.clicks,
|
||||||
event->button.windowID);
|
event->button.windowID);
|
||||||
break;
|
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,
|
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.button, event->button.x, event->button.y, event->button.clicks,
|
||||||
event->button.windowID);
|
event->button.windowID);
|
||||||
break;
|
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,
|
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);
|
event->wheel.x, event->wheel.y, event->wheel.direction, event->wheel.windowID);
|
||||||
break;
|
break;
|
||||||
case SDL_JOYDEVICEADDED:
|
case SDL_EVENT_JOYSTICK_ADDED:
|
||||||
SDL_Log("SDL EVENT: Joystick index %" SDL_PRIu32 " attached",
|
SDL_Log("SDL EVENT: Joystick index %" SDL_PRIu32 " attached",
|
||||||
event->jdevice.which);
|
event->jdevice.which);
|
||||||
break;
|
break;
|
||||||
case SDL_JOYDEVICEREMOVED:
|
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||||
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 " removed",
|
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 " removed",
|
||||||
event->jdevice.which);
|
event->jdevice.which);
|
||||||
break;
|
break;
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_EVENT_JOYSTICK_HAT_MOTION:
|
||||||
{
|
{
|
||||||
const char *position = "UNKNOWN";
|
const char *position = "UNKNOWN";
|
||||||
switch (event->jhat.value) {
|
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",
|
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": hat %d moved to %s",
|
||||||
event->jhat.which, event->jhat.hat, position);
|
event->jhat.which, event->jhat.hat, position);
|
||||||
} break;
|
} break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||||
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d pressed",
|
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d pressed",
|
||||||
event->jbutton.which, event->jbutton.button);
|
event->jbutton.which, event->jbutton.button);
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||||
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d released",
|
SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": button %d released",
|
||||||
event->jbutton.which, event->jbutton.button);
|
event->jbutton.which, event->jbutton.button);
|
||||||
break;
|
break;
|
||||||
case SDL_GAMEPADADDED:
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
SDL_Log("SDL EVENT: Gamepad index %" SDL_PRIu32 " attached",
|
SDL_Log("SDL EVENT: Gamepad index %" SDL_PRIu32 " attached",
|
||||||
event->cdevice.which);
|
event->cdevice.which);
|
||||||
break;
|
break;
|
||||||
case SDL_GAMEPADREMOVED:
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " removed",
|
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " removed",
|
||||||
event->cdevice.which);
|
event->cdevice.which);
|
||||||
break;
|
break;
|
||||||
case SDL_GAMEPADAXISMOTION:
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " axis %d ('%s') value: %d",
|
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " axis %d ('%s') value: %d",
|
||||||
event->caxis.which,
|
event->caxis.which,
|
||||||
event->caxis.axis,
|
event->caxis.axis,
|
||||||
GamepadAxisName((SDL_GamepadAxis)event->caxis.axis),
|
GamepadAxisName((SDL_GamepadAxis)event->caxis.axis),
|
||||||
event->caxis.value);
|
event->caxis.value);
|
||||||
break;
|
break;
|
||||||
case SDL_GAMEPADBUTTONDOWN:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 "button %d ('%s') down",
|
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 "button %d ('%s') down",
|
||||||
event->cbutton.which, event->cbutton.button,
|
event->cbutton.which, event->cbutton.button,
|
||||||
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
|
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
|
||||||
break;
|
break;
|
||||||
case SDL_GAMEPADBUTTONUP:
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " button %d ('%s') up",
|
SDL_Log("SDL EVENT: Gamepad %" SDL_PRIu32 " button %d ('%s') up",
|
||||||
event->cbutton.which, event->cbutton.button,
|
event->cbutton.which, event->cbutton.button,
|
||||||
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
|
GamepadButtonName((SDL_GamepadButton)event->cbutton.button));
|
||||||
break;
|
break;
|
||||||
case SDL_CLIPBOARDUPDATE:
|
case SDL_EVENT_CLIPBOARD_UPDATE:
|
||||||
SDL_Log("SDL EVENT: Clipboard updated");
|
SDL_Log("SDL EVENT: Clipboard updated");
|
||||||
break;
|
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",
|
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.touchId,
|
||||||
(long)event->tfinger.fingerId,
|
(long)event->tfinger.fingerId,
|
||||||
event->tfinger.x, event->tfinger.y,
|
event->tfinger.x, event->tfinger.y,
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
case SDL_FINGERUP:
|
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",
|
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.touchId,
|
||||||
(long)event->tfinger.fingerId,
|
(long)event->tfinger.fingerId,
|
||||||
event->tfinger.x, event->tfinger.y,
|
event->tfinger.x, event->tfinger.y,
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_RENDER_DEVICE_RESET:
|
case SDL_EVENT_RENDER_DEVICE_RESET:
|
||||||
SDL_Log("SDL EVENT: render device reset");
|
SDL_Log("SDL EVENT: render device reset");
|
||||||
break;
|
break;
|
||||||
case SDL_RENDER_TARGETS_RESET:
|
case SDL_EVENT_RENDER_TARGETS_RESET:
|
||||||
SDL_Log("SDL EVENT: render targets reset");
|
SDL_Log("SDL EVENT: render targets reset");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_APP_TERMINATING:
|
case SDL_EVENT_TERMINATING:
|
||||||
SDL_Log("SDL EVENT: App terminating");
|
SDL_Log("SDL EVENT: App terminating");
|
||||||
break;
|
break;
|
||||||
case SDL_APP_LOWMEMORY:
|
case SDL_EVENT_LOW_MEMORY:
|
||||||
SDL_Log("SDL EVENT: App running low on memory");
|
SDL_Log("SDL EVENT: App running low on memory");
|
||||||
break;
|
break;
|
||||||
case SDL_APP_WILLENTERBACKGROUND:
|
case SDL_EVENT_WILL_ENTER_BACKGROUND:
|
||||||
SDL_Log("SDL EVENT: App will enter the background");
|
SDL_Log("SDL EVENT: App will enter the background");
|
||||||
break;
|
break;
|
||||||
case SDL_APP_DIDENTERBACKGROUND:
|
case SDL_EVENT_DID_ENTER_BACKGROUND:
|
||||||
SDL_Log("SDL EVENT: App entered the background");
|
SDL_Log("SDL EVENT: App entered the background");
|
||||||
break;
|
break;
|
||||||
case SDL_APP_WILLENTERFOREGROUND:
|
case SDL_EVENT_WILL_ENTER_FOREGROUND:
|
||||||
SDL_Log("SDL EVENT: App will enter the foreground");
|
SDL_Log("SDL EVENT: App will enter the foreground");
|
||||||
break;
|
break;
|
||||||
case SDL_APP_DIDENTERFOREGROUND:
|
case SDL_EVENT_DID_ENTER_FOREGROUND:
|
||||||
SDL_Log("SDL EVENT: App entered the foreground");
|
SDL_Log("SDL EVENT: App entered the foreground");
|
||||||
break;
|
break;
|
||||||
case SDL_DROPBEGIN:
|
case SDL_EVENT_DROP_BEGIN:
|
||||||
SDL_Log("SDL EVENT: Drag and drop beginning");
|
SDL_Log("SDL EVENT: Drag and drop beginning");
|
||||||
break;
|
break;
|
||||||
case SDL_DROPFILE:
|
case SDL_EVENT_DROP_FILE:
|
||||||
SDL_Log("SDL EVENT: Drag and drop file: '%s'", event->drop.file);
|
SDL_Log("SDL EVENT: Drag and drop file: '%s'", event->drop.file);
|
||||||
break;
|
break;
|
||||||
case SDL_DROPTEXT:
|
case SDL_EVENT_DROP_TEXT:
|
||||||
SDL_Log("SDL EVENT: Drag and drop text: '%s'", event->drop.file);
|
SDL_Log("SDL EVENT: Drag and drop text: '%s'", event->drop.file);
|
||||||
break;
|
break;
|
||||||
case SDL_DROPCOMPLETE:
|
case SDL_EVENT_DROP_COMPLETE:
|
||||||
SDL_Log("SDL EVENT: Drag and drop ending");
|
SDL_Log("SDL EVENT: Drag and drop ending");
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
SDL_Log("SDL EVENT: Quit requested");
|
SDL_Log("SDL EVENT: Quit requested");
|
||||||
break;
|
break;
|
||||||
case SDL_USEREVENT:
|
case SDL_EVENT_USER:
|
||||||
SDL_Log("SDL EVENT: User event %" SDL_PRIs32, event->user.code);
|
SDL_Log("SDL EVENT: User event %" SDL_PRIs32, event->user.code);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1753,15 +1753,15 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
|
||||||
static SDL_MouseMotionEvent lastEvent;
|
static SDL_MouseMotionEvent lastEvent;
|
||||||
|
|
||||||
if (state->verbose & VERBOSE_EVENT) {
|
if (state->verbose & VERBOSE_EVENT) {
|
||||||
if (((event->type != SDL_MOUSEMOTION) &&
|
if (((event->type != SDL_EVENT_MOUSE_MOTION) &&
|
||||||
(event->type != SDL_FINGERMOTION)) ||
|
(event->type != SDL_EVENT_FINGER_MOTION)) ||
|
||||||
((state->verbose & VERBOSE_MOTION) != 0)) {
|
((state->verbose & VERBOSE_MOTION) != 0)) {
|
||||||
SDLTest_PrintEvent(event);
|
SDLTest_PrintEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||||
{
|
{
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
|
||||||
if (window) {
|
if (window) {
|
||||||
|
@ -1782,7 +1782,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
||||||
if (state->flash_on_focus_loss) {
|
if (state->flash_on_focus_loss) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
|
||||||
if (window) {
|
if (window) {
|
||||||
|
@ -1790,7 +1790,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
{
|
{
|
||||||
SDL_bool withControl = !!(event->key.keysym.mod & SDL_KMOD_CTRL);
|
SDL_bool withControl = !!(event->key.keysym.mod & SDL_KMOD_CTRL);
|
||||||
SDL_bool withShift = !!(event->key.keysym.mod & SDL_KMOD_SHIFT);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
*done = 1;
|
*done = 1;
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
lastEvent = event->motion;
|
lastEvent = event->motion;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_DROPFILE:
|
case SDL_EVENT_DROP_FILE:
|
||||||
case SDL_DROPTEXT:
|
case SDL_EVENT_DROP_TEXT:
|
||||||
SDL_free(event->drop.file);
|
SDL_free(event->drop.file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -618,7 +618,7 @@ int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (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 {
|
} else {
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
|
@ -632,7 +632,7 @@ void SDL_DelVideoDisplay(int index)
|
||||||
return;
|
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)) {
|
if (index < (_this->num_displays - 1)) {
|
||||||
SDL_free(_this->displays[index].driverdata);
|
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,
|
* 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.
|
* 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
|
#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,
|
/* 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.
|
* 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);
|
fullscreen_mode.w, fullscreen_mode.h);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -1499,7 +1499,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
|
|
||||||
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
|
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_TRUE;
|
||||||
}
|
}
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
@ -2299,7 +2299,7 @@ void SDL_SetWindowSize(SDL_Window *window, int w, int h)
|
||||||
_this->SetWindowSize(_this, window);
|
_this->SetWindowSize(_this, window);
|
||||||
}
|
}
|
||||||
if (window->w != old_w || window->h != old_h) {
|
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);
|
SDL_OnWindowResized(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2458,7 +2458,7 @@ void SDL_ShowWindow(SDL_Window *window)
|
||||||
if (_this->ShowWindow) {
|
if (_this->ShowWindow) {
|
||||||
_this->ShowWindow(_this, window);
|
_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)
|
void SDL_HideWindow(SDL_Window *window)
|
||||||
|
@ -2476,7 +2476,7 @@ void SDL_HideWindow(SDL_Window *window)
|
||||||
_this->HideWindow(_this, window);
|
_this->HideWindow(_this, window);
|
||||||
}
|
}
|
||||||
window->is_hiding = SDL_FALSE;
|
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)
|
void SDL_RaiseWindow(SDL_Window *window)
|
||||||
|
@ -2969,11 +2969,11 @@ void SDL_OnWindowResized(SDL_Window *window)
|
||||||
window->surface_valid = SDL_FALSE;
|
window->surface_valid = SDL_FALSE;
|
||||||
|
|
||||||
if (!window->is_destroying) {
|
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) {
|
if (display_index != window->display_index && display_index != -1) {
|
||||||
window->display_index = display_index;
|
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) {
|
if (!window->is_destroying && display_index != window->display_index && display_index != -1) {
|
||||||
window->display_index = display_index;
|
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;
|
SDL_Window *window;
|
||||||
|
|
||||||
/* First, enable text events */
|
/* First, enable text events */
|
||||||
SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_TRUE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_TRUE);
|
||||||
SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_TRUE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_TRUE);
|
||||||
|
|
||||||
/* Then show the on-screen keyboard, if any */
|
/* Then show the on-screen keyboard, if any */
|
||||||
window = SDL_GetFocusWindow();
|
window = SDL_GetFocusWindow();
|
||||||
|
@ -4293,7 +4293,7 @@ SDL_bool SDL_TextInputShown(void)
|
||||||
|
|
||||||
SDL_bool SDL_TextInputActive(void)
|
SDL_bool SDL_TextInputActive(void)
|
||||||
{
|
{
|
||||||
return SDL_EventEnabled(SDL_TEXTINPUT);
|
return SDL_EventEnabled(SDL_EVENT_TEXT_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_StopTextInput(void)
|
void SDL_StopTextInput(void)
|
||||||
|
@ -4312,8 +4312,8 @@ void SDL_StopTextInput(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally disable text events */
|
/* Finally disable text events */
|
||||||
SDL_SetEventEnabled(SDL_TEXTINPUT, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_FALSE);
|
||||||
SDL_SetEventEnabled(SDL_TEXTEDITING, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_SetTextInputRect(const SDL_Rect *rect)
|
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)
|
void SDL_OnApplicationWillTerminate(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationDidReceiveMemoryWarning(void)
|
void SDL_OnApplicationDidReceiveMemoryWarning(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
SDL_SendAppEvent(SDL_EVENT_LOW_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationWillResignActive(void)
|
void SDL_OnApplicationWillResignActive(void)
|
||||||
|
@ -4613,32 +4613,32 @@ void SDL_OnApplicationWillResignActive(void)
|
||||||
if (_this) {
|
if (_this) {
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
for (window = _this->windows; window != NULL; window = window->next) {
|
for (window = _this->windows; window != NULL; window = window->next) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 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)
|
void SDL_OnApplicationDidEnterBackground(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationWillEnterForeground(void)
|
void SDL_OnApplicationWillEnterForeground(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationDidBecomeActive(void)
|
void SDL_OnApplicationDidBecomeActive(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||||
|
|
||||||
if (_this) {
|
if (_this) {
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
for (window = _this->windows; window != NULL; window = window->next) {
|
for (window = _this->windows; window != NULL; window = window->next) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void android_egl_context_restore(SDL_Window *window)
|
||||||
/* The context is no longer valid, create a new one */
|
/* The context is no longer valid, create a new one */
|
||||||
data->egl_context = (EGLContext)SDL_GL_CreateContext(window);
|
data->egl_context = (EGLContext)SDL_GL_CreateContext(window);
|
||||||
SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context);
|
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;
|
event.common.timestamp = 0;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
@ -130,9 +130,9 @@ void Android_PumpEvents_Blocking(_THIS)
|
||||||
videodata->isPaused = 0;
|
videodata->isPaused = 0;
|
||||||
|
|
||||||
/* Android_ResumeSem was signaled */
|
/* Android_ResumeSem was signaled */
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||||
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
|
|
||||||
ANDROIDAUDIO_ResumeDevices();
|
ANDROIDAUDIO_ResumeDevices();
|
||||||
openslES_ResumeDevices();
|
openslES_ResumeDevices();
|
||||||
|
@ -140,7 +140,7 @@ void Android_PumpEvents_Blocking(_THIS)
|
||||||
|
|
||||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||||
#if SDL_VIDEO_OPENGL_EGL
|
#if SDL_VIDEO_OPENGL_EGL
|
||||||
if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
|
if (!isContextExternal && !SDL_HasEvent(SDL_EVENT_QUIT)) {
|
||||||
SDL_LockMutex(Android_ActivityMutex);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
android_egl_context_restore(Android_Window);
|
android_egl_context_restore(Android_Window);
|
||||||
SDL_UnlockMutex(Android_ActivityMutex);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
@ -157,15 +157,15 @@ void Android_PumpEvents_Blocking(_THIS)
|
||||||
|
|
||||||
/* Android_PauseSem was signaled */
|
/* Android_PauseSem was signaled */
|
||||||
if (videodata->isPausing == 0) {
|
if (videodata->isPausing == 0) {
|
||||||
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've been signaled to pause (potentially several times), but before we block ourselves,
|
/* 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)
|
* we need to make sure that the very last event (of the first pause sequence, if several)
|
||||||
* has reached the app */
|
* 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;
|
videodata->isPausing = 1;
|
||||||
} else {
|
} else {
|
||||||
videodata->isPausing = 0;
|
videodata->isPausing = 0;
|
||||||
|
@ -212,9 +212,9 @@ void Android_PumpEvents_NonBlocking(_THIS)
|
||||||
videodata->isPaused = 0;
|
videodata->isPaused = 0;
|
||||||
|
|
||||||
/* Android_ResumeSem was signaled */
|
/* Android_ResumeSem was signaled */
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||||
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
|
|
||||||
if (videodata->pauseAudio) {
|
if (videodata->pauseAudio) {
|
||||||
ANDROIDAUDIO_ResumeDevices();
|
ANDROIDAUDIO_ResumeDevices();
|
||||||
|
@ -224,7 +224,7 @@ void Android_PumpEvents_NonBlocking(_THIS)
|
||||||
|
|
||||||
#if SDL_VIDEO_OPENGL_EGL
|
#if SDL_VIDEO_OPENGL_EGL
|
||||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
/* 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);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
android_egl_context_restore(Android_Window);
|
android_egl_context_restore(Android_Window);
|
||||||
SDL_UnlockMutex(Android_ActivityMutex);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
@ -241,15 +241,15 @@ void Android_PumpEvents_NonBlocking(_THIS)
|
||||||
|
|
||||||
/* Android_PauseSem was signaled */
|
/* Android_PauseSem was signaled */
|
||||||
if (videodata->isPausing == 0) {
|
if (videodata->isPausing == 0) {
|
||||||
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND);
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've been signaled to pause (potentially several times), but before we block ourselves,
|
/* 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)
|
* we need to make sure that the very last event (of the first pause sequence, if several)
|
||||||
* has reached the app */
|
* 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;
|
videodata->isPausing = 1;
|
||||||
} else {
|
} else {
|
||||||
videodata->isPausing = 0;
|
videodata->isPausing = 0;
|
||||||
|
|
|
@ -279,7 +279,7 @@ void Android_SendResize(SDL_Window *window)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (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 */
|
* will fall back to the old mode */
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
||||||
display->display_modes[0].format = Android_ScreenFormat;
|
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->display_modes[0].refresh_rate = Android_ScreenRate;
|
||||||
display->current_mode = display->display_modes[0];
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *di
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_w != new_w || old_h != new_h) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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
|
#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. */
|
/* 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]];
|
[data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -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
|
* 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
|
* resizable window exits a fullscreen Space via the user pressing the OS
|
||||||
* exit-space button). */
|
* exit-space button). */
|
||||||
if (event->type == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_cocoametalview *view = (__bridge SDL_cocoametalview *)userdata;
|
SDL_cocoametalview *view = (__bridge SDL_cocoametalview *)userdata;
|
||||||
if (view.sdlWindowID == event->window.windowID) {
|
if (view.sdlWindowID == event->window.windowID) {
|
||||||
|
|
|
@ -534,9 +534,9 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||||
if (object == _data.nswindow && [keyPath isEqualToString:@"visible"]) {
|
if (object == _data.nswindow && [keyPath isEqualToString:@"visible"]) {
|
||||||
int newVisibility = [[change objectForKey:@"new"] intValue];
|
int newVisibility = [[change objectForKey:@"new"] intValue];
|
||||||
if (newVisibility) {
|
if (newVisibility) {
|
||||||
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||||
} else {
|
} 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;
|
observingVisible = YES;
|
||||||
if (wasVisible != isVisible) {
|
if (wasVisible != isVisible) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wasVisible = isVisible;
|
wasVisible = isVisible;
|
||||||
|
@ -720,13 +720,13 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)sender
|
- (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;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidExpose:(NSNotification *)aNotification
|
- (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
|
- (void)windowWillMove:(NSNotification *)aNotification
|
||||||
|
@ -771,7 +771,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||||
|
|
||||||
ScheduleContextUpdates(_data);
|
ScheduleContextUpdates(_data);
|
||||||
|
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)aNotification
|
- (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
|
/* The window can move during a resize event, such as when maximizing
|
||||||
or resizing from a corner */
|
or resizing from a corner */
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h);
|
||||||
|
|
||||||
zoomed = [nswindow isZoomed];
|
zoomed = [nswindow isZoomed];
|
||||||
if (!zoomed) {
|
if (!zoomed) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
} else if (zoomed) {
|
} 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;
|
focusClickPending = 0;
|
||||||
[self onMovingOrFocusClickPendingStateCleared];
|
[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
|
- (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
|
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||||
|
@ -913,7 +913,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||||
|
|
||||||
- (void)windowDidChangeScreenProfile:(NSNotification *)aNotification
|
- (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
|
- (void)windowDidChangeScreen:(NSNotification *)aNotification
|
||||||
|
@ -1227,7 +1227,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self processHitTest:theEvent]) {
|
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. */
|
return; /* dragging, drop event. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,7 +1276,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self processHitTest:theEvent]) {
|
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. */
|
return; /* stopped dragging, drop event. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1329,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
window = _data.window;
|
window = _data.window;
|
||||||
|
|
||||||
if ([self processHitTest:theEvent]) {
|
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. */
|
return; /* dragging, drop event. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,7 +1553,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
|
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(_sdlWindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)wantsUpdateLayer
|
- (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. */
|
only gets called for window creation and other extraordinary events. */
|
||||||
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
|
self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
|
||||||
ScheduleContextUpdates((__bridge SDL_WindowData *)_sdlWindow->driverdata);
|
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
|
- (void)rightMouseDown:(NSEvent *)theEvent
|
||||||
|
|
|
@ -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. */
|
emscripten_request_pointerlock(window_data->canvas_id, 0); /* try to regrab lost pointer lock. */
|
||||||
}
|
}
|
||||||
sdl_button_state = SDL_PRESSED;
|
sdl_button_state = SDL_PRESSED;
|
||||||
sdl_event_type = SDL_MOUSEBUTTONDOWN;
|
sdl_event_type = SDL_EVENT_MOUSE_BUTTONDOWN;
|
||||||
} else {
|
} else {
|
||||||
sdl_button_state = SDL_RELEASED;
|
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);
|
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);
|
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)
|
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);
|
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)
|
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_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);
|
SDL_SendWindowEvent(window_data->window, sdl_event_type, 0, 0);
|
||||||
return SDL_EventEnabled(sdl_event_type);
|
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);
|
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 */
|
/* 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;
|
preventDefault = 1;
|
||||||
}
|
}
|
||||||
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
|
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
|
||||||
|
@ -816,7 +816,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
|
||||||
is_nav_key = SDL_TRUE;
|
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;
|
prevent_default = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboard
|
||||||
if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
|
if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
|
||||||
SDL_SendKeyboardText(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)
|
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;
|
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) {
|
if (window_data->fullscreen_resize) {
|
||||||
double css_w, css_h;
|
double css_w, css_h;
|
||||||
emscripten_get_element_css_size(window_data->canvas_id, &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;
|
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)
|
static EM_BOOL Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window_data = 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;
|
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
|
/* This event will need to be handled synchronously, e.g. using
|
||||||
SDL_AddEventWatch, as the page is being closed *now*. */
|
SDL_AddEventWatch, as the page is being closed *now*. */
|
||||||
/* No need to send a SDL_QUIT, the app won't get control again. */
|
/* No need to send a SDL_EVENT_QUIT, the app won't get control again. */
|
||||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
SDL_SendAppEvent(SDL_EVENT_TERMINATING);
|
||||||
return ""; /* don't trigger confirmation dialog */
|
return ""; /* don't trigger confirmation dialog */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window)
|
||||||
scaled_w = css_w * wdata->pixel_ratio;
|
scaled_w = css_w * wdata->pixel_ratio;
|
||||||
scaled_h = css_h * 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);
|
emscripten_set_canvas_element_size(wdata->canvas_id, scaled_w, scaled_h);
|
||||||
|
|
||||||
|
|
|
@ -120,23 +120,23 @@ class SDL_BApp : public BApplication
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_REPAINT:
|
case BAPP_REPAINT:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_EXPOSED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MAXIMIZE:
|
case BAPP_MAXIMIZE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MAXIMIZED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MINIMIZE:
|
case BAPP_MINIMIZE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MINIMIZED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_SHOW:
|
case BAPP_SHOW:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_SHOWN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_HIDE:
|
case BAPP_HIDE:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_HIDDEN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_MOUSE_FOCUS:
|
case BAPP_MOUSE_FOCUS:
|
||||||
|
@ -148,7 +148,7 @@ class SDL_BApp : public BApplication
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_WINDOW_CLOSE_REQUESTED:
|
case BAPP_WINDOW_CLOSE_REQUESTED:
|
||||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
|
_HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_CLOSE_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BAPP_WINDOW_MOVED:
|
case BAPP_WINDOW_MOVED:
|
||||||
|
@ -311,7 +311,7 @@ class SDL_BApp : public BApplication
|
||||||
HAIKU_SetKeyState(scancode, state);
|
HAIKU_SetKeyState(scancode, state);
|
||||||
SDL_SendKeyboardKey(0, state, HAIKU_GetScancodeFromBeKey(scancode));
|
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;
|
const int8 *keyUtf8;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
||||||
|
@ -374,7 +374,7 @@ class SDL_BApp : public BApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win = GetSDLWindow(winID);
|
win = GetSDLWindow(winID);
|
||||||
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
|
SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_MOVED, xPos, yPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _HandleWindowResized(BMessage *msg)
|
void _HandleWindowResized(BMessage *msg)
|
||||||
|
@ -390,7 +390,7 @@ class SDL_BApp : public BApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win = GetSDLWindow(winID);
|
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)
|
bool _GetWinID(BMessage *msg, int32 *winID)
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ static void KMSDRM_DirtySurfaces(SDL_Window *window)
|
||||||
or SetWindowFullscreen, send a fake event for now since the actual
|
or SetWindowFullscreen, send a fake event for now since the actual
|
||||||
recreation is deferred */
|
recreation is deferred */
|
||||||
KMSDRM_GetModeToSet(window, &mode);
|
KMSDRM_GetModeToSet(window, &mode);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, mode.hdisplay, mode.vdisplay);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, mode.hdisplay, mode.vdisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This determines the size of the fb, which comes from the GBM surface
|
/* This determines the size of the fb, which comes from the GBM surface
|
||||||
|
@ -1211,7 +1211,7 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Window *window)
|
||||||
egl_context = (EGLContext)SDL_GL_GetCurrentContext();
|
egl_context = (EGLContext)SDL_GL_GetCurrentContext();
|
||||||
ret = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
|
ret = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
|
||||||
|
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED,
|
||||||
dispdata->mode.hdisplay, dispdata->mode.vdisplay);
|
dispdata->mode.hdisplay, dispdata->mode.vdisplay);
|
||||||
|
|
||||||
windata->egl_surface_dirty = SDL_FALSE;
|
windata->egl_surface_dirty = SDL_FALSE;
|
||||||
|
@ -1543,7 +1543,7 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
|
||||||
SDL_SetKeyboardFocus(window);
|
SDL_SetKeyboardFocus(window);
|
||||||
|
|
||||||
/* Tell the app that the window has moved to top-left. */
|
/* Tell the app that the window has moved to top-left. */
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, 0, 0);
|
||||||
|
|
||||||
/* Allocated windata will be freed in KMSDRM_DestroyWindow,
|
/* Allocated windata will be freed in KMSDRM_DestroyWindow,
|
||||||
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()
|
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()
|
||||||
|
|
|
@ -35,7 +35,7 @@ void N3DS_PumpEvents(_THIS)
|
||||||
|
|
||||||
if (!aptMainLoop()) {
|
if (!aptMainLoop()) {
|
||||||
SDL_Event ev;
|
SDL_Event ev;
|
||||||
ev.type = SDL_QUIT;
|
ev.type = SDL_EVENT_QUIT;
|
||||||
ev.common.timestamp = 0;
|
ev.common.timestamp = 0;
|
||||||
SDL_PushEvent(&ev);
|
SDL_PushEvent(&ev);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -572,7 +572,7 @@ void SDL_OnApplicationDidChangeStatusBarOrientation()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation);
|
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_ORIENTATION, orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !TARGET_OS_TV */
|
#endif /* !TARGET_OS_TV */
|
||||||
|
|
|
@ -201,7 +201,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
||||||
int w = (int)size.width;
|
int w = (int)size.width;
|
||||||
int h = (int)size.height;
|
int h = (int)size.height;
|
||||||
|
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
|
|
|
@ -379,7 +379,7 @@ int Wayland_WaitEventTimeout(_THIS, Sint64 timeoutNS)
|
||||||
WAYLAND_wl_display_flush(d->display);
|
WAYLAND_wl_display_flush(d->display);
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -429,7 +429,7 @@ int Wayland_WaitEventTimeout(_THIS, Sint64 timeoutNS)
|
||||||
|
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
/* If the wait was interrupted by a signal, we may have generated a
|
/* If the wait was interrupted by a signal, we may have generated a
|
||||||
* SDL_QUIT event. Let the caller know to call SDL_PumpEvents(). */
|
* SDL_EVENT_QUIT event. Let the caller know to call SDL_PumpEvents(). */
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return err;
|
return err;
|
||||||
|
@ -448,7 +448,7 @@ void Wayland_PumpEvents(_THIS)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (d->text_input_manager == NULL && SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -650,7 +650,7 @@ static void display_handle_done(void *data,
|
||||||
SDL_free(driverdata->placeholder.name);
|
SDL_free(driverdata->placeholder.name);
|
||||||
SDL_zero(driverdata->placeholder);
|
SDL_zero(driverdata->placeholder);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendDisplayEvent(dpy, SDL_DISPLAYEVENT_ORIENTATION, driverdata->orientation);
|
SDL_SendDisplayEvent(dpy, SDL_EVENT_DISPLAY_ORIENTATION, driverdata->orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -620,7 +620,7 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||||
* No, we do not get minimize events from xdg-shell.
|
* No, we do not get minimize events from xdg-shell.
|
||||||
*/
|
*/
|
||||||
SDL_SendWindowEvent(window,
|
SDL_SendWindowEvent(window,
|
||||||
maximized ? SDL_WINDOWEVENT_MAXIMIZED : SDL_WINDOWEVENT_RESTORED,
|
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
/* Store current floating dimensions for restoring */
|
/* Store current floating dimensions for restoring */
|
||||||
|
@ -670,7 +670,7 @@ static void handle_configure_xdg_toplevel(void *data,
|
||||||
static void handle_close_xdg_toplevel(void *data, struct xdg_toplevel *xdg_toplevel)
|
static void handle_close_xdg_toplevel(void *data, struct xdg_toplevel *xdg_toplevel)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window = (SDL_WindowData *)data;
|
SDL_WindowData *window = (SDL_WindowData *)data;
|
||||||
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct xdg_toplevel_listener toplevel_listener_xdg = {
|
static const struct xdg_toplevel_listener toplevel_listener_xdg = {
|
||||||
|
@ -691,7 +691,7 @@ static void handle_configure_xdg_popup(void *data,
|
||||||
static void handle_done_xdg_popup(void *data, struct xdg_popup *xdg_popup)
|
static void handle_done_xdg_popup(void *data, struct xdg_popup *xdg_popup)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window = (SDL_WindowData *)data;
|
SDL_WindowData *window = (SDL_WindowData *)data;
|
||||||
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_repositioned_xdg_popup(void *data,
|
static void handle_repositioned_xdg_popup(void *data,
|
||||||
|
@ -711,7 +711,7 @@ static const struct xdg_popup_listener popup_listener_xdg = {
|
||||||
|
|
||||||
static int Wayland_PopupWatch(void *data, SDL_Event *event)
|
static int Wayland_PopupWatch(void *data, SDL_Event *event)
|
||||||
{
|
{
|
||||||
if (event->type == SDL_MOUSEMOTION) {
|
if (event->type == SDL_EVENT_MOUSE_MOTION) {
|
||||||
SDL_Window *window = (SDL_Window *)data;
|
SDL_Window *window = (SDL_Window *)data;
|
||||||
SDL_WindowData *wind = window->driverdata;
|
SDL_WindowData *wind = window->driverdata;
|
||||||
|
|
||||||
|
@ -849,13 +849,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||||
* No, we do not get minimize events from libdecor.
|
* No, we do not get minimize events from libdecor.
|
||||||
*/
|
*/
|
||||||
SDL_SendWindowEvent(window,
|
SDL_SendWindowEvent(window,
|
||||||
maximized ? SDL_WINDOWEVENT_MAXIMIZED : SDL_WINDOWEVENT_RESTORED,
|
maximized ? SDL_EVENT_WINDOW_MAXIMIZED : SDL_EVENT_WINDOW_RESTORED,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to maximized/restore events above, send focus events too! */
|
/* Similar to maximized/restore events above, send focus events too! */
|
||||||
SDL_SendWindowEvent(window,
|
SDL_SendWindowEvent(window,
|
||||||
focused ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST,
|
focused ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
/* For fullscreen or fixed-size windows we know our size.
|
/* For fullscreen or fixed-size windows we know our size.
|
||||||
|
@ -953,14 +953,14 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
|
||||||
|
|
||||||
static void decoration_frame_close(struct libdecor_frame *frame, void *user_data)
|
static void decoration_frame_close(struct libdecor_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
SDL_SendWindowEvent(((SDL_WindowData *)user_data)->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(((SDL_WindowData *)user_data)->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decoration_frame_commit(struct libdecor_frame *frame, void *user_data)
|
static void decoration_frame_commit(struct libdecor_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
SDL_WindowData *wind = user_data;
|
SDL_WindowData *wind = user_data;
|
||||||
|
|
||||||
SDL_SendWindowEvent(wind->sdlwindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct libdecor_frame_interface libdecor_frame_interface = {
|
static struct libdecor_frame_interface libdecor_frame_interface = {
|
||||||
|
@ -985,7 +985,7 @@ static void handle_set_generic_property(void *data,
|
||||||
static void handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
|
static void handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window = (SDL_WindowData *)data;
|
SDL_WindowData *window = (SDL_WindowData *)data;
|
||||||
SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct qt_extended_surface_listener extended_surface_listener = {
|
static const struct qt_extended_surface_listener extended_surface_listener = {
|
||||||
|
@ -1059,7 +1059,7 @@ static void Wayland_move_window(SDL_Window *window,
|
||||||
*/
|
*/
|
||||||
SDL_Rect bounds;
|
SDL_Rect bounds;
|
||||||
SDL_GetDisplayBounds(i, &bounds);
|
SDL_GetDisplayBounds(i, &bounds);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, bounds.x, bounds.y);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, bounds.x, bounds.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2053,7 +2053,7 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height, floa
|
||||||
* so we must override the deduplication logic in the video core */
|
* so we must override the deduplication logic in the video core */
|
||||||
window->w = 0;
|
window->w = 0;
|
||||||
window->h = 0;
|
window->h = 0;
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, width, height);
|
||||||
window->w = width;
|
window->w = width;
|
||||||
window->h = height;
|
window->h = height;
|
||||||
data->needs_resize_event = SDL_FALSE;
|
data->needs_resize_event = SDL_FALSE;
|
||||||
|
|
|
@ -716,8 +716,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
LRESULT returnCode = -1;
|
LRESULT returnCode = -1;
|
||||||
|
|
||||||
/* Send a SDL_SYSWMEVENT if the application wants them */
|
/* Send a SDL_EVENT_SYSWM if the application wants them */
|
||||||
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
|
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||||
SDL_SysWMmsg wmmsg;
|
SDL_SysWMmsg wmmsg;
|
||||||
|
|
||||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||||
|
@ -764,9 +764,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_SHOWWINDOW:
|
case WM_SHOWWINDOW:
|
||||||
{
|
{
|
||||||
if (wParam) {
|
if (wParam) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1027,7 +1027,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
|
if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
|
||||||
/* ALT+F4: Close window */
|
/* ALT+F4: Close window */
|
||||||
if (code == SDL_SCANCODE_F4 && ShouldGenerateWindowCloseOnAltF4()) {
|
if (code == SDL_SCANCODE_F4 && ShouldGenerateWindowCloseOnAltF4()) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,9 +1264,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
y = rect.top;
|
y = rect.top;
|
||||||
WIN_ScreenPointToSDL(&x, &y);
|
WIN_ScreenPointToSDL(&x, &y);
|
||||||
|
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
|
|
||||||
// Moving the window from one display to another can change the size of the window (in the handling of SDL_WINDOWEVENT_MOVED), so we need to re-query the bounds
|
// Moving the window from one display to another can change the size of the window (in the handling of SDL_EVENT_WINDOW_MOVED), so we need to re-query the bounds
|
||||||
if (GetClientRect(hwnd, &rect)) {
|
if (GetClientRect(hwnd, &rect)) {
|
||||||
ClientToScreen(hwnd, (LPPOINT)&rect);
|
ClientToScreen(hwnd, (LPPOINT)&rect);
|
||||||
ClientToScreen(hwnd, (LPPOINT)&rect + 1);
|
ClientToScreen(hwnd, (LPPOINT)&rect + 1);
|
||||||
|
@ -1283,7 +1283,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
WIN_ClientPointToSDL(data->window, &w, &h);
|
WIN_ClientPointToSDL(data->window, &w, &h);
|
||||||
|
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, w, h);
|
||||||
|
|
||||||
#ifdef HIGHDPI_DEBUG
|
#ifdef HIGHDPI_DEBUG
|
||||||
SDL_Log("WM_WINDOWPOSCHANGED: Windows client rect (pixels): (%d, %d) (%d x %d)\tSDL client rect (points): (%d, %d) (%d x %d) cached dpi %d, windows reported dpi %d",
|
SDL_Log("WM_WINDOWPOSCHANGED: Windows client rect (pixels): (%d, %d) (%d x %d)\tSDL client rect (points): (%d, %d) (%d x %d) cached dpi %d, windows reported dpi %d",
|
||||||
|
@ -1305,17 +1305,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case SIZE_MAXIMIZED:
|
case SIZE_MAXIMIZED:
|
||||||
SDL_SendWindowEvent(data->window,
|
SDL_SendWindowEvent(data->window,
|
||||||
SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
SDL_SendWindowEvent(data->window,
|
SDL_SendWindowEvent(data->window,
|
||||||
SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||||
break;
|
break;
|
||||||
case SIZE_MINIMIZED:
|
case SIZE_MINIMIZED:
|
||||||
SDL_SendWindowEvent(data->window,
|
SDL_SendWindowEvent(data->window,
|
||||||
SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||||
break;
|
break;
|
||||||
case SIZE_RESTORED:
|
case SIZE_RESTORED:
|
||||||
SDL_SendWindowEvent(data->window,
|
SDL_SendWindowEvent(data->window,
|
||||||
SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1342,7 +1342,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
RECT rect;
|
RECT rect;
|
||||||
if (GetUpdateRect(hwnd, &rect, FALSE)) {
|
if (GetUpdateRect(hwnd, &rect, FALSE)) {
|
||||||
ValidateRect(hwnd, NULL);
|
ValidateRect(hwnd, NULL);
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnCode = 0;
|
returnCode = 0;
|
||||||
|
@ -1382,7 +1382,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
{
|
{
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
}
|
}
|
||||||
returnCode = 0;
|
returnCode = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1523,7 +1523,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
#define POST_HIT_TEST(ret) \
|
#define POST_HIT_TEST(ret) \
|
||||||
{ \
|
{ \
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); \
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); \
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
case SDL_HITTEST_DRAGGABLE:
|
case SDL_HITTEST_DRAGGABLE:
|
||||||
|
@ -1652,7 +1652,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
/* Update the cached DPI value for this window */
|
/* Update the cached DPI value for this window */
|
||||||
data->scaling_dpi = newDPI;
|
data->scaling_dpi = newDPI;
|
||||||
|
|
||||||
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
/* Send a SDL_EVENT_WINDOW_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
||||||
Renderers need to get this to know that the framebuffer size changed.
|
Renderers need to get this to know that the framebuffer size changed.
|
||||||
|
|
||||||
We clear the window size to force the event to be delivered, but what we really
|
We clear the window size to force the event to be delivered, but what we really
|
||||||
|
@ -1661,7 +1661,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
*/
|
*/
|
||||||
data->window->w = 0;
|
data->window->w = 0;
|
||||||
data->window->h = 0;
|
data->window->h = 0;
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SIZE_CHANGED, data->window->w, data->window->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HIGHDPI_DEBUG
|
#ifdef HIGHDPI_DEBUG
|
||||||
|
@ -1725,9 +1725,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
/* Update the cached DPI value for this window */
|
/* Update the cached DPI value for this window */
|
||||||
data->scaling_dpi = newDPI;
|
data->scaling_dpi = newDPI;
|
||||||
|
|
||||||
/* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
/* Send a SDL_EVENT_WINDOW_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged.
|
||||||
Renderers need to get this to know that the framebuffer size changed. */
|
Renderers need to get this to know that the framebuffer size changed. */
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_SIZE_CHANGED, data->window->w, data->window->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -352,10 +352,10 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info,
|
||||||
SDL_SetDesktopDisplayMode(&_this->displays[i], &mode);
|
SDL_SetDesktopDisplayMode(&_this->displays[i], &mode);
|
||||||
if (WIN_GetDisplayBounds(_this, &_this->displays[i], &bounds) == 0) {
|
if (WIN_GetDisplayBounds(_this, &_this->displays[i], &bounds) == 0) {
|
||||||
if (SDL_memcmp(&driverdata->bounds, &bounds, sizeof(bounds)) != 0 || moved) {
|
if (SDL_memcmp(&driverdata->bounds, &bounds, sizeof(bounds)) != 0 || moved) {
|
||||||
SDL_SendDisplayEvent(&_this->displays[i], SDL_DISPLAYEVENT_MOVED, 0);
|
SDL_SendDisplayEvent(&_this->displays[i], SDL_EVENT_DISPLAY_MOVED, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_SendDisplayEvent(&_this->displays[i], SDL_DISPLAYEVENT_ORIENTATION, orientation);
|
SDL_SendDisplayEvent(&_this->displays[i], SDL_EVENT_DISPLAY_ORIENTATION, orientation);
|
||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ void WIN_UpdateWindowICCProfile(SDL_Window *window, SDL_bool send_event)
|
||||||
}
|
}
|
||||||
data->ICMFileName = SDL_wcsdup(fileName);
|
data->ICMFileName = SDL_wcsdup(fileName);
|
||||||
if (send_event) {
|
if (send_event) {
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,7 +389,7 @@ void WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEve
|
||||||
src_ucs2[0] = args->KeyCode;
|
src_ucs2[0] = args->KeyCode;
|
||||||
src_ucs2[1] = L'\0';
|
src_ucs2[1] = L'\0';
|
||||||
|
|
||||||
/* Convert the text, then send an SDL_TEXTINPUT event. */
|
/* Convert the text, then send an SDL_EVENT_TEXT_INPUT event. */
|
||||||
result = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)&src_ucs2, -1, (LPSTR)dest_utf8, sizeof(dest_utf8), NULL, NULL);
|
result = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)&src_ucs2, -1, (LPSTR)dest_utf8, sizeof(dest_utf8), NULL, NULL);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
SDL_SendKeyboardText(dest_utf8);
|
SDL_SendKeyboardText(dest_utf8);
|
||||||
|
|
|
@ -329,11 +329,11 @@ static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
|
||||||
if (X11_XGetEventData(videodata->display, cookie)) {
|
if (X11_XGetEventData(videodata->display, cookie)) {
|
||||||
X11_HandleXinput2Event(videodata, cookie);
|
X11_HandleXinput2Event(videodata, cookie);
|
||||||
|
|
||||||
/* Send a SDL_SYSWMEVENT if the application wants them.
|
/* Send a SDL_EVENT_SYSWM if the application wants them.
|
||||||
* Since event data is only available until XFreeEventData is called,
|
* Since event data is only available until XFreeEventData is called,
|
||||||
* the *only* way for an application to access it is to register an event filter/watcher
|
* the *only* way for an application to access it is to register an event filter/watcher
|
||||||
* and do all the processing on the SDL_SYSWMEVENT inside the callback. */
|
* and do all the processing on the SDL_EVENT_SYSWM inside the callback. */
|
||||||
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
|
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||||
SDL_SysWMmsg wmmsg;
|
SDL_SysWMmsg wmmsg;
|
||||||
|
|
||||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||||
|
@ -491,8 +491,8 @@ static void X11_DispatchFocusOut(_THIS, SDL_WindowData *data)
|
||||||
static void X11_DispatchMapNotify(SDL_WindowData *data)
|
static void X11_DispatchMapNotify(SDL_WindowData *data)
|
||||||
{
|
{
|
||||||
SDL_Window *window = data->window;
|
SDL_Window *window = data->window;
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
|
||||||
if (!(window->flags & SDL_WINDOW_HIDDEN) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
if (!(window->flags & SDL_WINDOW_HIDDEN) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||||
SDL_UpdateWindowGrab(window);
|
SDL_UpdateWindowGrab(window);
|
||||||
}
|
}
|
||||||
|
@ -500,8 +500,8 @@ static void X11_DispatchMapNotify(SDL_WindowData *data)
|
||||||
|
|
||||||
static void X11_DispatchUnmapNotify(SDL_WindowData *data)
|
static void X11_DispatchUnmapNotify(SDL_WindowData *data)
|
||||||
{
|
{
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitiateWindowMove(_THIS, const SDL_WindowData *data, const SDL_Point *point)
|
static void InitiateWindowMove(_THIS, const SDL_WindowData *data, const SDL_Point *point)
|
||||||
|
@ -814,8 +814,8 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Send a SDL_SYSWMEVENT if the application wants them */
|
/* Send a SDL_EVENT_SYSWM if the application wants them */
|
||||||
if (SDL_EventEnabled(SDL_SYSWMEVENT)) {
|
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||||
SDL_SysWMmsg wmmsg;
|
SDL_SysWMmsg wmmsg;
|
||||||
|
|
||||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||||
|
@ -878,12 +878,12 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
X11_XGetWindowAttributes(display, data->xwindow, &attrib);
|
X11_XGetWindowAttributes(display, data->xwindow, &attrib);
|
||||||
screennum = X11_XScreenNumberOfScreen(attrib.screen);
|
screennum = X11_XScreenNumberOfScreen(attrib.screen);
|
||||||
if (screennum == 0 && SDL_strcmp(name_of_atom, "_ICC_PROFILE") == 0) {
|
if (screennum == 0 && SDL_strcmp(name_of_atom, "_ICC_PROFILE") == 0) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
|
||||||
} else if (SDL_strncmp(name_of_atom, "_ICC_PROFILE_", sizeof("_ICC_PROFILE_") - 1) == 0 && SDL_strlen(name_of_atom) > sizeof("_ICC_PROFILE_") - 1) {
|
} else if (SDL_strncmp(name_of_atom, "_ICC_PROFILE_", sizeof("_ICC_PROFILE_") - 1) == 0 && SDL_strlen(name_of_atom) > sizeof("_ICC_PROFILE_") - 1) {
|
||||||
int iccscreennum = SDL_atoi(&name_of_atom[sizeof("_ICC_PROFILE_") - 1]);
|
int iccscreennum = SDL_atoi(&name_of_atom[sizeof("_ICC_PROFILE_") - 1]);
|
||||||
|
|
||||||
if (screennum == iccscreennum) {
|
if (screennum == iccscreennum) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_ICCPROF_CHANGED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED));
|
handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1167,10 +1167,10 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
|
|
||||||
if (xevent->xconfigure.x != data->last_xconfigure.x ||
|
if (xevent->xconfigure.x != data->last_xconfigure.x ||
|
||||||
xevent->xconfigure.y != data->last_xconfigure.y) {
|
xevent->xconfigure.y != data->last_xconfigure.y) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED,
|
||||||
xevent->xconfigure.x, xevent->xconfigure.y);
|
xevent->xconfigure.x, xevent->xconfigure.y);
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
/* Update IME candidate list position */
|
/* Update IME candidate list position */
|
||||||
SDL_IME_UpdateTextRect(NULL);
|
SDL_IME_UpdateTextRect(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1178,7 +1178,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
}
|
}
|
||||||
if (xevent->xconfigure.width != data->last_xconfigure.width ||
|
if (xevent->xconfigure.width != data->last_xconfigure.width ||
|
||||||
xevent->xconfigure.height != data->last_xconfigure.height) {
|
xevent->xconfigure.height != data->last_xconfigure.height) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED,
|
||||||
xevent->xconfigure.width,
|
xevent->xconfigure.width,
|
||||||
xevent->xconfigure.height);
|
xevent->xconfigure.height);
|
||||||
}
|
}
|
||||||
|
@ -1279,7 +1279,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
#ifdef DEBUG_XEVENTS
|
#ifdef DEBUG_XEVENTS
|
||||||
printf("window %p: WM_DELETE_WINDOW\n", data);
|
printf("window %p: WM_DELETE_WINDOW\n", data);
|
||||||
#endif
|
#endif
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
|
||||||
break;
|
break;
|
||||||
} else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
|
} else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
|
||||||
(xevent->xclient.format == 32) &&
|
(xevent->xclient.format == 32) &&
|
||||||
|
@ -1288,7 +1288,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
#ifdef DEBUG_XEVENTS
|
#ifdef DEBUG_XEVENTS
|
||||||
printf("window %p: WM_TAKE_FOCUS\n", data);
|
printf("window %p: WM_TAKE_FOCUS\n", data);
|
||||||
#endif
|
#endif
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_TAKE_FOCUS, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -1299,7 +1299,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
#ifdef DEBUG_XEVENTS
|
#ifdef DEBUG_XEVENTS
|
||||||
printf("window %p: Expose (count = %d)\n", data, xevent->xexpose.count);
|
printf("window %p: Expose (count = %d)\n", data, xevent->xexpose.count);
|
||||||
#endif
|
#endif
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
|
@ -1327,7 +1327,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
int button = xevent->xbutton.button;
|
int button = xevent->xbutton.button;
|
||||||
if (button == Button1) {
|
if (button == Button1) {
|
||||||
if (ProcessHitTest(_this, data, xevent)) {
|
if (ProcessHitTest(_this, data, xevent)) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0);
|
||||||
break; /* don't pass this event on to app. */
|
break; /* don't pass this event on to app. */
|
||||||
}
|
}
|
||||||
} else if (button > 7) {
|
} else if (button > 7) {
|
||||||
|
@ -1474,9 +1474,9 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
|
||||||
|
|
||||||
if (changed & SDL_WINDOW_MAXIMIZED) {
|
if (changed & SDL_WINDOW_MAXIMIZED) {
|
||||||
if (flags & SDL_WINDOW_MAXIMIZED) {
|
if (flags & SDL_WINDOW_MAXIMIZED) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (xevent->xproperty.atom == videodata->XKLAVIER_STATE) {
|
} else if (xevent->xproperty.atom == videodata->XKLAVIER_STATE) {
|
||||||
|
@ -1656,7 +1656,7 @@ int X11_WaitEventTimeout(_THIS, Sint64 timeoutNS)
|
||||||
|
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
/* If the wait was interrupted by a signal, we may have generated a
|
/* If the wait was interrupted by a signal, we may have generated a
|
||||||
* SDL_QUIT event. Let the caller know to call SDL_PumpEvents(). */
|
* SDL_EVENT_QUIT event. Let the caller know to call SDL_PumpEvents(). */
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return err;
|
return err;
|
||||||
|
@ -1667,7 +1667,7 @@ int X11_WaitEventTimeout(_THIS, Sint64 timeoutNS)
|
||||||
X11_DispatchEvent(_this, &xevent);
|
X11_DispatchEvent(_this, &xevent);
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1708,7 +1708,7 @@ void X11_PumpEvents(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_EventEnabled(SDL_TEXTINPUT)) {
|
if (SDL_EventEnabled(SDL_EVENT_TEXT_INPUT)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1389,12 +1389,12 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis
|
||||||
if (!caught_x11_error) {
|
if (!caught_x11_error) {
|
||||||
SDL_bool window_changed = SDL_FALSE;
|
SDL_bool window_changed = SDL_FALSE;
|
||||||
if ((x != orig_x) || (y != orig_y)) {
|
if ((x != orig_x) || (y != orig_y)) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MOVED, x, y);
|
||||||
window_changed = SDL_TRUE;
|
window_changed = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
|
if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, attrs.width, attrs.height);
|
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESIZED, attrs.width, attrs.height);
|
||||||
window_changed = SDL_TRUE;
|
window_changed = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,10 +173,10 @@ void loop()
|
||||||
|
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_EVENT_KEY_UP:
|
||||||
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
|
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
|
||||||
if (event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
case SDLK_BACKSPACE:
|
case SDLK_BACKSPACE:
|
||||||
SDLTest_TextWindowAddText(textwin, "\b");
|
SDLTest_TextWindowAddText(textwin, "\b");
|
||||||
|
@ -189,18 +189,18 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTEDITING:
|
case SDL_EVENT_TEXT_EDITING:
|
||||||
PrintText("EDIT", event.edit.text);
|
PrintText("EDIT", event.edit.text);
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTEDITING_EXT:
|
case SDL_EVENT_TEXTEDITING_EXT:
|
||||||
PrintText("EDIT_EXT", event.editExt.text);
|
PrintText("EDIT_EXT", event.editExt.text);
|
||||||
SDL_free(event.editExt.text);
|
SDL_free(event.editExt.text);
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT:
|
case SDL_EVENT_TEXT_INPUT:
|
||||||
PrintText("INPUT", event.text.text);
|
PrintText("INPUT", event.text.text);
|
||||||
SDLTest_TextWindowAddText(textwin, "%s", event.text.text);
|
SDLTest_TextWindowAddText(textwin, "%s", event.text.text);
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
if (SDL_TextInputActive()) {
|
if (SDL_TextInputActive()) {
|
||||||
SDL_Log("Stopping text input\n");
|
SDL_Log("Stopping text input\n");
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
|
@ -209,7 +209,7 @@ void loop()
|
||||||
SDL_StartTextInput();
|
SDL_StartTextInput();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
/* Left button quits the app, other buttons toggles text input */
|
/* Left button quits the app, other buttons toggles text input */
|
||||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
|
@ -223,7 +223,7 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -174,17 +174,17 @@ void loop()
|
||||||
while (!done && SDL_WaitEvent(&event)) {
|
while (!done && SDL_WaitEvent(&event)) {
|
||||||
SDL_Log("Got event type: %" SDL_PRIu32 "\n", event.type);
|
SDL_Log("Got event type: %" SDL_PRIu32 "\n", event.type);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_EVENT_KEY_UP:
|
||||||
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
|
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTEDITING:
|
case SDL_EVENT_TEXT_EDITING:
|
||||||
PrintText("EDIT", event.text.text);
|
PrintText("EDIT", event.text.text);
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT:
|
case SDL_EVENT_TEXT_INPUT:
|
||||||
PrintText("INPUT", event.text.text);
|
PrintText("INPUT", event.text.text);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
/* Left button quits the app, other buttons toggles text input */
|
/* Left button quits the app, other buttons toggles text input */
|
||||||
(void)fprintf(stderr, "mouse button down button: %d (LEFT=%d)\n", event.button.button, SDL_BUTTON_LEFT);
|
(void)fprintf(stderr, "mouse button down button: %d (LEFT=%d)\n", event.button.button, SDL_BUTTON_LEFT);
|
||||||
(void)fflush(stderr);
|
(void)fflush(stderr);
|
||||||
|
@ -200,7 +200,7 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -227,7 +227,7 @@ static int SDLCALL ping_thread(void *ptr)
|
||||||
for (cnt = 0; cnt < 10; ++cnt) {
|
for (cnt = 0; cnt < 10; ++cnt) {
|
||||||
(void)fprintf(stderr, "sending event (%d/%d) from thread.\n", cnt + 1, 10);
|
(void)fprintf(stderr, "sending event (%d/%d) from thread.\n", cnt + 1, 10);
|
||||||
(void)fflush(stderr);
|
(void)fflush(stderr);
|
||||||
sdlevent.type = SDL_KEYDOWN;
|
sdlevent.type = SDL_EVENT_KEY_DOWN;
|
||||||
sdlevent.key.keysym.sym = SDLK_1;
|
sdlevent.key.keysym.sym = SDLK_1;
|
||||||
SDL_PushEvent(&sdlevent);
|
SDL_PushEvent(&sdlevent);
|
||||||
SDL_Delay(1000 + rand() % 1000);
|
SDL_Delay(1000 + rand() % 1000);
|
||||||
|
|
|
@ -438,12 +438,12 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_JOYDEVICEREMOVED:
|
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||||
if (event.jaxis.which == nJoystickID) {
|
if (event.jaxis.which == nJoystickID) {
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
|
||||||
if (event.jaxis.which == nJoystickID) {
|
if (event.jaxis.which == nJoystickID) {
|
||||||
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */
|
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */
|
||||||
AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis];
|
AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis];
|
||||||
|
@ -484,7 +484,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_EVENT_JOYSTICK_HAT_MOTION:
|
||||||
if (event.jhat.which == nJoystickID) {
|
if (event.jhat.which == nJoystickID) {
|
||||||
if (event.jhat.value != SDL_HAT_CENTERED) {
|
if (event.jhat.value != SDL_HAT_CENTERED) {
|
||||||
SDL_GameControllerExtendedBind binding;
|
SDL_GameControllerExtendedBind binding;
|
||||||
|
@ -501,7 +501,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||||
if (event.jbutton.which == nJoystickID) {
|
if (event.jbutton.which == nJoystickID) {
|
||||||
SDL_GameControllerExtendedBind binding;
|
SDL_GameControllerExtendedBind binding;
|
||||||
|
|
||||||
|
@ -515,12 +515,12 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
ConfigureBinding(&binding);
|
ConfigureBinding(&binding);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
/* Skip this step */
|
/* Skip this step */
|
||||||
SetCurrentBinding(s_iCurrentBinding + 1);
|
SetCurrentBinding(s_iCurrentBinding + 1);
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) {
|
if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) {
|
||||||
SetCurrentBinding(s_iCurrentBinding - 1);
|
SetCurrentBinding(s_iCurrentBinding - 1);
|
||||||
break;
|
break;
|
||||||
|
@ -534,7 +534,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -763,12 +763,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
|
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
open_audio();
|
open_audio();
|
||||||
|
|
||||||
SDL_FlushEvents(SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED);
|
SDL_FlushEvents(SDL_EVENT_AUDIO_DEVICE_ADDED, SDL_EVENT_AUDIO_DEVICE_REMOVED);
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop(loop, 0, 1);
|
emscripten_set_main_loop(loop, 0, 1);
|
||||||
|
@ -157,11 +157,11 @@ int main(int argc, char *argv[])
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
if (event.type == SDL_QUIT) {
|
if (event.type == SDL_EVENT_QUIT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
if ((event.type == SDL_AUDIODEVICEADDED && !event.adevice.iscapture) ||
|
if ((event.type == SDL_EVENT_AUDIO_DEVICE_ADDED && !event.adevice.iscapture) ||
|
||||||
(event.type == SDL_AUDIODEVICEREMOVED && !event.adevice.iscapture && event.adevice.which == device)) {
|
(event.type == SDL_EVENT_AUDIO_DEVICE_REMOVED && !event.adevice.iscapture && event.adevice.which == device)) {
|
||||||
reopen_audio();
|
reopen_audio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ Code
|
||||||
{
|
{
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -495,7 +495,7 @@ static int SDLCALL FIFO_Writer(void *_data)
|
||||||
int i;
|
int i;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
event.type = SDL_USEREVENT;
|
event.type = SDL_EVENT_USER;
|
||||||
event.user.windowID = 0;
|
event.user.windowID = 0;
|
||||||
event.user.code = 0;
|
event.user.code = 0;
|
||||||
event.user.data1 = data;
|
event.user.data1 = data;
|
||||||
|
|
|
@ -32,18 +32,18 @@ loop()
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
|
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
please_quit = SDL_TRUE;
|
please_quit = SDL_TRUE;
|
||||||
} else if (e.type == SDL_KEYDOWN) {
|
} else if (e.type == SDL_EVENT_KEY_DOWN) {
|
||||||
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
||||||
please_quit = SDL_TRUE;
|
please_quit = SDL_TRUE;
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_MOUSEBUTTONDOWN) {
|
} else if (e.type == SDL_EVENT_MOUSE_BUTTONDOWN) {
|
||||||
if (e.button.button == 1) {
|
if (e.button.button == 1) {
|
||||||
SDL_PauseAudioDevice(devid_out);
|
SDL_PauseAudioDevice(devid_out);
|
||||||
SDL_PlayAudioDevice(devid_in);
|
SDL_PlayAudioDevice(devid_in);
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_MOUSEBUTTONUP) {
|
} else if (e.type == SDL_EVENT_MOUSE_BUTTONUP) {
|
||||||
if (e.button.button == 1) {
|
if (e.button.button == 1) {
|
||||||
SDL_PauseAudioDevice(devid_in);
|
SDL_PauseAudioDevice(devid_in);
|
||||||
SDL_PlayAudioDevice(devid_out);
|
SDL_PlayAudioDevice(devid_out);
|
||||||
|
|
|
@ -84,13 +84,13 @@ iteration()
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
SDL_AudioDeviceID dev;
|
SDL_AudioDeviceID dev;
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
} else if (e.type == SDL_KEYUP) {
|
} else if (e.type == SDL_EVENT_KEY_UP) {
|
||||||
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_AUDIODEVICEADDED) {
|
} else if (e.type == SDL_EVENT_AUDIO_DEVICE_ADDED) {
|
||||||
int index = e.adevice.which;
|
int index = e.adevice.which;
|
||||||
int iscapture = e.adevice.iscapture;
|
int iscapture = e.adevice.iscapture;
|
||||||
const char *name = SDL_GetAudioDeviceName(index, iscapture);
|
const char *name = SDL_GetAudioDeviceName(index, iscapture);
|
||||||
|
@ -113,7 +113,7 @@ iteration()
|
||||||
SDL_PlayAudioDevice(dev);
|
SDL_PlayAudioDevice(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_AUDIODEVICEREMOVED) {
|
} else if (e.type == SDL_EVENT_AUDIO_DEVICE_REMOVED) {
|
||||||
dev = (SDL_AudioDeviceID)e.adevice.which;
|
dev = (SDL_AudioDeviceID)e.adevice.which;
|
||||||
SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int)dev);
|
SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int)dev);
|
||||||
SDL_CloseAudioDevice(dev);
|
SDL_CloseAudioDevice(dev);
|
||||||
|
|
|
@ -49,7 +49,7 @@ int events_pushPumpAndPollUserevent(void *arg)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* Create user event */
|
/* Create user event */
|
||||||
event1.type = SDL_USEREVENT;
|
event1.type = SDL_EVENT_USER;
|
||||||
event1.user.code = SDLTest_RandomSint32();
|
event1.user.code = SDLTest_RandomSint32();
|
||||||
event1.user.data1 = (void *)&g_userdataValue1;
|
event1.user.data1 = (void *)&g_userdataValue1;
|
||||||
event1.user.data2 = (void *)&g_userdataValue2;
|
event1.user.data2 = (void *)&g_userdataValue2;
|
||||||
|
@ -80,7 +80,7 @@ int events_addDelEventWatch(void *arg)
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
/* Create user event */
|
/* Create user event */
|
||||||
event.type = SDL_USEREVENT;
|
event.type = SDL_EVENT_USER;
|
||||||
event.user.code = SDLTest_RandomSint32();
|
event.user.code = SDLTest_RandomSint32();
|
||||||
event.user.data1 = (void *)&g_userdataValue1;
|
event.user.data1 = (void *)&g_userdataValue1;
|
||||||
event.user.data2 = (void *)&g_userdataValue2;
|
event.user.data2 = (void *)&g_userdataValue2;
|
||||||
|
@ -129,7 +129,7 @@ int events_addDelEventWatchWithUserdata(void *arg)
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
/* Create user event */
|
/* Create user event */
|
||||||
event.type = SDL_USEREVENT;
|
event.type = SDL_EVENT_USER;
|
||||||
event.user.code = SDLTest_RandomSint32();
|
event.user.code = SDLTest_RandomSint32();
|
||||||
event.user.data1 = (void *)&g_userdataValue1;
|
event.user.data1 = (void *)&g_userdataValue1;
|
||||||
event.user.data2 = (void *)&g_userdataValue2;
|
event.user.data2 = (void *)&g_userdataValue2;
|
||||||
|
|
|
@ -154,7 +154,7 @@ void loop()
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
if (event.type == SDL_EVENT_MOUSE_BUTTONDOWN) {
|
||||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||||
if (num_cursors == 0) {
|
if (num_cursors == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -63,7 +63,7 @@ void loop()
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
|
|
||||||
/* Re-create when window has been resized */
|
/* Re-create when window has been resized */
|
||||||
if (e.type == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
if (e.type == SDL_EVENT_WINDOW_SIZE_CHANGED) {
|
||||||
|
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ void loop()
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
|
@ -82,7 +82,7 @@ void loop()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
|
if ((e.type == SDL_EVENT_KEY_DOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
|
||||||
done = 1;
|
done = 1;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
|
|
|
@ -67,19 +67,19 @@ int main(int argc, char *argv[])
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetEventEnabled(SDL_DROPFILE, SDL_TRUE);
|
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_TRUE);
|
||||||
|
|
||||||
/* Main render loop */
|
/* Main render loop */
|
||||||
done = 0;
|
done = 0;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_DROPBEGIN) {
|
if (event.type == SDL_EVENT_DROP_BEGIN) {
|
||||||
SDL_Log("Drop beginning on window %u", (unsigned int)event.drop.windowID);
|
SDL_Log("Drop beginning on window %u", (unsigned int)event.drop.windowID);
|
||||||
} else if (event.type == SDL_DROPCOMPLETE) {
|
} else if (event.type == SDL_EVENT_DROP_COMPLETE) {
|
||||||
SDL_Log("Drop complete on window %u", (unsigned int)event.drop.windowID);
|
SDL_Log("Drop complete on window %u", (unsigned int)event.drop.windowID);
|
||||||
} else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) {
|
} else if ((event.type == SDL_EVENT_DROP_FILE) || (event.type == SDL_EVENT_DROP_TEXT)) {
|
||||||
const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text";
|
const char *typestr = (event.type == SDL_EVENT_DROP_FILE) ? "File" : "Text";
|
||||||
char *dropped_filedir = event.drop.file;
|
char *dropped_filedir = event.drop.file;
|
||||||
SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int)event.drop.windowID, dropped_filedir);
|
SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int)event.drop.windowID, dropped_filedir);
|
||||||
/* Normally you'd have to do this, but this is freed in SDLTest_CommonEvent() */
|
/* Normally you'd have to do this, but this is freed in SDLTest_CommonEvent() */
|
||||||
|
|
|
@ -560,26 +560,26 @@ void loop(void *arg)
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
/* Process all currently pending events */
|
/* Process all currently pending events */
|
||||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
|
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) == 1) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_GAMEPADADDED:
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
SDL_Log("Gamepad device %" SDL_PRIu32 " added.\n", event.cdevice.which);
|
SDL_Log("Gamepad device %" SDL_PRIu32 " added.\n", event.cdevice.which);
|
||||||
AddGamepad(event.cdevice.which, SDL_TRUE);
|
AddGamepad(event.cdevice.which, SDL_TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_GAMEPADREMOVED:
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
SDL_Log("Gamepad device %" SDL_PRIu32 " removed.\n", event.cdevice.which);
|
SDL_Log("Gamepad device %" SDL_PRIu32 " removed.\n", event.cdevice.which);
|
||||||
DelGamepad(event.cdevice.which);
|
DelGamepad(event.cdevice.which);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_GAMEPADTOUCHPADDOWN:
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
|
||||||
case SDL_GAMEPADTOUCHPADMOTION:
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
|
||||||
case SDL_GAMEPADTOUCHPADUP:
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_UP:
|
||||||
SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
|
SDL_Log("Gamepad %" SDL_PRIu32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
|
||||||
event.ctouchpad.which,
|
event.ctouchpad.which,
|
||||||
event.ctouchpad.touchpad,
|
event.ctouchpad.touchpad,
|
||||||
event.ctouchpad.finger,
|
event.ctouchpad.finger,
|
||||||
(event.type == SDL_GAMEPADTOUCHPADDOWN ? "pressed at" : (event.type == SDL_GAMEPADTOUCHPADUP ? "released at" : "moved to")),
|
(event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN ? "pressed at" : (event.type == SDL_EVENT_GAMEPAD_TOUCHPAD_UP ? "released at" : "moved to")),
|
||||||
event.ctouchpad.x,
|
event.ctouchpad.x,
|
||||||
event.ctouchpad.y,
|
event.ctouchpad.y,
|
||||||
event.ctouchpad.pressure);
|
event.ctouchpad.pressure);
|
||||||
|
@ -587,7 +587,7 @@ void loop(void *arg)
|
||||||
|
|
||||||
#define VERBOSE_SENSORS
|
#define VERBOSE_SENSORS
|
||||||
#ifdef VERBOSE_SENSORS
|
#ifdef VERBOSE_SENSORS
|
||||||
case SDL_GAMEPADSENSORUPDATE:
|
case SDL_EVENT_GAMEPAD_SENSOR_UPDATE:
|
||||||
SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
|
SDL_Log("Gamepad %" SDL_PRIu32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
|
||||||
event.csensor.which,
|
event.csensor.which,
|
||||||
GetSensorName((SDL_SensorType)event.csensor.sensor),
|
GetSensorName((SDL_SensorType)event.csensor.sensor),
|
||||||
|
@ -600,7 +600,7 @@ void loop(void *arg)
|
||||||
|
|
||||||
#define VERBOSE_AXES
|
#define VERBOSE_AXES
|
||||||
#ifdef VERBOSE_AXES
|
#ifdef VERBOSE_AXES
|
||||||
case SDL_GAMEPADAXISMOTION:
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
|
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
|
||||||
SetGamepad(event.caxis.which);
|
SetGamepad(event.caxis.which);
|
||||||
}
|
}
|
||||||
|
@ -608,44 +608,44 @@ void loop(void *arg)
|
||||||
break;
|
break;
|
||||||
#endif /* VERBOSE_AXES */
|
#endif /* VERBOSE_AXES */
|
||||||
|
|
||||||
case SDL_GAMEPADBUTTONDOWN:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
case SDL_GAMEPADBUTTONUP:
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
if (event.type == SDL_GAMEPADBUTTONDOWN) {
|
if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN) {
|
||||||
SetGamepad(event.cbutton.which);
|
SetGamepad(event.cbutton.which);
|
||||||
}
|
}
|
||||||
SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", event.cbutton.which, SDL_GetGamepadStringForButton((SDL_GamepadButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
SDL_Log("Gamepad %" SDL_PRIu32 " button %s %s\n", event.cbutton.which, SDL_GetGamepadStringForButton((SDL_GamepadButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
||||||
|
|
||||||
/* Cycle PS5 trigger effects when the microphone button is pressed */
|
/* Cycle PS5 trigger effects when the microphone button is pressed */
|
||||||
if (event.type == SDL_GAMEPADBUTTONDOWN &&
|
if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN &&
|
||||||
event.cbutton.button == SDL_GAMEPAD_BUTTON_MISC1 &&
|
event.cbutton.button == SDL_GAMEPAD_BUTTON_MISC1 &&
|
||||||
SDL_GetGamepadType(gamepad) == SDL_GAMEPAD_TYPE_PS5) {
|
SDL_GetGamepadType(gamepad) == SDL_GAMEPAD_TYPE_PS5) {
|
||||||
CyclePS5TriggerEffect();
|
CyclePS5TriggerEffect();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYBATTERYUPDATED:
|
case SDL_EVENT_JOYSTICK_BATTERY_UPDATED:
|
||||||
SDL_Log("Gamepad %" SDL_PRIu32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
|
SDL_Log("Gamepad %" SDL_PRIu32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
if (virtual_joystick) {
|
if (virtual_joystick) {
|
||||||
VirtualGamepadMouseDown(event.button.x, event.button.y);
|
VirtualGamepadMouseDown(event.button.x, event.button.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_EVENT_MOUSE_BUTTONUP:
|
||||||
if (virtual_joystick) {
|
if (virtual_joystick) {
|
||||||
VirtualGamepadMouseUp(event.button.x, event.button.y);
|
VirtualGamepadMouseUp(event.button.x, event.button.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
if (virtual_joystick) {
|
if (virtual_joystick) {
|
||||||
VirtualGamepadMouseMotion(event.motion.x, event.motion.y);
|
VirtualGamepadMouseMotion(event.motion.x, event.motion.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) {
|
if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) {
|
||||||
if (gamepad) {
|
if (gamepad) {
|
||||||
int player_index = (event.key.keysym.sym - SDLK_0);
|
int player_index = (event.key.keysym.sym - SDLK_0);
|
||||||
|
@ -666,7 +666,7 @@ void loop(void *arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -70,7 +70,7 @@ void loop()
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
|
|
||||||
if (event.type == SDL_MOUSEMOTION) {
|
if (event.type == SDL_EVENT_MOUSE_MOTION) {
|
||||||
if (event.motion.state) {
|
if (event.motion.state) {
|
||||||
float xrel, yrel;
|
float xrel, yrel;
|
||||||
int window_w, window_h;
|
int window_w, window_h;
|
||||||
|
|
|
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
|
||||||
++frames;
|
++frames;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
if (event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
if (event.key.keysym.sym == SDLK_o) {
|
if (event.key.keysym.sym == SDLK_o) {
|
||||||
swap_interval--;
|
swap_interval--;
|
||||||
update_swap_interval = SDL_TRUE;
|
update_swap_interval = SDL_TRUE;
|
||||||
|
|
|
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
++frames;
|
++frames;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_WINDOWEVENT_RESIZED) {
|
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
|
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
|
||||||
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
|
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
|
||||||
|
|
|
@ -567,7 +567,7 @@ loop_threaded()
|
||||||
|
|
||||||
/* Wait for events */
|
/* Wait for events */
|
||||||
while (SDL_WaitEvent(&event) && !done) {
|
while (SDL_WaitEvent(&event) && !done) {
|
||||||
if (event.type == SDL_WINDOWEVENT_CLOSE) {
|
if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
||||||
if (window) {
|
if (window) {
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
|
|
|
@ -331,7 +331,7 @@ void loop()
|
||||||
++frames;
|
++frames;
|
||||||
while (SDL_PollEvent(&event) && !done) {
|
while (SDL_PollEvent(&event) && !done) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
{
|
{
|
||||||
const int sym = event.key.keysym.sym;
|
const int sym = event.key.keysym.sym;
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ void loop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
|
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
|
@ -104,19 +104,19 @@ int main(int argc, char **argv)
|
||||||
nothing_to_do = 0;
|
nothing_to_do = 0;
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
SDL_Log("button down!\n");
|
SDL_Log("button down!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_EVENT_MOUSE_BUTTONUP:
|
||||||
SDL_Log("button up!\n");
|
SDL_Log("button up!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_EVENT_WINDOW_MOVED:
|
||||||
SDL_Log("Window event moved to (%d, %d)!\n", (int)e.window.data1, (int)e.window.data2);
|
SDL_Log("Window event moved to (%d, %d)!\n", (int)e.window.data1, (int)e.window.data2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
if (e.key.keysym.sym == SDLK_ESCAPE) {
|
||||||
done = 1;
|
done = 1;
|
||||||
} else if (e.key.keysym.sym == SDLK_x) {
|
} else if (e.key.keysym.sym == SDLK_x) {
|
||||||
|
@ -130,7 +130,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,10 +63,10 @@ int main(int argc, char *argv[])
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
keepGoing = SDL_FALSE;
|
keepGoing = SDL_FALSE;
|
||||||
break;
|
break;
|
||||||
case SDL_JOYDEVICEADDED:
|
case SDL_EVENT_JOYSTICK_ADDED:
|
||||||
if (joystick != NULL) {
|
if (joystick != NULL) {
|
||||||
SDL_Log("Only one joystick supported by this test\n");
|
SDL_Log("Only one joystick supported by this test\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYDEVICEREMOVED:
|
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||||
if (instance == event.jdevice.which) {
|
if (instance == event.jdevice.which) {
|
||||||
SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
|
SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
|
||||||
instance = 0;
|
instance = 0;
|
||||||
|
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_Log("Unknown joystick diconnected\n");
|
SDL_Log("Unknown joystick diconnected\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
|
||||||
/*
|
/*
|
||||||
// SDL_Log("Axis Move: %d\n", event.jaxis.axis);
|
// SDL_Log("Axis Move: %d\n", event.jaxis.axis);
|
||||||
*/
|
*/
|
||||||
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||||
SDL_Log("Button Press: %d\n", event.jbutton.button);
|
SDL_Log("Button Press: %d\n", event.jbutton.button);
|
||||||
if (enable_haptic && haptic) {
|
if (enable_haptic && haptic) {
|
||||||
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
||||||
|
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
||||||
keepGoing = SDL_FALSE;
|
keepGoing = SDL_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||||
SDL_Log("Button Release: %d\n", event.jbutton.button);
|
SDL_Log("Button Release: %d\n", event.jbutton.button);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
text[0] = 0x00;
|
text[0] = 0x00;
|
||||||
|
@ -764,7 +764,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_GetKeyName(event.key.keysym.sym));
|
SDL_GetKeyName(event.key.keysym.sym));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_TEXTINPUT:
|
case SDL_EVENT_TEXT_INPUT:
|
||||||
if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || markedRect.w < 0) {
|
if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || markedRect.w < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ int main(int argc, char *argv[])
|
||||||
Redraw();
|
Redraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_TEXTEDITING:
|
case SDL_EVENT_TEXT_EDITING:
|
||||||
SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n",
|
SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n",
|
||||||
event.edit.text, event.edit.start, event.edit.length);
|
event.edit.text, event.edit.start, event.edit.length);
|
||||||
|
|
||||||
|
|
|
@ -217,11 +217,11 @@ void loop()
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
mouse_begin_x = event.button.x;
|
mouse_begin_x = event.button.x;
|
||||||
mouse_begin_y = event.button.y;
|
mouse_begin_y = event.button.y;
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_EVENT_MOUSE_BUTTONUP:
|
||||||
if (event.button.button == 3) {
|
if (event.button.button == 3) {
|
||||||
add_line(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
|
add_line(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ void loop()
|
||||||
add_rect(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
|
add_rect(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
case 'l':
|
case 'l':
|
||||||
if (event.key.keysym.mod & SDL_KMOD_SHIFT) {
|
if (event.key.keysym.mod & SDL_KMOD_SHIFT) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ void loop(void *arg)
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
|
||||||
case SDL_JOYDEVICEADDED:
|
case SDL_EVENT_JOYSTICK_ADDED:
|
||||||
SDL_Log("Joystick device %" SDL_PRIu32 " added.\n", event.jdevice.which);
|
SDL_Log("Joystick device %" SDL_PRIu32 " added.\n", event.jdevice.which);
|
||||||
if (joystick == NULL) {
|
if (joystick == NULL) {
|
||||||
joystick = SDL_OpenJoystick(event.jdevice.which);
|
joystick = SDL_OpenJoystick(event.jdevice.which);
|
||||||
|
@ -123,7 +123,7 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYDEVICEREMOVED:
|
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||||
SDL_Log("Joystick device %" SDL_PRIu32 " removed.\n", event.jdevice.which);
|
SDL_Log("Joystick device %" SDL_PRIu32 " removed.\n", event.jdevice.which);
|
||||||
if (event.jdevice.which == SDL_GetJoystickInstanceID(joystick)) {
|
if (event.jdevice.which == SDL_GetJoystickInstanceID(joystick)) {
|
||||||
SDL_JoystickID *joysticks;
|
SDL_JoystickID *joysticks;
|
||||||
|
@ -146,12 +146,12 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
|
||||||
SDL_Log("Joystick %" SDL_PRIu32 " axis %d value: %d\n",
|
SDL_Log("Joystick %" SDL_PRIu32 " axis %d value: %d\n",
|
||||||
event.jaxis.which,
|
event.jaxis.which,
|
||||||
event.jaxis.axis, event.jaxis.value);
|
event.jaxis.axis, event.jaxis.value);
|
||||||
break;
|
break;
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_EVENT_JOYSTICK_HAT_MOTION:
|
||||||
SDL_Log("Joystick %" SDL_PRIu32 " hat %d value:",
|
SDL_Log("Joystick %" SDL_PRIu32 " hat %d value:",
|
||||||
event.jhat.which, event.jhat.hat);
|
event.jhat.which, event.jhat.hat);
|
||||||
if (event.jhat.value == SDL_HAT_CENTERED) {
|
if (event.jhat.value == SDL_HAT_CENTERED) {
|
||||||
|
@ -171,7 +171,7 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
SDL_Log("\n");
|
SDL_Log("\n");
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||||
SDL_Log("Joystick %" SDL_PRIu32 " button %d down\n",
|
SDL_Log("Joystick %" SDL_PRIu32 " button %d down\n",
|
||||||
event.jbutton.which, event.jbutton.button);
|
event.jbutton.which, event.jbutton.button);
|
||||||
/* First button triggers a 0.5 second full strength rumble */
|
/* First button triggers a 0.5 second full strength rumble */
|
||||||
|
@ -179,11 +179,11 @@ void loop(void *arg)
|
||||||
SDL_RumbleJoystick(joystick, 0xFFFF, 0xFFFF, 500);
|
SDL_RumbleJoystick(joystick, 0xFFFF, 0xFFFF, 500);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||||
SDL_Log("Joystick %" SDL_PRIu32 " button %d up\n",
|
SDL_Log("Joystick %" SDL_PRIu32 " button %d up\n",
|
||||||
event.jbutton.which, event.jbutton.button);
|
event.jbutton.which, event.jbutton.button);
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
/* Press the L key to lag for 3 seconds, to see what happens
|
/* Press the L key to lag for 3 seconds, to see what happens
|
||||||
when SDL doesn't service the event loop quickly. */
|
when SDL doesn't service the event loop quickly. */
|
||||||
if (event.key.keysym.sym == SDLK_l) {
|
if (event.key.keysym.sym == SDLK_l) {
|
||||||
|
@ -197,9 +197,9 @@ void loop(void *arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -47,10 +47,10 @@ int main(int argc, char **argv)
|
||||||
while (keep_going) {
|
while (keep_going) {
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
keep_going = SDL_FALSE;
|
keep_going = SDL_FALSE;
|
||||||
} else if (e.type == SDL_LOCALECHANGED) {
|
} else if (e.type == SDL_EVENT_LOCALE_CHANGED) {
|
||||||
SDL_Log("Saw SDL_LOCALECHANGED event!");
|
SDL_Log("Saw SDL_EVENT_LOCALE_CHANGED event!");
|
||||||
log_locales();
|
log_locales();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
while (SDL_WaitEvent(&event)) {
|
while (SDL_WaitEvent(&event)) {
|
||||||
if (event.type == SDL_QUIT || event.type == SDL_KEYUP) {
|
if (event.type == SDL_EVENT_QUIT || event.type == SDL_EVENT_KEY_UP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ void loop(void *arg)
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_EVENT_MOUSE_WHEEL:
|
||||||
if (event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) {
|
if (event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) {
|
||||||
event.wheel.x *= -1;
|
event.wheel.x *= -1;
|
||||||
event.wheel.y *= -1;
|
event.wheel.y *= -1;
|
||||||
|
@ -127,7 +127,7 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
if (active == NULL) {
|
if (active == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ void loop(void *arg)
|
||||||
active->y2 = event.motion.y;
|
active->y2 = event.motion.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
if (active == NULL) {
|
if (active == NULL) {
|
||||||
active = SDL_calloc(1, sizeof(*active));
|
active = SDL_calloc(1, sizeof(*active));
|
||||||
active->x1 = active->x2 = event.button.x;
|
active->x1 = active->x2 = event.button.x;
|
||||||
|
@ -170,7 +170,7 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_EVENT_MOUSE_BUTTONUP:
|
||||||
if (active == NULL) {
|
if (active == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_EVENT_KEY_UP:
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
case SDLK_LSHIFT:
|
case SDLK_LSHIFT:
|
||||||
isRect = (event.key.state == SDL_PRESSED);
|
isRect = (event.key.state == SDL_PRESSED);
|
||||||
|
@ -211,7 +211,7 @@ void loop(void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -180,11 +180,11 @@ int main(int argc, char *argv[])
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_WINDOWEVENT_EXPOSED:
|
case SDL_EVENT_WINDOW_EXPOSED:
|
||||||
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -75,7 +75,7 @@ void loop()
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,24 +229,24 @@ void loop()
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
|
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
SDL_SetRenderViewport(renderer, NULL);
|
SDL_SetRenderViewport(renderer, NULL);
|
||||||
window_w = event.window.data1;
|
window_w = event.window.data1;
|
||||||
window_h = event.window.data2;
|
window_h = event.window.data2;
|
||||||
displayrect.w = (float)window_w;
|
displayrect.w = (float)window_w;
|
||||||
displayrect.h = (float)window_h;
|
displayrect.h = (float)window_h;
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_EVENT_MOUSE_BUTTONDOWN:
|
||||||
displayrect.x = event.button.x - window_w / 2;
|
displayrect.x = event.button.x - window_w / 2;
|
||||||
displayrect.y = event.button.y - window_h / 2;
|
displayrect.y = event.button.y - window_h / 2;
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
if (event.motion.state) {
|
if (event.motion.state) {
|
||||||
displayrect.x = event.motion.x - window_w / 2;
|
displayrect.x = event.motion.x - window_w / 2;
|
||||||
displayrect.y = event.motion.y - window_h / 2;
|
displayrect.y = event.motion.y - window_h / 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (event.key.keysym.sym == SDLK_SPACE) {
|
if (event.key.keysym.sym == SDLK_SPACE) {
|
||||||
paused = !paused;
|
paused = !paused;
|
||||||
break;
|
break;
|
||||||
|
@ -494,7 +494,7 @@ int main(int argc, char **argv)
|
||||||
displayrect.h = (float)window_h;
|
displayrect.h = (float)window_h;
|
||||||
|
|
||||||
/* Ignore key up events, they don't even get filtered */
|
/* Ignore key up events, they don't even get filtered */
|
||||||
SDL_SetEventEnabled(SDL_KEYUP, SDL_FALSE);
|
SDL_SetEventEnabled(SDL_EVENT_KEY_UP, SDL_FALSE);
|
||||||
|
|
||||||
/* Main render loop */
|
/* Main render loop */
|
||||||
frames = 0;
|
frames = 0;
|
||||||
|
|
|
@ -44,7 +44,7 @@ loop()
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
{
|
{
|
||||||
mouseX += event.motion.xrel;
|
mouseX += event.motion.xrel;
|
||||||
mouseY += event.motion.yrel;
|
mouseY += event.motion.yrel;
|
||||||
|
|
|
@ -101,14 +101,14 @@ int main(int argc, char **argv)
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
/* Process all currently pending events */
|
/* Process all currently pending events */
|
||||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
|
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) == 1) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_SENSORUPDATE:
|
case SDL_EVENT_SENSOR_UPDATE:
|
||||||
HandleSensorEvent(&event.sensor);
|
HandleSensorEvent(&event.sensor);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_EVENT_MOUSE_BUTTONUP:
|
||||||
case SDL_KEYUP:
|
case SDL_EVENT_KEY_UP:
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -493,10 +493,10 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_QUIT) {
|
if (event.type == SDL_EVENT_QUIT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
if (event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
if (event.key.keysym.sym == SDLK_SPACE) {
|
if (event.key.keysym.sym == SDLK_SPACE) {
|
||||||
current_shader = (current_shader + 1) % NUM_SHADERS;
|
current_shader = (current_shader + 1) % NUM_SHADERS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,14 +168,14 @@ int main(int argc, char **argv)
|
||||||
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
|
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
|
||||||
while (should_exit == 0) {
|
while (should_exit == 0) {
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
button_down = 1;
|
button_down = 1;
|
||||||
if (event.key.keysym.sym == SDLK_ESCAPE) {
|
if (event.key.keysym.sym == SDLK_ESCAPE) {
|
||||||
should_exit = 1;
|
should_exit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (button_down && event.type == SDL_KEYUP) {
|
if (button_down && event.type == SDL_EVENT_KEY_UP) {
|
||||||
button_down = 0;
|
button_down = 0;
|
||||||
current_picture += 1;
|
current_picture += 1;
|
||||||
if (current_picture >= num_pictures) {
|
if (current_picture >= num_pictures) {
|
||||||
|
@ -186,7 +186,7 @@ int main(int argc, char **argv)
|
||||||
SDL_SetWindowSize(window, texture_dimensions.w, texture_dimensions.h);
|
SDL_SetWindowSize(window, texture_dimensions.w, texture_dimensions.h);
|
||||||
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
|
SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode);
|
||||||
}
|
}
|
||||||
if (event.type == SDL_QUIT) {
|
if (event.type == SDL_EVENT_QUIT) {
|
||||||
should_exit = 1;
|
should_exit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ void loop()
|
||||||
|
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_QUIT || event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_EVENT_QUIT || event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,12 @@ void loop()
|
||||||
|
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (event.key.keysym.sym == SDLK_ESCAPE) {
|
if (event.key.keysym.sym == SDLK_ESCAPE) {
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1125,7 +1125,7 @@ int main(int argc, char **argv)
|
||||||
/* Need to destroy the swapchain before the window created
|
/* Need to destroy the swapchain before the window created
|
||||||
* by SDL.
|
* by SDL.
|
||||||
*/
|
*/
|
||||||
if (event.type == SDL_WINDOWEVENT_CLOSE) {
|
if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
|
||||||
destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE);
|
destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE);
|
||||||
}
|
}
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
|
|
|
@ -151,7 +151,7 @@ void loop()
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
SDLTest_CommonEvent(state, &event, &done);
|
SDLTest_CommonEvent(state, &event, &done);
|
||||||
|
|
||||||
if (event.type == SDL_WINDOWEVENT_RESIZED) {
|
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
||||||
if (window) {
|
if (window) {
|
||||||
SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n",
|
SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n",
|
||||||
|
@ -160,7 +160,7 @@ void loop()
|
||||||
event.window.data2);
|
event.window.data2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == SDL_WINDOWEVENT_MOVED) {
|
if (event.type == SDL_EVENT_WINDOW_MOVED) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
||||||
if (window) {
|
if (window) {
|
||||||
SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n",
|
SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n",
|
||||||
|
@ -170,18 +170,18 @@ void loop()
|
||||||
SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
|
SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == SDL_WINDOWEVENT_FOCUS_LOST) {
|
if (event.type == SDL_EVENT_WINDOW_FOCUS_LOST) {
|
||||||
relative_mode = SDL_GetRelativeMouseMode();
|
relative_mode = SDL_GetRelativeMouseMode();
|
||||||
if (relative_mode) {
|
if (relative_mode) {
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
if (event.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
|
||||||
if (relative_mode) {
|
if (relative_mode) {
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == SDL_KEYUP) {
|
if (event.type == SDL_EVENT_KEY_UP) {
|
||||||
SDL_bool updateCursor = SDL_FALSE;
|
SDL_bool updateCursor = SDL_FALSE;
|
||||||
|
|
||||||
if (event.key.keysym.sym == SDLK_LEFT) {
|
if (event.key.keysym.sym == SDLK_LEFT) {
|
||||||
|
@ -204,7 +204,7 @@ void loop()
|
||||||
SDL_SetCursor(cursor);
|
SDL_SetCursor(cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == SDL_MOUSEBUTTONUP) {
|
if (event.type == SDL_EVENT_MOUSE_BUTTONUP) {
|
||||||
SDL_Window *window = SDL_GetMouseFocus();
|
SDL_Window *window = SDL_GetMouseFocus();
|
||||||
if (highlighted_mode != -1 && window != NULL) {
|
if (highlighted_mode != -1 && window != NULL) {
|
||||||
const int display_index = SDL_GetWindowDisplayIndex(window);
|
const int display_index = SDL_GetWindowDisplayIndex(window);
|
||||||
|
@ -271,8 +271,8 @@ int main(int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetEventEnabled(SDL_DROPFILE, SDL_TRUE);
|
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_TRUE);
|
||||||
SDL_SetEventEnabled(SDL_DROPTEXT, SDL_TRUE);
|
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_TRUE);
|
||||||
|
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
SDL_Renderer *renderer = state->renderers[i];
|
SDL_Renderer *renderer = state->renderers[i];
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue