Renamed SDLKey and SDLMod for consistency
authorSam Lantinga <slouken@libsdl.org>
Mon, 07 Feb 2011 09:42:08 -0800
changeset 5219c1a92e61907d
parent 5218 572a73d71b5f
child 5220 1fbe1c202501
Renamed SDLKey and SDLMod for consistency
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
     1.1 --- a/include/SDL_compat.h	Mon Feb 07 09:37:11 2011 -0800
     1.2 +++ b/include/SDL_compat.h	Mon Feb 07 09:42:08 2011 -0800
     1.3 @@ -219,6 +219,8 @@
     1.4  #define SDL_KeySym		SDL_Keysym
     1.5  #define SDL_scancode	SDL_Scancode
     1.6  #define SDL_ScanCode	SDL_Scancode
     1.7 +#define SDLKey          SDL_Key
     1.8 +#define SDLMod          SDL_Mod
     1.9  
    1.10  /** 
    1.11   *  \name Renamed keys
     2.1 --- a/include/SDL_keyboard.h	Mon Feb 07 09:37:11 2011 -0800
     2.2 +++ b/include/SDL_keyboard.h	Mon Feb 07 09:42:08 2011 -0800
     2.3 @@ -48,7 +48,7 @@
     2.4  typedef struct SDL_Keysym
     2.5  {
     2.6      SDL_Scancode scancode;      /**< SDL physical key code - see ::SDL_Scancode for details */
     2.7 -    SDLKey sym;                 /**< SDL virtual key code - see ::SDLKey for details */
     2.8 +    SDL_Key sym;                /**< SDL virtual key code - see ::SDL_Key for details */
     2.9      Uint16 mod;                 /**< current key modifiers */
    2.10      Uint32 unicode;             /**< \deprecated use SDL_TextInputEvent instead */
    2.11  } SDL_Keysym;
    2.12 @@ -80,24 +80,24 @@
    2.13  /**
    2.14   *  \brief Get the current key modifier state for the keyboard.
    2.15   */
    2.16 -extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
    2.17 +extern DECLSPEC SDL_Mod SDLCALL SDL_GetModState(void);
    2.18  
    2.19  /**
    2.20   *  \brief Set the current key modifier state for the keyboard.
    2.21   *  
    2.22   *  \note This does not change the keyboard state, only the key modifier flags.
    2.23   */
    2.24 -extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
    2.25 +extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Mod modstate);
    2.26  
    2.27  /**
    2.28   *  \brief Get the key code corresponding to the given scancode according
    2.29   *         to the current keyboard layout.
    2.30   *  
    2.31 - *  See ::SDLKey for details.
    2.32 + *  See ::SDL_Key for details.
    2.33   *  
    2.34   *  \sa SDL_GetKeyName()
    2.35   */
    2.36 -extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
    2.37 +extern DECLSPEC SDL_Key SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
    2.38  
    2.39  /**
    2.40   *  \brief Get the scancode corresponding to the given key code according to the
    2.41 @@ -107,7 +107,7 @@
    2.42   *  
    2.43   *  \sa SDL_GetScancodeName()
    2.44   */
    2.45 -extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
    2.46 +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Key key);
    2.47  
    2.48  /**
    2.49   *  \brief Get a human-readable name for a scancode.
    2.50 @@ -130,9 +130,9 @@
    2.51   *          copy it.  If the key doesn't have a name, this function returns an 
    2.52   *          empty string ("").
    2.53   *  
    2.54 - *  \sa SDLKey
    2.55 + *  \sa SDL_Key
    2.56   */
    2.57 -extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
    2.58 +extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Key key);
    2.59  
    2.60  /**
    2.61   *  \brief Start accepting Unicode text input events.
     3.1 --- a/include/SDL_keysym.h	Mon Feb 07 09:37:11 2011 -0800
     3.2 +++ b/include/SDL_keysym.h	Mon Feb 07 09:42:08 2011 -0800
     3.3 @@ -40,7 +40,7 @@
     3.4   *  the unmodified character that would be generated by pressing the key, or
     3.5   *  an SDLK_* constant for those keys that do not generate characters.
     3.6   */
     3.7 -typedef Sint32 SDLKey;
     3.8 +typedef Sint32 SDL_Key;
     3.9  
    3.10  #define SDLK_SCANCODE_MASK (1<<30)
    3.11  #define SDL_SCANCODE_TO_KEYCODE(X)	(X | SDLK_SCANCODE_MASK)
    3.12 @@ -330,7 +330,7 @@
    3.13      KMOD_CAPS = 0x2000,
    3.14      KMOD_MODE = 0x4000,
    3.15      KMOD_RESERVED = 0x8000
    3.16 -} SDLMod;
    3.17 +} SDL_Mod;
    3.18  
    3.19  #define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
    3.20  #define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
     4.1 --- a/src/events/SDL_keyboard.c	Mon Feb 07 09:37:11 2011 -0800
     4.2 +++ b/src/events/SDL_keyboard.c	Mon Feb 07 09:42:08 2011 -0800
     4.3 @@ -39,12 +39,12 @@
     4.4      SDL_Window *focus;
     4.5      Uint16 modstate;
     4.6      Uint8 keystate[SDL_NUM_SCANCODES];
     4.7 -    SDLKey keymap[SDL_NUM_SCANCODES];
     4.8 +    SDL_Key keymap[SDL_NUM_SCANCODES];
     4.9  };
    4.10  
    4.11  static SDL_Keyboard SDL_keyboard;
    4.12  
    4.13 -static const SDLKey SDL_default_keymap[SDL_NUM_SCANCODES] = {
    4.14 +static const SDL_Key SDL_default_keymap[SDL_NUM_SCANCODES] = {
    4.15      0, 0, 0, 0,
    4.16      'a',
    4.17      'b',
    4.18 @@ -572,13 +572,13 @@
    4.19  }
    4.20  
    4.21  void
    4.22 -SDL_GetDefaultKeymap(SDLKey * keymap)
    4.23 +SDL_GetDefaultKeymap(SDL_Key * keymap)
    4.24  {
    4.25      SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
    4.26  }
    4.27  
    4.28  void
    4.29 -SDL_SetKeymap(int start, SDLKey * keys, int length)
    4.30 +SDL_SetKeymap(int start, SDL_Key * keys, int length)
    4.31  {
    4.32      SDL_Keyboard *keyboard = &SDL_keyboard;
    4.33  
    4.34 @@ -832,7 +832,7 @@
    4.35      return keyboard->keystate;
    4.36  }
    4.37  
    4.38 -SDLMod
    4.39 +SDL_Mod
    4.40  SDL_GetModState(void)
    4.41  {
    4.42      SDL_Keyboard *keyboard = &SDL_keyboard;
    4.43 @@ -841,14 +841,14 @@
    4.44  }
    4.45  
    4.46  void
    4.47 -SDL_SetModState(SDLMod modstate)
    4.48 +SDL_SetModState(SDL_Mod modstate)
    4.49  {
    4.50      SDL_Keyboard *keyboard = &SDL_keyboard;
    4.51  
    4.52      keyboard->modstate = modstate;
    4.53  }
    4.54  
    4.55 -SDLKey
    4.56 +SDL_Key
    4.57  SDL_GetKeyFromScancode(SDL_Scancode scancode)
    4.58  {
    4.59      SDL_Keyboard *keyboard = &SDL_keyboard;
    4.60 @@ -857,7 +857,7 @@
    4.61  }
    4.62  
    4.63  SDL_Scancode
    4.64 -SDL_GetScancodeFromKey(SDLKey key)
    4.65 +SDL_GetScancodeFromKey(SDL_Key key)
    4.66  {
    4.67      SDL_Keyboard *keyboard = &SDL_keyboard;
    4.68      SDL_Scancode scancode;
    4.69 @@ -883,7 +883,7 @@
    4.70  }
    4.71  
    4.72  const char *
    4.73 -SDL_GetKeyName(SDLKey key)
    4.74 +SDL_GetKeyName(SDL_Key key)
    4.75  {
    4.76      static char name[8];
    4.77      char *end;
     5.1 --- a/src/events/SDL_keyboard_c.h	Mon Feb 07 09:37:11 2011 -0800
     5.2 +++ b/src/events/SDL_keyboard_c.h	Mon Feb 07 09:42:08 2011 -0800
     5.3 @@ -34,10 +34,10 @@
     5.4  extern void SDL_ResetKeyboard(void);
     5.5  
     5.6  /* Get the default keymap */
     5.7 -extern void SDL_GetDefaultKeymap(SDLKey * keymap);
     5.8 +extern void SDL_GetDefaultKeymap(SDL_Key * keymap);
     5.9  
    5.10  /* Set the mapping of scancode to key codes */
    5.11 -extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
    5.12 +extern void SDL_SetKeymap(int start, SDL_Key * keys, int length);
    5.13  
    5.14  /* Set a platform-dependent key name, overriding the default platform-agnostic
    5.15     name. Encoded as UTF-8. The string is not copied, thus the pointer given to
     6.1 --- a/src/events/scancodes_linux.h	Mon Feb 07 09:37:11 2011 -0800
     6.2 +++ b/src/events/scancodes_linux.h	Mon Feb 07 09:42:08 2011 -0800
     6.3 @@ -21,7 +21,7 @@
     6.4  */
     6.5  #include "../../include/SDL_scancode.h"
     6.6  
     6.7 -/* Linux virtual key code to SDLKey mapping table
     6.8 +/* Linux virtual key code to SDL_Key mapping table
     6.9     Sources:
    6.10     - Linux kernel source input.h
    6.11  */
     7.1 --- a/src/video/android/SDL_androidkeyboard.c	Mon Feb 07 09:37:11 2011 -0800
     7.2 +++ b/src/video/android/SDL_androidkeyboard.c	Mon Feb 07 09:42:08 2011 -0800
     7.3 @@ -30,7 +30,7 @@
     7.4  
     7.5  void Android_InitKeyboard()
     7.6  {
     7.7 -    SDLKey keymap[SDL_NUM_SCANCODES];
     7.8 +    SDL_Key keymap[SDL_NUM_SCANCODES];
     7.9  
    7.10      /* Add default scancode to key mapping */
    7.11      SDL_GetDefaultKeymap(keymap);
     8.1 --- a/src/video/bwindow/SDL_BWin.h	Mon Feb 07 09:37:11 2011 -0800
     8.2 +++ b/src/video/bwindow/SDL_BWin.h	Mon Feb 07 09:42:08 2011 -0800
     8.3 @@ -586,7 +586,7 @@
     8.4      bool inhibit_resize;
     8.5  
     8.6      int32 last_buttons;
     8.7 -    SDLKey keymap[128];
     8.8 +    SDL_Key keymap[128];
     8.9  };
    8.10  
    8.11  #endif /* _SDL_BWin_h */
     9.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Mon Feb 07 09:37:11 2011 -0800
     9.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Mon Feb 07 09:42:08 2011 -0800
     9.3 @@ -490,7 +490,7 @@
     9.4      const void *chr_data;
     9.5      int i;
     9.6      SDL_Scancode scancode;
     9.7 -    SDLKey keymap[SDL_NUM_SCANCODES];
     9.8 +    SDL_Key keymap[SDL_NUM_SCANCODES];
     9.9  
    9.10      /* See if the keymap needs to be updated */
    9.11  #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
    10.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Mon Feb 07 09:37:11 2011 -0800
    10.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Mon Feb 07 09:42:08 2011 -0800
    10.3 @@ -659,7 +659,7 @@
    10.4  #if USE_MULTI_API
    10.5      SDL_Keyboard keyboard;
    10.6  #endif
    10.7 -    SDLKey keymap[SDL_NUM_SCANCODES];
    10.8 +    SDL_Key keymap[SDL_NUM_SCANCODES];
    10.9  
   10.10  	if (!cb->sys_kbd) {
   10.11  		if (cb->sys_ids) {
    11.1 --- a/src/video/windows/SDL_windowskeyboard.c	Mon Feb 07 09:37:11 2011 -0800
    11.2 +++ b/src/video/windows/SDL_windowskeyboard.c	Mon Feb 07 09:42:08 2011 -0800
    11.3 @@ -151,7 +151,7 @@
    11.4  {
    11.5      int i;
    11.6      SDL_Scancode scancode;
    11.7 -    SDLKey keymap[SDL_NUM_SCANCODES];
    11.8 +    SDL_Key keymap[SDL_NUM_SCANCODES];
    11.9  
   11.10      SDL_GetDefaultKeymap(keymap);
   11.11  
    12.1 --- a/src/video/x11/SDL_x11keyboard.c	Mon Feb 07 09:37:11 2011 -0800
    12.2 +++ b/src/video/x11/SDL_x11keyboard.c	Mon Feb 07 09:42:08 2011 -0800
    12.3 @@ -34,7 +34,7 @@
    12.4  /* *INDENT-OFF* */
    12.5  static const struct {
    12.6      KeySym keysym;
    12.7 -    SDLKey sdlkey;
    12.8 +    SDL_Key sdlkey;
    12.9  } KeySymToSDLKey[] = {
   12.10      { XK_Return, SDLK_RETURN },
   12.11      { XK_Escape, SDLK_ESCAPE },
   12.12 @@ -143,7 +143,7 @@
   12.13  };
   12.14  /* *INDENT-OFF* */
   12.15  
   12.16 -static SDLKey
   12.17 +static SDL_Key
   12.18  X11_KeyCodeToSDLKey(Display *display, KeyCode keycode)
   12.19  {
   12.20      KeySym keysym;
   12.21 @@ -157,7 +157,7 @@
   12.22  
   12.23      ucs4 = X11_KeySymToUcs4(keysym);
   12.24      if (ucs4) {
   12.25 -        return (SDLKey) ucs4;
   12.26 +        return (SDL_Key) ucs4;
   12.27      }
   12.28  
   12.29      for (i = 0; i < SDL_arraysize(KeySymToSDLKey); ++i) {
   12.30 @@ -222,7 +222,7 @@
   12.31      }
   12.32  
   12.33      if (!fingerprint_detected) {
   12.34 -        SDLKey keymap[SDL_NUM_SCANCODES];
   12.35 +        SDL_Key keymap[SDL_NUM_SCANCODES];
   12.36  
   12.37          printf
   12.38              ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n");
   12.39 @@ -233,7 +233,7 @@
   12.40              KeySym sym;
   12.41              sym = XKeycodeToKeysym(data->display, i, 0);
   12.42              if (sym != NoSymbol) {
   12.43 -                SDLKey key;
   12.44 +                SDL_Key key;
   12.45                  printf("code = %d, sym = 0x%X (%s) ", i - min_keycode,
   12.46                         (unsigned int) sym, XKeysymToString(sym));
   12.47                  key = X11_KeyCodeToSDLKey(data->display, i);
   12.48 @@ -265,7 +265,7 @@
   12.49      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   12.50      int i;
   12.51      SDL_Scancode scancode;
   12.52 -    SDLKey keymap[SDL_NUM_SCANCODES];
   12.53 +    SDL_Key keymap[SDL_NUM_SCANCODES];
   12.54  
   12.55      SDL_zero(keymap);
   12.56