mirror of https://github.com/encounter/SDL.git
Fixed getting different results for SDL_PollEvent(NULL) and SDL_PollEvent(&event)
This commit is contained in:
parent
93cab32db3
commit
dca281e810
|
@ -1004,9 +1004,22 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (event && event->type == SDL_POLLSENTINEL) {
|
if (include_sentinel) {
|
||||||
/* Reached the end of a poll cycle, and not willing to wait */
|
if (event) {
|
||||||
return 0;
|
if (event->type == SDL_POLLSENTINEL) {
|
||||||
|
/* Reached the end of a poll cycle, and not willing to wait */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Need to peek the next event to check for sentinel */
|
||||||
|
SDL_Event dummy;
|
||||||
|
|
||||||
|
if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) &&
|
||||||
|
dummy.type == SDL_POLLSENTINEL) {
|
||||||
|
/* Reached the end of a poll cycle, and not willing to wait */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Has existing events */
|
/* Has existing events */
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue