SDL_HasPrimarySelectionText(3)

πŸ’– SDL_HasPrimarySelectionText πŸ’–

okay bestie so this is a lil function from the SDL3 FUNCTIONS crew, and her whole entire job is: does the primary selection even exist, and is there actually some non-empty text sitting in it? that's it. that's the vibe. she's the vibe check for your clipboard-adjacent situation ✨


✨ NAME ✨

SDL_HasPrimarySelectionText β€” ask the universe whether the primary selection exists and whether it's holding a non-empty text string 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_clipboard.h>

bool SDL_HasPrimarySelectionText(void);

like. she takes no arguments. zero. nada. she's just a lil yes/no girlie πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

  • true β€” yesss, the primary selection has text in it πŸ’–
  • false β€” nope, no text there, sorry babe 😭

🧚 THREAD SAFETY 🧚

⚠️ okay this is the important one: this function should only be called on the main thread. do NOT be out here calling her from a worker thread, that's not the move. main thread only. periodt. πŸ‘‘

🌈 AVAILABILITY 🌈

she's been around since SDL 3.2.0 β€” so if you're on anything older, she's not there yet, no cap πŸ¦‹


⭐ SEE ALSO ⭐

go read those too, they're her sisters and they're iconic πŸ’œ


Simple Directmedia Layer β€’ SDL 3.4.18 β€’ SDL_HasPrimarySelectionText(3)

k bye ily, go check that primary selection bestie πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from