SDL_DropEvent(3type)
β¨ SDL_DropEvent β¨
okay so bestie, gather round, because this is the SDL3 DATATYPES moment where we talk about SDL_DropEvent β the lil struct that shows up when somebody drops text on your app or when the system is like "hey, open this file for me". You'll find it hanging out in the event.drop.* family π
πΈ NAME πΈ
SDL_DropEvent β an event used to drop text or request a file open by the system (that's the event.drop.* crew, iykyk) π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_events.h>
typedef struct SDL_DropEvent
{
SDL_EventType type; /**< SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window that was dropped on, if any */
float x; /**< X coordinate, relative to window (not on begin) */
float y; /**< Y coordinate, relative to window (not on begin) */
const char *source; /**< The source app that sent this drop event, or NULL if that isn't available */
const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
} SDL_DropEvent;
π The Fields, One By One π
π type
An SDL_EventType, and it's gonna be one of these babes:
SDL_EVENT_DROP_BEGINSDL_EVENT_DROP_FILESDL_EVENT_DROP_TEXTSDL_EVENT_DROP_COMPLETESDL_EVENT_DROP_POSITION
π reserved
A Uint32 that is just... there. Reserved. Not your business, not my business π
π timestamp
A Uint64, measured in nanoseconds, populated using SDL_GetTicksNS(). Slay, precise to the nano β¨
π windowID
An SDL_WindowID β the window that was dropped on, if any. No window? No problem, it just won't be there πͺ
π x
A float: the X coordinate, relative to the window. (Not on begin, bestie β don't come for me.) π
π y
A float: the Y coordinate, relative to the window. (Also not on begin. Same deal.) π
π source
A const char * β the source app that sent this drop event, or NULL if that isn't available. Sometimes the mystery stays a mystery π
π data
A const char * β this one's the moment fr fr: it's the text for SDL_EVENT_DROP_TEXT, and the file name for SDL_EVENT_DROP_FILE. For other events? NULL. Periodt. π
π AVAILABILITY π
This struct has been available since SDL 3.2.0. It's giving established, it's giving iconic π
not me being emotionally attached to a struct with eight fields. anyway, if you're handling drops, checktypefirst, then go grab yourdataβ you got this π¦
okay bestie that's the whole page!! this came to you courtesy of Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_DropEvent(3type) manual page β mwah, go drop something cute πβ¨π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms