SDL_ActiveEvent(3)
π SDL_ActiveEvent π
okay bestie, welcome to SDL_ActiveEvent(3) β part of the SDL API Reference, and honestly? it's the little struct that tells you when your app is getting attention or getting ignored. main character energy vs. being left on read, basically. π«Ά
πΈ NAME πΈ
SDL_ActiveEvent β the application visibility event structure. it's giving "is my window even relevant right now" π
β¨ STRUCTURE DEFINITION β¨
here's the whole thing, no cap, type it exactly like this:
typedef struct{
Uint8 type;
Uint8 gain;
Uint8 state;
} SDL_ActiveEvent;
three little Uint8s and the whole vibe check of your window's existence. iconic.
π STRUCTURE DATA π
typeβ it'sSDL_ACTIVEEVENT. that's the whole job. slay.gainβ0if the event is a loss, or1if it is a gain. so like...0= not me getting the focus π,1= yesss bestie we're so back β¨stateβ tells you what got gained or lost, and it's one of these three:SDL_APPMOUSEFOCUSif mouse focus was gained or lost,SDL_APPINPUTFOCUSif input focus was gained or lost,- or
SDL_APPACTIVEif the application was iconified (gain=0) or restored (gain=1).
π DESCRIPTION π
so SDL_ActiveEvent is a member of the SDL_Event union, and it's the one that shows up whenever an event of type SDL_ACTIVEEVENT gets reported. it's lowkey the struct that keeps tabs on whether anyone's paying attention to you.
here's the tea, one flavour at a time β:
when the mouse leaves or enters the window area, a SDL_APPMOUSEFOCUS type activation event happens. if the mouse entered the window then gain will be 1, otherwise gain will be 0. simple as that, periodt. π
a SDL_APPINPUTFOCUS type activation event happens when the application loses or gains keyboard focus. this usually occurs when another application is made active β yes, the classic "someone else stole the aux" situation. πβ¨οΈ
and finally, a SDL_APPACTIVE type event happens when the application is either minimised/iconified (gain=0) or restored. going to sleep vs. waking up glowing. π
Note: this event does not occur when an application window is first created. like, the very first moment of existence? no event. your app is born in silence, no confetti. π keep that in mind so you don't sit there waiting for a notification that is literally never coming.
π¦ SEE ALSO π¦
SDL_EventSDL_GetAppState
and that's the whole page, bestie β written by the SDL crew, version notes and all, dated Tue 11 Sep 2001, 22:59, filed under SDL_ActiveEvent(3). go forth and vibe-check your windows. π
β¨π
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms