src/events/SDL_keyboard.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
child 1670 eef792d31de8
     1.1 --- a/src/events/SDL_keyboard.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -51,20 +51,20 @@
     1.4  
     1.5  /* Public functions */
     1.6  int
     1.7 -SDL_KeyboardInit (void)
     1.8 +SDL_KeyboardInit(void)
     1.9  {
    1.10 -    SDL_VideoDevice *_this = SDL_GetVideoDevice ();
    1.11 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    1.12  
    1.13      /* Set default mode of UNICODE translation */
    1.14 -    SDL_EnableUNICODE (DEFAULT_UNICODE_TRANSLATION);
    1.15 +    SDL_EnableUNICODE(DEFAULT_UNICODE_TRANSLATION);
    1.16  
    1.17      /* Initialize the tables */
    1.18      SDL_ModState = KMOD_NONE;
    1.19 -    SDL_memset ((void *) keynames, 0, sizeof (keynames));
    1.20 -    SDL_memset (SDL_KeyState, 0, sizeof (SDL_KeyState));
    1.21 -    _this->InitOSKeymap (_this);
    1.22 +    SDL_memset((void *) keynames, 0, sizeof(keynames));
    1.23 +    SDL_memset(SDL_KeyState, 0, sizeof(SDL_KeyState));
    1.24 +    _this->InitOSKeymap(_this);
    1.25  
    1.26 -    SDL_EnableKeyRepeat (0, 0);
    1.27 +    SDL_EnableKeyRepeat(0, 0);
    1.28  
    1.29      /* Fill in the blanks in keynames */
    1.30      keynames[SDLK_BACKSPACE] = "backspace";
    1.31 @@ -311,29 +311,29 @@
    1.32  }
    1.33  
    1.34  void
    1.35 -SDL_KeyboardQuit (void)
    1.36 +SDL_KeyboardQuit(void)
    1.37  {
    1.38  }
    1.39  
    1.40  /* We lost the keyboard, so post key up messages for all pressed keys */
    1.41  void
    1.42 -SDL_ResetKeyboard (void)
    1.43 +SDL_ResetKeyboard(void)
    1.44  {
    1.45      SDL_keysym keysym;
    1.46      SDLKey key;
    1.47  
    1.48 -    SDL_memset (&keysym, 0, (sizeof keysym));
    1.49 +    SDL_memset(&keysym, 0, (sizeof keysym));
    1.50      for (key = SDLK_FIRST; key < SDLK_LAST; ++key) {
    1.51          if (SDL_KeyState[key] == SDL_PRESSED) {
    1.52              keysym.sym = key;
    1.53 -            SDL_PrivateKeyboard (SDL_RELEASED, &keysym);
    1.54 +            SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
    1.55          }
    1.56      }
    1.57      SDL_KeyRepeat.timestamp = 0;
    1.58  }
    1.59  
    1.60  int
    1.61 -SDL_EnableUNICODE (int enable)
    1.62 +SDL_EnableUNICODE(int enable)
    1.63  {
    1.64      int old_mode;
    1.65  
    1.66 @@ -345,7 +345,7 @@
    1.67  }
    1.68  
    1.69  Uint8 *
    1.70 -SDL_GetKeyState (int *numkeys)
    1.71 +SDL_GetKeyState(int *numkeys)
    1.72  {
    1.73      if (numkeys != (int *) 0)
    1.74          *numkeys = SDLK_LAST;
    1.75 @@ -353,19 +353,19 @@
    1.76  }
    1.77  
    1.78  SDLMod
    1.79 -SDL_GetModState (void)
    1.80 +SDL_GetModState(void)
    1.81  {
    1.82      return (SDL_ModState);
    1.83  }
    1.84  
    1.85  void
    1.86 -SDL_SetModState (SDLMod modstate)
    1.87 +SDL_SetModState(SDLMod modstate)
    1.88  {
    1.89      SDL_ModState = modstate;
    1.90  }
    1.91  
    1.92  char *
    1.93 -SDL_GetKeyName (SDLKey key)
    1.94 +SDL_GetKeyName(SDLKey key)
    1.95  {
    1.96      const char *keyname;
    1.97  
    1.98 @@ -382,17 +382,17 @@
    1.99  
   1.100  /* These are global for SDL_eventloop.c */
   1.101  int
   1.102 -SDL_PrivateKeyboard (Uint8 state, SDL_keysym * keysym)
   1.103 +SDL_PrivateKeyboard(Uint8 state, SDL_keysym * keysym)
   1.104  {
   1.105      SDL_Event event;
   1.106      int posted, repeatable;
   1.107      Uint16 modstate;
   1.108  
   1.109 -    SDL_memset (&event, 0, sizeof (event));
   1.110 +    SDL_memset(&event, 0, sizeof(event));
   1.111  
   1.112  #if 0
   1.113 -    printf ("The '%s' key has been %s\n", SDL_GetKeyName (keysym->sym),
   1.114 -            state == SDL_PRESSED ? "pressed" : "released");
   1.115 +    printf("The '%s' key has been %s\n", SDL_GetKeyName(keysym->sym),
   1.116 +           state == SDL_PRESSED ? "pressed" : "released");
   1.117  #endif
   1.118      /* Set up the keysym */
   1.119      modstate = (Uint16) SDL_ModState;
   1.120 @@ -512,7 +512,7 @@
   1.121          /* Drop events that don't change state */
   1.122          if (SDL_KeyState[keysym->sym] == state) {
   1.123  #if 0
   1.124 -            printf ("Keyboard event didn't change state - dropped!\n");
   1.125 +            printf("Keyboard event didn't change state - dropped!\n");
   1.126  #endif
   1.127              return (0);
   1.128          }
   1.129 @@ -533,11 +533,11 @@
   1.130          if (repeatable && (SDL_KeyRepeat.delay != 0)) {
   1.131              SDL_KeyRepeat.evt = event;
   1.132              SDL_KeyRepeat.firsttime = 1;
   1.133 -            SDL_KeyRepeat.timestamp = SDL_GetTicks ();
   1.134 +            SDL_KeyRepeat.timestamp = SDL_GetTicks();
   1.135          }
   1.136 -        if ((SDL_EventOK == NULL) || SDL_EventOK (&event)) {
   1.137 +        if ((SDL_EventOK == NULL) || SDL_EventOK(&event)) {
   1.138              posted = 1;
   1.139 -            SDL_PushEvent (&event);
   1.140 +            SDL_PushEvent(&event);
   1.141          }
   1.142      }
   1.143      return (posted);
   1.144 @@ -547,12 +547,12 @@
   1.145   * jk 991215 - Added
   1.146   */
   1.147  void
   1.148 -SDL_CheckKeyRepeat (void)
   1.149 +SDL_CheckKeyRepeat(void)
   1.150  {
   1.151      if (SDL_KeyRepeat.timestamp) {
   1.152          Uint32 now, interval;
   1.153  
   1.154 -        now = SDL_GetTicks ();
   1.155 +        now = SDL_GetTicks();
   1.156          interval = (now - SDL_KeyRepeat.timestamp);
   1.157          if (SDL_KeyRepeat.firsttime) {
   1.158              if (interval > (Uint32) SDL_KeyRepeat.delay) {
   1.159 @@ -563,8 +563,8 @@
   1.160              if (interval > (Uint32) SDL_KeyRepeat.interval) {
   1.161                  SDL_KeyRepeat.timestamp = now;
   1.162                  if ((SDL_EventOK == NULL)
   1.163 -                    || SDL_EventOK (&SDL_KeyRepeat.evt)) {
   1.164 -                    SDL_PushEvent (&SDL_KeyRepeat.evt);
   1.165 +                    || SDL_EventOK(&SDL_KeyRepeat.evt)) {
   1.166 +                    SDL_PushEvent(&SDL_KeyRepeat.evt);
   1.167                  }
   1.168              }
   1.169          }
   1.170 @@ -572,10 +572,10 @@
   1.171  }
   1.172  
   1.173  int
   1.174 -SDL_EnableKeyRepeat (int delay, int interval)
   1.175 +SDL_EnableKeyRepeat(int delay, int interval)
   1.176  {
   1.177      if ((delay < 0) || (interval < 0)) {
   1.178 -        SDL_SetError ("keyboard repeat value less than zero");
   1.179 +        SDL_SetError("keyboard repeat value less than zero");
   1.180          return (-1);
   1.181      }
   1.182      SDL_KeyRepeat.firsttime = 0;
   1.183 @@ -586,7 +586,7 @@
   1.184  }
   1.185  
   1.186  void
   1.187 -SDL_GetKeyRepeat (int *delay, int *interval)
   1.188 +SDL_GetKeyRepeat(int *delay, int *interval)
   1.189  {
   1.190      *delay = SDL_KeyRepeat.delay;
   1.191      *interval = SDL_KeyRepeat.interval;