diff --git a/src/compat.h b/src/compat.h index 18722c2c..42503282 100644 --- a/src/compat.h +++ b/src/compat.h @@ -200,6 +200,34 @@ static inline void *crealloc(void *ptr, size_t size) #endif /* CONFIG_CHECK_ALLOC */ +#if defined(CONFIG_SDL) && !defined(SKIP_SDL) + +#include + +#if !SDL_VERSION_ATLEAST(2,0,0) + +typedef SDLKey SDL_Keycode; + +#define SDLK_KP_0 SDLK_KP0 +#define SDLK_KP_1 SDLK_KP1 +#define SDLK_KP_2 SDLK_KP2 +#define SDLK_KP_3 SDLK_KP3 +#define SDLK_KP_4 SDLK_KP4 +#define SDLK_KP_5 SDLK_KP5 +#define SDLK_KP_6 SDLK_KP6 +#define SDLK_KP_7 SDLK_KP7 +#define SDLK_KP_8 SDLK_KP8 +#define SDLK_KP_9 SDLK_KP9 +#define SDLK_NUMLOCKCLEAR SDLK_NUMLOCK +#define SDLK_SCROLLLOCK SDLK_SCROLLOCK +#define SDLK_LGUI SDLK_LSUPER +#define SDLK_RGUI SDLK_RSUPER +#define SDLK_PAUSE SDLK_BREAK + +#endif /* !SDL_VERSION_ATLEAST(2,0,0) */ + +#endif /* CONFIG_SDL && !SKIP_SDL */ + __M_END_DECLS #endif // __COMPAT_H diff --git a/src/event_sdl.c b/src/event_sdl.c index 12ba954d..58814827 100644 --- a/src/event_sdl.c +++ b/src/event_sdl.c @@ -28,28 +28,6 @@ extern struct input_status input; static bool numlock_status_initialized; -#if !SDL_VERSION_ATLEAST(2,0,0) - -typedef SDLKey SDL_Keycode; - -#define SDLK_KP_0 SDLK_KP0 -#define SDLK_KP_1 SDLK_KP1 -#define SDLK_KP_2 SDLK_KP2 -#define SDLK_KP_3 SDLK_KP3 -#define SDLK_KP_4 SDLK_KP4 -#define SDLK_KP_5 SDLK_KP5 -#define SDLK_KP_6 SDLK_KP6 -#define SDLK_KP_7 SDLK_KP7 -#define SDLK_KP_8 SDLK_KP8 -#define SDLK_KP_9 SDLK_KP9 -#define SDLK_NUMLOCKCLEAR SDLK_NUMLOCK -#define SDLK_SCROLLLOCK SDLK_SCROLLOCK -#define SDLK_LGUI SDLK_LSUPER -#define SDLK_RGUI SDLK_RSUPER -#define SDLK_PAUSE SDLK_BREAK - -#endif /* SDL_VERSION_ATLEAST(2,0,0) */ - static enum keycode convert_SDL_internal(SDL_Keycode key) { switch(key) diff --git a/src/utils/checkres.c b/src/utils/checkres.c index c14009e0..9826167c 100644 --- a/src/utils/checkres.c +++ b/src/utils/checkres.c @@ -30,6 +30,7 @@ #endif // From MZX itself +#define SKIP_SDL #include "../fsafeopen.h" #include "../const.h" #include "../util.h" diff --git a/src/utils/downver.c b/src/utils/downver.c index 994759aa..be62cf86 100644 --- a/src/utils/downver.c +++ b/src/utils/downver.c @@ -42,6 +42,7 @@ #include #endif +#define SKIP_SDL #include "world.h" #include "util.h" diff --git a/src/utils/png2smzx.c b/src/utils/png2smzx.c index f61fa6c3..ce7f0d10 100644 --- a/src/utils/png2smzx.c +++ b/src/utils/png2smzx.c @@ -20,6 +20,7 @@ #include #include +#define SKIP_SDL #include "pngops.h" #include "smzxconv.h"