add alternate raw mouse motion events with windows implementation (#10042)

This commit is contained in:
expikr
2024-12-19 09:29:27 +08:00
committed by GitHub
parent 345cab1e36
commit 5c0f8dc179
10 changed files with 221 additions and 75 deletions

View File

@@ -182,6 +182,9 @@ typedef enum SDL_EventType
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 */
SDL_EVENT_MOUSE_RAW_MOTION, /**< Mouse moved (raw motion deltas) */
SDL_EVENT_MOUSE_RAW_BUTTON, /**< Mouse click (raw button delta) */
SDL_EVENT_MOUSE_RAW_SCROLL, /**< Mouse wheel (raw scroll deltas) */
/* Joystick events */
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
@@ -454,6 +457,23 @@ typedef struct SDL_MouseMotionEvent
float yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/**
* Mouse raw motion and wheel event structure (event.maxis.*)
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_MouseRawAxisEvent
{
SDL_EventType type; /**< SDL_EVENT_MOUSE_RAW_MOTION or SDL_EVENT_MOUSE_RAW_SCROLL */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
int dx; /**< The axis delta value in the X direction */
int dy; /**< The axis delta value in the Y direction */
float ux; /**< The denominator unit in the X direction */
float uy; /**< The denominator unit in the Y direction */
} SDL_MouseRawAxisEvent;
/**
* Mouse button event structure (event.button.*)
*
@@ -474,6 +494,21 @@ typedef struct SDL_MouseButtonEvent
float y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;
/**
* Mouse raw button event structure (event.mbutton.*)
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_MouseRawButtonEvent
{
SDL_EventType type; /**< SDL_EVENT_MOUSE_RAW_BUTTON */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
} SDL_MouseRawButtonEvent;
/**
* Mouse wheel event structure (event.wheel.*)
*
@@ -997,6 +1032,8 @@ typedef union SDL_Event
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
SDL_MouseButtonEvent button; /**< Mouse button event data */
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
SDL_MouseRawAxisEvent maxis; /**< Mouse raw axis event data (motion or wheel deltas) */
SDL_MouseRawButtonEvent mbutton; /**< Mouse raw button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
SDL_JoyBallEvent jball; /**< Joystick ball event data */