Don't pass the sentinel event to event callbacks

This is just for internal use and we don't need to incur the overhead of calling callback and watchers for this event.
This commit is contained in:
Sam Lantinga
2024-05-03 09:00:41 -07:00
parent a03829d636
commit 63979f04c8

View File

@@ -1248,7 +1248,8 @@ int SDL_PushEvent(SDL_Event *event)
event->common.timestamp = SDL_GetTicksNS();
}
if (SDL_EventOK.callback || SDL_event_watchers_count > 0) {
if ((SDL_EventOK.callback || SDL_event_watchers_count > 0) &&
(event->common.type != SDL_EVENT_POLL_SENTINEL)) {
SDL_LockMutex(SDL_event_watchers_lock);
{
if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) {