From ff05e91f39cd444c9e806e73397a275b1b2dcb9a Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Thu, 19 May 2022 01:34:19 -0700 Subject: [PATCH] SDL-agnostic way to declare callback func. for SDL_SetEventFilter() SDL 1.2 wants a "const SDL_Event *", SDL 2.0 wants a "union SDL_Event *". --- src/tuxpaint.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index fe7cd04ff..fd8a76e77 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -580,8 +580,13 @@ static void reposition_onscreen_keyboard(int y); #endif #endif +#if (SDL_MAJOR_VERSION < 2) + #define EVENT_FILTER_EVENT_TYPE const SDL_Event +#else + #define EVENT_FILTER_EVENT_TYPE union SDL_Event +#endif -int TP_EventFilter(const SDL_Event * event); +int TP_EventFilter(EVENT_FILTER_EVENT_TYPE * event); /* *INDENT-OFF* */ @@ -26674,7 +26679,7 @@ static void do_lock_file(void) /** * FIXME */ -int TP_EventFilter(const SDL_Event * event) +int TP_EventFilter(EVENT_FILTER_EVENT_TYPE * event) { if (event->type == SDL_QUIT || event->type == SDL_ACTIVEEVENT ||