SDL_PenProximityEvent(3type)
π SDL_PenProximityEvent π
okay bestie, welcome to the SDL3 DATATYPES corner of the manual, where we're talking about SDL_PenProximityEvent β that's the pressure-sensitive pen proximity event structure, aka event.pproximity.* β¨
β¨ NAME β¨
SDL_PenProximityEvent β the pressure-sensitive pen proximity event structure, living its best life at event.pproximity.* ποΈ
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_events.h>
typedef struct SDL_PenProximityEvent
{
SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with pen focus, if any */
SDL_PenID which; /**< The pen instance id */
SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event (added in 3.4.16). */
SDL_PenDeviceType device_type; /**< the device type of the pen, if known (added in 3.4.18). */
} SDL_PenProximityEvent;
no cap, that's the whole struct. let's break it down π«Ά
π¦ DESCRIPTION π¦
so here's the vibe: when a pen becomes visible to the system β like, it's close enough to a tablet, etc β SDL is gonna send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's ID. π
that ID stays valid until the pen leaves proximity again (removed from the tablet's area, tablet got unplugged, etc). and if the same pen reenters proximity later? it gets a brand new ID. new era, new identity, main character reboot π
lowkey important: "proximity" here just means "close enough for the tablet to know the tool is there." the pen actually touching down and lifting off while it never leaves the area is a whole different situation β that's handled bySDL_EVENT_PEN_DOWNandSDL_EVENT_PEN_UP. don't mix them up bestie π
also, not all platforms have a window associated with the pen during proximity events. some of them wait until motion/button/etc events to offer up that info. so like, it's giving "sometimes the windowID is just not there yet" π
π AVAILABILITY π
this struct has been available since SDL 3.2.0. iconic behavior honestly π
and that's the whole page!! β¨ written up in the Simple Directmedia Layer docs, SDL version 3.4.18, dated with the same SDL 3.4.18 stamp on the footer β mwah, tysm for reading, go forth and track your pens ποΈπ
π¦ 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