Description
Happy to do this myself if possible but thought I'd bring this issue up, if nothing else for anyone else who gets a head-scratching "bug" here (manifests as stalling/stuttering/loss-of-fps due to time consumption);
At the time of writing, SDL_GetClipboardText() is a time-expensive call under linux and it's poor usage by oneself would have potentially been avoided if it was noted in the Wiki CategoryClipboard that it may be worth checking for SDL_CLIPBOARDUPDATE in the event structure before needlessly calling SDL_GetClipboardText().
I was running around lookin for a SDL_IsClipboardChanged() or similar function, so that was my bad assumption there.
if (event.type == SDL_CLIPBOARDUPDATE) {
if (SDL_HasClipboardText()) {
char *cbt = SDL_GetClipboardText();
if (cbt) {
// Do something with the text
}
SDL_free(cbt);
}
}
Very likely the use of SDL_HasClipboardText() may be redundant here for my use case but I added it for thoroughness.