Mercurial > sdl-ios-xcode
changeset 5225:1fbe1c202501
Renamed SDL_Key to SDL_Keycode to clarify terminology.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Feb 2011 10:40:21 -0800 |
parents | c1a92e61907d |
children | 2ee8112bfc6b |
files | include/SDL_compat.h include/SDL_keyboard.h include/SDL_keysym.h src/events/SDL_keyboard.c src/events/SDL_keyboard_c.h src/events/scancodes_linux.h src/video/android/SDL_androidkeyboard.c src/video/bwindow/SDL_BWin.h src/video/cocoa/SDL_cocoakeyboard.m src/video/directfb/SDL_DirectFB_events.c src/video/windows/SDL_windowskeyboard.c src/video/x11/SDL_x11keyboard.c |
diffstat | 12 files changed, 34 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/include/SDL_compat.h Mon Feb 07 09:42:08 2011 -0800 +++ b/include/SDL_compat.h Mon Feb 07 10:40:21 2011 -0800 @@ -219,8 +219,8 @@ #define SDL_KeySym SDL_Keysym #define SDL_scancode SDL_Scancode #define SDL_ScanCode SDL_Scancode -#define SDLKey SDL_Key -#define SDLMod SDL_Mod +#define SDLKey SDL_Keycode +#define SDLMod SDL_Keymod /** * \name Renamed keys
--- a/include/SDL_keyboard.h Mon Feb 07 09:42:08 2011 -0800 +++ b/include/SDL_keyboard.h Mon Feb 07 10:40:21 2011 -0800 @@ -48,7 +48,7 @@ typedef struct SDL_Keysym { SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ - SDL_Key sym; /**< SDL virtual key code - see ::SDL_Key for details */ + SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ Uint16 mod; /**< current key modifiers */ Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */ } SDL_Keysym; @@ -80,24 +80,24 @@ /** * \brief Get the current key modifier state for the keyboard. */ -extern DECLSPEC SDL_Mod SDLCALL SDL_GetModState(void); +extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); /** * \brief Set the current key modifier state for the keyboard. * * \note This does not change the keyboard state, only the key modifier flags. */ -extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Mod modstate); +extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** * \brief Get the key code corresponding to the given scancode according * to the current keyboard layout. * - * See ::SDL_Key for details. + * See ::SDL_Keycode for details. * * \sa SDL_GetKeyName() */ -extern DECLSPEC SDL_Key SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); /** * \brief Get the scancode corresponding to the given key code according to the @@ -107,7 +107,7 @@ * * \sa SDL_GetScancodeName() */ -extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Key key); +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); /** * \brief Get a human-readable name for a scancode. @@ -132,7 +132,7 @@ * * \sa SDL_Key */ -extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Key key); +extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * \brief Start accepting Unicode text input events.
--- a/include/SDL_keysym.h Mon Feb 07 09:42:08 2011 -0800 +++ b/include/SDL_keysym.h Mon Feb 07 10:40:21 2011 -0800 @@ -40,7 +40,7 @@ * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. */ -typedef Sint32 SDL_Key; +typedef Sint32 SDL_Keycode; #define SDLK_SCANCODE_MASK (1<<30) #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) @@ -330,7 +330,7 @@ KMOD_CAPS = 0x2000, KMOD_MODE = 0x4000, KMOD_RESERVED = 0x8000 -} SDL_Mod; +} SDL_Keymod; #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
--- a/src/events/SDL_keyboard.c Mon Feb 07 09:42:08 2011 -0800 +++ b/src/events/SDL_keyboard.c Mon Feb 07 10:40:21 2011 -0800 @@ -39,12 +39,12 @@ SDL_Window *focus; Uint16 modstate; Uint8 keystate[SDL_NUM_SCANCODES]; - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; }; static SDL_Keyboard SDL_keyboard; -static const SDL_Key SDL_default_keymap[SDL_NUM_SCANCODES] = { +static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { 0, 0, 0, 0, 'a', 'b', @@ -572,13 +572,13 @@ } void -SDL_GetDefaultKeymap(SDL_Key * keymap) +SDL_GetDefaultKeymap(SDL_Keycode * keymap) { SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap)); } void -SDL_SetKeymap(int start, SDL_Key * keys, int length) +SDL_SetKeymap(int start, SDL_Keycode * keys, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; @@ -832,7 +832,7 @@ return keyboard->keystate; } -SDL_Mod +SDL_Keymod SDL_GetModState(void) { SDL_Keyboard *keyboard = &SDL_keyboard; @@ -841,14 +841,14 @@ } void -SDL_SetModState(SDL_Mod modstate) +SDL_SetModState(SDL_Keymod modstate) { SDL_Keyboard *keyboard = &SDL_keyboard; keyboard->modstate = modstate; } -SDL_Key +SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; @@ -857,7 +857,7 @@ } SDL_Scancode -SDL_GetScancodeFromKey(SDL_Key key) +SDL_GetScancodeFromKey(SDL_Keycode key) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; @@ -883,7 +883,7 @@ } const char * -SDL_GetKeyName(SDL_Key key) +SDL_GetKeyName(SDL_Keycode key) { static char name[8]; char *end;
--- a/src/events/SDL_keyboard_c.h Mon Feb 07 09:42:08 2011 -0800 +++ b/src/events/SDL_keyboard_c.h Mon Feb 07 10:40:21 2011 -0800 @@ -34,10 +34,10 @@ extern void SDL_ResetKeyboard(void); /* Get the default keymap */ -extern void SDL_GetDefaultKeymap(SDL_Key * keymap); +extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap); /* Set the mapping of scancode to key codes */ -extern void SDL_SetKeymap(int start, SDL_Key * keys, int length); +extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length); /* Set a platform-dependent key name, overriding the default platform-agnostic name. Encoded as UTF-8. The string is not copied, thus the pointer given to
--- a/src/events/scancodes_linux.h Mon Feb 07 09:42:08 2011 -0800 +++ b/src/events/scancodes_linux.h Mon Feb 07 10:40:21 2011 -0800 @@ -21,7 +21,7 @@ */ #include "../../include/SDL_scancode.h" -/* Linux virtual key code to SDL_Key mapping table +/* Linux virtual key code to SDL_Keycode mapping table Sources: - Linux kernel source input.h */
--- a/src/video/android/SDL_androidkeyboard.c Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/android/SDL_androidkeyboard.c Mon Feb 07 10:40:21 2011 -0800 @@ -30,7 +30,7 @@ void Android_InitKeyboard() { - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; /* Add default scancode to key mapping */ SDL_GetDefaultKeymap(keymap);
--- a/src/video/bwindow/SDL_BWin.h Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/bwindow/SDL_BWin.h Mon Feb 07 10:40:21 2011 -0800 @@ -586,7 +586,7 @@ bool inhibit_resize; int32 last_buttons; - SDL_Key keymap[128]; + SDL_Keycode keymap[128]; }; #endif /* _SDL_BWin_h */
--- a/src/video/cocoa/SDL_cocoakeyboard.m Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/cocoa/SDL_cocoakeyboard.m Mon Feb 07 10:40:21 2011 -0800 @@ -490,7 +490,7 @@ const void *chr_data; int i; SDL_Scancode scancode; - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; /* See if the keymap needs to be updated */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
--- a/src/video/directfb/SDL_DirectFB_events.c Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_events.c Mon Feb 07 10:40:21 2011 -0800 @@ -659,7 +659,7 @@ #if USE_MULTI_API SDL_Keyboard keyboard; #endif - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; if (!cb->sys_kbd) { if (cb->sys_ids) {
--- a/src/video/windows/SDL_windowskeyboard.c Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/windows/SDL_windowskeyboard.c Mon Feb 07 10:40:21 2011 -0800 @@ -151,7 +151,7 @@ { int i; SDL_Scancode scancode; - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; SDL_GetDefaultKeymap(keymap);
--- a/src/video/x11/SDL_x11keyboard.c Mon Feb 07 09:42:08 2011 -0800 +++ b/src/video/x11/SDL_x11keyboard.c Mon Feb 07 10:40:21 2011 -0800 @@ -34,7 +34,7 @@ /* *INDENT-OFF* */ static const struct { KeySym keysym; - SDL_Key sdlkey; + SDL_Keycode sdlkey; } KeySymToSDLKey[] = { { XK_Return, SDLK_RETURN }, { XK_Escape, SDLK_ESCAPE }, @@ -143,7 +143,7 @@ }; /* *INDENT-OFF* */ -static SDL_Key +static SDL_Keycode X11_KeyCodeToSDLKey(Display *display, KeyCode keycode) { KeySym keysym; @@ -157,7 +157,7 @@ ucs4 = X11_KeySymToUcs4(keysym); if (ucs4) { - return (SDL_Key) ucs4; + return (SDL_Keycode) ucs4; } for (i = 0; i < SDL_arraysize(KeySymToSDLKey); ++i) { @@ -222,7 +222,7 @@ } if (!fingerprint_detected) { - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; printf ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n"); @@ -233,7 +233,7 @@ KeySym sym; sym = XKeycodeToKeysym(data->display, i, 0); if (sym != NoSymbol) { - SDL_Key key; + SDL_Keycode key; printf("code = %d, sym = 0x%X (%s) ", i - min_keycode, (unsigned int) sym, XKeysymToString(sym)); key = X11_KeyCodeToSDLKey(data->display, i); @@ -265,7 +265,7 @@ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; int i; SDL_Scancode scancode; - SDL_Key keymap[SDL_NUM_SCANCODES]; + SDL_Keycode keymap[SDL_NUM_SCANCODES]; SDL_zero(keymap);