mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fall back to polling normally if not operating the win32 message loop
In this condition, we cannot safely wait/wake on events.
This commit is contained in:
parent
e13d5df00b
commit
85b51e6c92
@ -817,7 +817,7 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event,
|
|||||||
_this->wakeup_window = NULL;
|
_this->wakeup_window = NULL;
|
||||||
if (status <= 0) {
|
if (status <= 0) {
|
||||||
/* There is either an error or the timeout is elapsed: return */
|
/* There is either an error or the timeout is elapsed: return */
|
||||||
return 0;
|
return status;
|
||||||
}
|
}
|
||||||
/* An event was found and pumped into the SDL events queue. Continue the loop
|
/* An event was found and pumped into the SDL events queue. Continue the loop
|
||||||
to let SDL_PeepEvents pick it up .*/
|
to let SDL_PeepEvents pick it up .*/
|
||||||
@ -880,7 +880,13 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!need_polling && _this && _this->WaitEventTimeout && _this->SendWakeupEvent) {
|
if (!need_polling && _this && _this->WaitEventTimeout && _this->SendWakeupEvent) {
|
||||||
return SDL_WaitEventTimeout_Device(_this, wakeup_window, event, timeout);
|
int status = SDL_WaitEventTimeout_Device(_this, wakeup_window, event, timeout);
|
||||||
|
|
||||||
|
/* There may be implementation-defined conditions where the backend cannot
|
||||||
|
reliably wait for the next event. If that happens, fall back to polling */
|
||||||
|
if (status >= 0) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -1303,9 +1303,13 @@ WIN_WaitEventTimeout(_THIS, int timeout)
|
|||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Fail the wait so the caller falls back to polling */
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user