mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Pump events each time through the loop in SDL_WaitEventTimeout_Device()
Not only is it more efficient to batch process pending events, it is necessary for correctness with the Win32 backend. WIN_PumpEvents() runs periodic updates of the cursor clip region and disambiguation of left and right shift keys in addition to standard event processing.
This commit is contained in:
parent
105de64c2d
commit
7948c16df2
@ -788,10 +788,14 @@ SDL_PollEvent(SDL_Event * event)
|
|||||||
static int
|
static int
|
||||||
SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, int timeout)
|
SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, int timeout)
|
||||||
{
|
{
|
||||||
/* Release any keys held down from last frame */
|
|
||||||
SDL_ReleaseAutoReleaseKeys();
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
/* Pump events on entry and each time we wake to ensure:
|
||||||
|
a) All pending events are batch processed after waking up from a wait
|
||||||
|
b) Waiting can be completely skipped if events are already available to be pumped
|
||||||
|
c) Periodic processing that takes place in some platform PumpEvents() functions happens
|
||||||
|
*/
|
||||||
|
SDL_PumpEvents();
|
||||||
|
|
||||||
if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
|
if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
|
||||||
int status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
int status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||||
/* If status == 0 we are going to block so wakeup will be needed. */
|
/* If status == 0 we are going to block so wakeup will be needed. */
|
||||||
|
Loading…
Reference in New Issue
Block a user