1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - sdl_key_converter.h *
3 * Mupen64Plus homepage: https://mupen64plus.org/ *
4 * Copyright (C) 2013 Mupen64plus development team *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22#include <SDL.h>
23#include <stdint.h>
24
25#include "osal/preproc.h"
26
27uint16_t sdl_keysym2scancode(uint16_t keysym);
28uint16_t sdl_scancode2keysym(uint16_t scancode);
29
30#if SDL_VERSION_ATLEAST(1,3,0)
31
32static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
33{
34 return sdl_keysym2scancode(keysym);
35}
36
37static osal_inline uint16_t sdl_native2keysym(uint16_t native)
38{
39 return sdl_scancode2keysym(native);
40}
41
42#else
43
44static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
45{
46 return keysym;
47}
48
49static osal_inline uint16_t sdl_native2keysym(uint16_t native)
50{
51 return native;
52}
53
54#endif
55