| Summary: | SDL_ANDROID_BLOCK_ON_PAUSE should be removed, instead please fix SDL_WaitEvent | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ellie <etc0de> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.9 | ||
| Hardware: | x86_64 | ||
| OS: | Android (All) | ||
|
Description
Ellie
2019-03-07 12:45:08 UTC
SDL_WaitEvent is actually doing SDL_PollEvent + SDL_Delay: https://hg.libsdl.org/SDL/file/d5b4d374a312/src/events/SDL_events.c#l697 Yes and that makes SDL_WaitEvent somewhat useless in terms of battery saving, even though at a first glance it would be the obvious choice! So fixing it to be truly blocking would make it the obvious usable choice and make that on pause "feature" completely unnecessary SDL_WaitEvent() can't block because events come from multiple sources that can't be aggregated in a cross-platform way. Isn't the point of SDL2 to solve these issues between different platforms? If that currently doesn't work with various internal sources, then it sounds a little like that should be refactored. Also it would already help a lot if at least it worked properly on mobile platforms, if getting this to work on all platforms is too much work. I can tell you, I have lurked in freenode/irc and even familiar SDL2 users are always surprised that SDL_WaitEvent is close to a busy loop rather than a proper block-until-event. It's really not expected behavior, and it would IMHO in the long term make much more sense to see how to fix it rather than add hacks like SDL_ANDROID_BLOCK_ON_PAUSE to work around this - at least if we're talking purely from a sane API design angle. Of course if this is way too complicated to be feasible then maybe it's not worth it. But I can't judge that, I'm not familiar with the affected code Yes, it is too complicated to be feasible, in my opinion. However, I'll leave this bug open in case someone wants to contribute a patch they feel is valuable. |