Initial support for hotplugging mice and keyboards
This commit is contained in:
@@ -143,12 +143,16 @@ typedef enum
|
||||
SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
|
||||
SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
|
||||
input language or keyboard layout change. */
|
||||
SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
|
||||
SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */
|
||||
|
||||
/* Mouse events */
|
||||
SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
|
||||
SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
|
||||
SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
|
||||
SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
|
||||
SDL_EVENT_MOUSE_ADDED, /**< A new mouse has been inserted into the system */
|
||||
SDL_EVENT_MOUSE_REMOVED, /**< A mouse has been removed */
|
||||
|
||||
/* Joystick events */
|
||||
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
|
||||
@@ -270,6 +274,17 @@ typedef struct SDL_WindowEvent
|
||||
Sint32 data2; /**< event dependent data */
|
||||
} SDL_WindowEvent;
|
||||
|
||||
/**
|
||||
* Keyboard device event structure (event.kdevice.*)
|
||||
*/
|
||||
typedef struct SDL_KeyboardDeviceEvent
|
||||
{
|
||||
SDL_EventType type; /**< ::SDL_EVENT_KEYBOARD_ADDED or ::SDL_EVENT_KEYBOARD_REMOVED */
|
||||
Uint32 reserved;
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_KeyboardID which; /**< The keyboard instance id */
|
||||
} SDL_KeyboardDeviceEvent;
|
||||
|
||||
/**
|
||||
* Keyboard button event structure (event.key.*)
|
||||
*/
|
||||
@@ -279,6 +294,7 @@ typedef struct SDL_KeyboardEvent
|
||||
Uint32 reserved;
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
|
||||
SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
Uint8 repeat; /**< Non-zero if this is a key repeat */
|
||||
Uint8 padding2;
|
||||
@@ -320,6 +336,17 @@ typedef struct SDL_TextInputEvent
|
||||
char *text; /**< The input text */
|
||||
} SDL_TextInputEvent;
|
||||
|
||||
/**
|
||||
* Mouse device event structure (event.mdevice.*)
|
||||
*/
|
||||
typedef struct SDL_MouseDeviceEvent
|
||||
{
|
||||
SDL_EventType type; /**< ::SDL_EVENT_MOUSE_ADDED or ::SDL_EVENT_MOUSE_REMOVED */
|
||||
Uint32 reserved;
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_MouseID which; /**< The mouse instance id */
|
||||
} SDL_MouseDeviceEvent;
|
||||
|
||||
/**
|
||||
* Mouse motion event structure (event.motion.*)
|
||||
*/
|
||||
@@ -718,21 +745,23 @@ typedef union SDL_Event
|
||||
SDL_CommonEvent common; /**< Common event data */
|
||||
SDL_DisplayEvent display; /**< Display event data */
|
||||
SDL_WindowEvent window; /**< Window event data */
|
||||
SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */
|
||||
SDL_KeyboardEvent key; /**< Keyboard event data */
|
||||
SDL_TextEditingEvent edit; /**< Text editing event data */
|
||||
SDL_TextInputEvent text; /**< Text input event data */
|
||||
SDL_MouseDeviceEvent mdevice; /**< Mouse device change event data */
|
||||
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
|
||||
SDL_MouseButtonEvent button; /**< Mouse button event data */
|
||||
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
|
||||
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
|
||||
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
|
||||
SDL_JoyBallEvent jball; /**< Joystick ball event data */
|
||||
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
|
||||
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
|
||||
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
|
||||
SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
|
||||
SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
|
||||
SDL_GamepadAxisEvent gaxis; /**< Gamepad axis event data */
|
||||
SDL_GamepadButtonEvent gbutton; /**< Gamepad button event data */
|
||||
SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
|
||||
SDL_GamepadTouchpadEvent gtouchpad; /**< Gamepad touchpad event data */
|
||||
SDL_GamepadSensorEvent gsensor; /**< Gamepad sensor event data */
|
||||
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
|
||||
|
||||
Reference in New Issue
Block a user