Add SDL Pinch events (#9445)

This commit is contained in:
Sylvain Becker
2025-10-12 23:44:23 +02:00
committed by GitHub
parent e2195621d7
commit 71bf56c9e4
21 changed files with 605 additions and 13 deletions

View File

@@ -218,6 +218,11 @@ typedef enum SDL_EventType
SDL_EVENT_FINGER_MOTION,
SDL_EVENT_FINGER_CANCELED,
/* Pinch events */
SDL_EVENT_PINCH_BEGIN = 0x710, /**< Pinch gesture started */
SDL_EVENT_PINCH_UPDATE, /**< Pinch gesture updated */
SDL_EVENT_PINCH_END, /**< Pinch gesture ended */
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
/* Clipboard events */
@@ -788,6 +793,18 @@ typedef struct SDL_TouchFingerEvent
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_TouchFingerEvent;
/**
* Pinch event structure (event.pinch.*)
*/
typedef struct SDL_PinchFingerEvent
{
SDL_EventType type; /**< ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
float scale; /**< The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in". */
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_PinchFingerEvent;
/**
* Pressure-sensitive pen proximity event structure (event.pproximity.*)
*
@@ -1025,6 +1042,7 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_PinchFingerEvent pinch; /**< Pinch event data */
SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
SDL_PenMotionEvent pmotion; /**< Pen motion event data */

View File

@@ -436,6 +436,7 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 1
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_SCROLLINFO 1
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_GESTURE @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_GESTURE@
#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR 1
#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE 1