mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 09:48:26 +00:00
Improved SDL_PollEvent usage (#4794)
* Avoid unnecessary SDL_PumpEvents calls in SDL_WaitEventTimeout * Add a sentinel event to avoid infinite poll loops * Move SDL_POLLSENTINEL to new internal event category * Tweak documentation to indicate SDL_PumpEvents isn't always called * Avoid shadowing event variable * Ignore poll sentinel if more (user) events have been added after Co-authored-by: Sam Lantinga <slouken@libsdl.org>
This commit is contained in:
parent
43da35b567
commit
8bf32e12d8
3 changed files with 52 additions and 3 deletions
|
@ -958,6 +958,22 @@ extern "C" {
|
|||
*/
|
||||
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling the use of a sentinel event when polling the event queue
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Disable poll sentinels
|
||||
* "1" - Enable poll sentinels
|
||||
*
|
||||
* When polling for events, SDL_PumpEvents is used to gather new events from devices.
|
||||
* If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will
|
||||
* become stuck until the new events stop.
|
||||
* This is most noticable when moving a high frequency mouse.
|
||||
*
|
||||
* By default, poll sentinels are enabled.
|
||||
*/
|
||||
#define SDL_HINT_POLL_SENTINEL "SDL_POLL_SENTINEL"
|
||||
|
||||
/**
|
||||
* \brief Override for SDL_GetPreferredLocales()
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue