1 /* 2 * kbd.h - SDL specfic keyboard driver. 3 * 4 * Written by 5 * Hannu Nuotio <hannu.nuotio@tut.fi> 6 * Marco van den Heuvel <blackystardust68@yahoo.com> 7 * 8 * This file is part of VICE, the Versatile Commodore Emulator. 9 * See README file for copyright notice. 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 24 * 02111-1307 USA. 25 * 26 */ 27 28 #ifndef VICE_KBD_H 29 #define VICE_KBD_H 30 31 #include "vice_sdl.h" 32 #include "uimenu.h" 33 34 extern void kbd_arch_init(void); 35 extern int kbd_arch_get_host_mapping(void); 36 37 extern signed long kbd_arch_keyname_to_keynum(char *keyname); 38 extern const char *kbd_arch_keynum_to_keyname(signed long keynum); 39 extern void kbd_initialize_numpad_joykeys(int *joykeys); 40 41 #define KBD_PORT_PREFIX "sdl" 42 43 #ifdef USE_SDLUI2 44 #define SDLKey SDL_Keycode 45 #define SDLMod SDL_Keymod 46 #define SDLK_KP0 SDLK_KP_0 47 #define SDLK_KP1 SDLK_KP_1 48 #define SDLK_KP2 SDLK_KP_2 49 #define SDLK_KP3 SDLK_KP_3 50 #define SDLK_KP4 SDLK_KP_4 51 #define SDLK_KP5 SDLK_KP_5 52 #define SDLK_KP6 SDLK_KP_6 53 #define SDLK_KP7 SDLK_KP_7 54 #define SDLK_KP8 SDLK_KP_8 55 #define SDLK_KP9 SDLK_KP_9 56 #define KMOD_META KMOD_GUI 57 #define SDLK_LMETA SDLK_LGUI 58 #define SDLK_RMETA SDLK_RGUI 59 #define SDLK_COMPOSE SDLK_APPLICATION 60 #define SDLK_PRINT SDLK_PRINTSCREEN 61 #define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR 62 #define SDLK_SCROLLOCK SDLK_SCROLLLOCK 63 #else 64 #define SDL_NUM_SCANCODES 512 /* this must be the same value as in SDL2 headers */ 65 #endif 66 67 #define VICE_SDLK_RIGHT 275 68 #define VICE_SDLK_LEFT 276 69 #define VICE_SDLK_HOME 278 70 #define VICE_SDLK_END 279 71 #define VICE_SDLK_F10 291 72 73 #define VICE_SDLK_BACKSPACE SDLK_BACKSPACE 74 #define VICE_SDLK_ESCAPE SDLK_ESCAPE 75 #define VICE_SDLK_RETURN SDLK_RETURN 76 77 extern SDLKey SDL2x_to_SDL1x_Keys(SDLKey key); 78 extern SDLKey SDL1x_to_SDL2x_Keys(SDLKey key); 79 80 extern ui_menu_action_t sdlkbd_press(SDLKey key, SDLMod mod); 81 extern ui_menu_action_t sdlkbd_release(SDLKey key, SDLMod mod); 82 83 extern void sdlkbd_set_hotkey(SDLKey key, SDLMod mod, ui_menu_entry_t *value); 84 85 extern int sdlkbd_hotkeys_load(const char *filename); 86 extern int sdlkbd_hotkeys_load(const char *filename); 87 extern int sdlkbd_hotkeys_dump(const char *filename); 88 89 extern int sdlkbd_init_resources(void); 90 extern void sdlkbd_resources_shutdown(void); 91 92 extern int sdlkbd_init_cmdline(void); 93 94 extern void kbd_enter_leave(void); 95 extern void kbd_focus_change(void); 96 97 extern int sdl_ui_menukeys[]; 98 99 extern const char *kbd_get_menu_keyname(void); 100 101 #endif 102