events: Add pinch event category

Needed to allow SDL_GetWindowFromEvent() to work with pinch events.

(cherry picked from commit 6b18df27f7)
This commit is contained in:
Frank Praznik
2026-08-28 11:22:05 -04:00
parent c589241ba1
commit 8b2ecd481b
2 changed files with 9 additions and 0 deletions

View File

@@ -140,6 +140,11 @@ SDL_EventCategory SDL_GetEventCategory(Uint32 type)
case SDL_EVENT_FINGER_MOTION:
return SDL_EVENTCATEGORY_TFINGER;
case SDL_EVENT_PINCH_BEGIN:
case SDL_EVENT_PINCH_UPDATE:
case SDL_EVENT_PINCH_END:
return SDL_EVENTCATEGORY_PINCH;
case SDL_EVENT_CLIPBOARD_UPDATE:
return SDL_EVENTCATEGORY_CLIPBOARD;
@@ -240,6 +245,9 @@ SDL_Window *SDL_GetWindowFromEvent(const SDL_Event *event)
case SDL_EVENTCATEGORY_RENDER:
windowID = event->render.windowID;
break;
case SDL_EVENTCATEGORY_PINCH:
windowID = event->pinch.windowID;
break;
default:
// < 0 -> invalid event type (error is set by SDL_GetEventCategory)
// else -> event has no associated window (not an error)

View File

@@ -63,6 +63,7 @@ typedef enum SDL_EventCategory
SDL_EVENTCATEGORY_DROP,
SDL_EVENTCATEGORY_CLIPBOARD,
SDL_EVENTCATEGORY_RENDER,
SDL_EVENTCATEGORY_PINCH,
} SDL_EventCategory;
extern SDL_EventCategory SDL_GetEventCategory(Uint32 type);