From 4d6a8e34bf009091a15f18f02ed64058313a3b91 Mon Sep 17 00:00:00 2001 From: Starbuck5 <46412508+Starbuck5@users.noreply.github.com> Date: Sat, 12 Oct 2024 17:04:00 -0700 Subject: [PATCH] Rework SDL_INIT_TIMER for SDL3 No longer exists in SDL3, so simple compat is to mock it out to a macro that is zero in SDL3. --- src_c/_pygame.h | 4 ++++ src_c/base.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src_c/_pygame.h b/src_c/_pygame.h index 0cbfed872f..d5bdf7fe40 100644 --- a/src_c/_pygame.h +++ b/src_c/_pygame.h @@ -115,6 +115,8 @@ PG_UnlockMutex(SDL_mutex *mutex) #define PG_FIND_VNUM_MINOR(ver) SDL_VERSIONNUM_MINOR(ver) #define PG_FIND_VNUM_MICRO(ver) SDL_VERSIONNUM_MICRO(ver) +#define PG_INIT_TIMER 0 + #else /* ~SDL_VERSION_ATLEAST(3, 0, 0)*/ #define PG_ShowCursor() SDL_ShowCursor(SDL_ENABLE) #define PG_HideCursor() SDL_ShowCursor(SDL_DISABLE) @@ -180,6 +182,8 @@ PG_UnlockMutex(SDL_mutex *mutex) #define PG_FIND_VNUM_MINOR(ver) ver.minor #define PG_FIND_VNUM_MICRO(ver) ver.patch +#define PG_INIT_TIMER SDL_INIT_TIMER + #if SDL_VERSION_ATLEAST(2, 0, 14) #define PG_SurfaceHasRLE SDL_HasSurfaceRLE #else diff --git a/src_c/base.c b/src_c/base.c index 573bca3aa2..d4f33c813c 100644 --- a/src_c/base.c +++ b/src_c/base.c @@ -341,10 +341,10 @@ pg_init(PyObject *self, PyObject *_null) /*nice to initialize timer, so startup time will reflec pg_init() time*/ #if defined(WITH_THREAD) && !defined(MS_WIN32) && defined(SDL_INIT_EVENTTHREAD) - pg_sdl_was_init = SDL_Init(SDL_INIT_EVENTTHREAD | SDL_INIT_TIMER | + pg_sdl_was_init = SDL_Init(SDL_INIT_EVENTTHREAD | PG_INIT_TIMER | PG_INIT_NOPARACHUTE) == 0; #else - pg_sdl_was_init = SDL_Init(SDL_INIT_TIMER | PG_INIT_NOPARACHUTE) == 0; + pg_sdl_was_init = SDL_Init(PG_INIT_TIMER | PG_INIT_NOPARACHUTE) == 0; #endif pg_env_blend_alpha_SDL2 = SDL_getenv("PYGAME_BLEND_ALPHA_SDL2");