SDL_TEXTEDITINGCANDIDATESEVENT(3type)

πŸ’– SDL_TextEditingCandidatesEvent πŸ’–

okay bestie, sit DOWN, because this one is literally the keyboard IME candidates event structure, and it lives at event.edit_candidates.*. yes, that's a real path, that's its whole address. it's a 3type page from the SDL3 DATATYPES crew and it's giving "your IME is trying to show you a lil menu of options" energy. πŸŽ€


✨ NAME ✨

SDL_TextEditingCandidatesEvent β€” Keyboard IME candidates event structure (and yes, the fields hang out under event.edit_candidates.*, iykyk) πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_events.h>

typedef struct SDL_TextEditingCandidatesEvent
{
    SDL_EventType type;         /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */
    Uint32 reserved;
    Uint64 timestamp;           /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_WindowID windowID;      /**< The window with keyboard focus, if any */
    const char * const *candidates;    /**< The list of candidates, or NULL if there are no candidates available */
    Sint32 num_candidates;      /**< The number of strings in `candidates` */
    Sint32 selected_candidate;  /**< The index of the selected candidate, or -1 if no candidate is selected */
    bool horizontal;          /**< true if the list is horizontal, false if it's vertical */
    Uint8 padding1;
    Uint8 padding2;
    Uint8 padding3;
} SDL_TextEditingCandidatesEvent;

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, field by field, no skipping, we do not gatekeep here πŸ’…

  • type β€” it's an SDL_EventType and it's always SDL_EVENT_TEXT_EDITING_CANDIDATES. that's the vibe check, that's how you know who you're dealing with.
  • reserved β€” a Uint32 doing absolutely nothing. main character energy of just standing there. don't touch it, bestie.
  • timestamp β€” a Uint64 in nanoseconds, and it's populated using SDL_GetTicksNS(). it's the "when did this happen" receipt. ⏱️
  • windowID β€” an SDL_WindowID: the window with keyboard focus, if any. "if any" being the key phrase, so don't assume it's always there, ok?
  • candidates β€” a const char * const *, aka the list of candidates, or NULL if there are no candidates available. so like, sometimes the list is empty-empty, and NULL is how it tells you. πŸ™ˆ
  • num_candidates β€” a Sint32, the number of strings in candidates. count 'em. literally.
  • selected_candidate β€” a Sint32: the index of the selected candidate, or -1 if no candidate is selected. so -1 is the "nobody's picked yet" mood. 😭
  • horizontal β€” a bool: true if the list is horizontal, false if it's vertical. layout lore. ✨
  • padding1, padding2, padding3 β€” three Uint8s of pure structural filler. they exist. they are padding. that's the whole job. 🧚

🌈 AVAILABILITY 🌈

this struct is available since SDL 3.2.0. so if you're on something older, it's simply not there, no cap. 🫢


lowkey reminder: copy the struct exactly as shown, padding and all, because those padding1 / padding2 / padding3 bytes are not decorative, bestie. πŸ”₯

and that's the whole page, you ate it πŸ’– this was the Simple Directmedia Layer era, SDL 3.4.18, SDL_TextEditingCandidatesEvent(3type) β€” go forth and handle your IME candidates, queen πŸ‘‘πŸŽ€β­

πŸ“¦ where this page comes from