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 *".
This commit is contained in:
Bill Kendrick 2022-05-19 01:34:19 -07:00
parent 2e0119daa9
commit ff05e91f39

View file

@ -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 ||