Skip to content

Commit 6f3b01a

Browse files
authored
Merge pull request #3654 from Starbuck5/sdl3_keyboardexits
Turn off SDL3 signal handlers
2 parents b4785ef + 75f277d commit 6f3b01a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src_c/base.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ pg_init(PyObject *self, PyObject *_null)
217217
/* IMPPREFIX "_sdl2.controller", Is this required? Comment for now*/
218218
NULL};
219219

220+
#if SDL_VERSION_ATLEAST(3, 0, 0)
221+
// In SDL3, specify that signal handlers should not be enabled.
222+
// By default, unlike SDL2, these signal handlers convert into QUIT
223+
// events. However, if QUIT events / events aren't being handled,
224+
// this leaves people unable to quit their script. Plus it's different
225+
// than SDL2 behavior.
226+
SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1");
227+
#endif
228+
220229
/*nice to initialize timer, so startup time will reflec pg_init() time*/
221230
#if defined(WITH_THREAD) && !defined(MS_WIN32) && defined(SDL_INIT_EVENTTHREAD)
222231
pg_sdl_was_init = PG_InitSubSystem(SDL_INIT_EVENTTHREAD | PG_INIT_TIMER |

0 commit comments

Comments
 (0)