@Peter87 Yes, it’s the same issue, and yes, that workaround works! Thank you! I had seen that bug report but dismissed it because I’m not using Windows; I see now the reference in the comments to the same issue existing on macos. I’m glad you asked about the thread-safety issue too, because that made me nervous when I first saw the workaround.
For anyone else who winds up here, this is the gist of the workaround:
/* Declare a callback function to handle SDL_WINDOWEVENT_EXPOSED */
static int SDLCALL special_event_callback(void *userdata, SDL_Event *event)
{
if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_EXPOSED) {
/* Handle event here */
}
return 0;
}
/* Somewhere before the main event loop, add the event handler */
SDL_AddEventWatch(special_event_callback, NULL);