Changed main callback return values to an enumeration

Fixes https://github.com/libsdl-org/SDL/issues/10515
This commit is contained in:
Sam Lantinga
2024-08-16 09:54:35 -07:00
parent 83adcb9d38
commit 438a214420
24 changed files with 180 additions and 207 deletions

View File

@@ -39,13 +39,13 @@ static void SDLCALL MainCallbackRateHintChanged(void *userdata, const char *name
int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
{
int rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
if (rc == 0) {
SDL_AddHintCallback(SDL_HINT_MAIN_CALLBACK_RATE, MainCallbackRateHintChanged, NULL);
Uint64 next_iteration = callback_rate_increment ? (SDL_GetTicksNS() + callback_rate_increment) : 0;
while ((rc = SDL_IterateMainCallbacks(SDL_TRUE)) == 0) {
while ((rc = SDL_IterateMainCallbacks(SDL_TRUE)) == SDL_APP_CONTINUE) {
// !!! FIXME: this can be made more complicated if we decide to
// !!! FIXME: optionally hand off callback responsibility to the
// !!! FIXME: video subsystem (for example, if Wayland has a
@@ -77,7 +77,7 @@ int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit,
}
SDL_QuitMainCallbacks();
return (rc < 0) ? 1 : 0;
return (rc == SDL_APP_FAILURE) ? 1 : 0;
}
#endif // !SDL_PLATFORM_IOS