src/events/SDL_keyboard.c
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1659 14717b52abc0
child 1668 4da1ee79c9af
     1.1 --- a/src/events/SDL_keyboard.c	Sun May 21 17:27:13 2006 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Sun May 28 13:04:16 2006 +0000
     1.3 @@ -30,549 +30,566 @@
     1.4  
     1.5  
     1.6  /* Global keystate information */
     1.7 -static Uint8  SDL_KeyState[SDLK_LAST];
     1.8 +static Uint8 SDL_KeyState[SDLK_LAST];
     1.9  static SDLMod SDL_ModState;
    1.10  int SDL_TranslateUNICODE = 0;
    1.11  
    1.12 -static const char *keynames[SDLK_LAST];	/* Array of keycode names */
    1.13 +static const char *keynames[SDLK_LAST]; /* Array of keycode names */
    1.14  
    1.15  /*
    1.16   * jk 991215 - added
    1.17   */
    1.18 -struct {
    1.19 -	int firsttime;    /* if we check against the delay or repeat value */
    1.20 -	int delay;        /* the delay before we start repeating */
    1.21 -	int interval;     /* the delay between key repeat events */
    1.22 -	Uint32 timestamp; /* the time the first keydown event occurred */
    1.23 +struct
    1.24 +{
    1.25 +    int firsttime;              /* if we check against the delay or repeat value */
    1.26 +    int delay;                  /* the delay before we start repeating */
    1.27 +    int interval;               /* the delay between key repeat events */
    1.28 +    Uint32 timestamp;           /* the time the first keydown event occurred */
    1.29  
    1.30 -	SDL_Event evt;    /* the event we are supposed to repeat */
    1.31 +    SDL_Event evt;              /* the event we are supposed to repeat */
    1.32  } SDL_KeyRepeat;
    1.33  
    1.34  /* Public functions */
    1.35 -int SDL_KeyboardInit(void)
    1.36 +int
    1.37 +SDL_KeyboardInit (void)
    1.38  {
    1.39 -	SDL_VideoDevice *video = current_video;
    1.40 -	SDL_VideoDevice *this  = current_video;
    1.41 +    SDL_VideoDevice *_this = SDL_GetVideoDevice ();
    1.42  
    1.43 -	/* Set default mode of UNICODE translation */
    1.44 -	SDL_EnableUNICODE(DEFAULT_UNICODE_TRANSLATION);
    1.45 +    /* Set default mode of UNICODE translation */
    1.46 +    SDL_EnableUNICODE (DEFAULT_UNICODE_TRANSLATION);
    1.47  
    1.48 -	/* Initialize the tables */
    1.49 -	SDL_ModState = KMOD_NONE;
    1.50 -	SDL_memset((void*)keynames, 0, sizeof(keynames));
    1.51 -	SDL_memset(SDL_KeyState, 0, sizeof(SDL_KeyState));
    1.52 -	video->InitOSKeymap(this);
    1.53 +    /* Initialize the tables */
    1.54 +    SDL_ModState = KMOD_NONE;
    1.55 +    SDL_memset ((void *) keynames, 0, sizeof (keynames));
    1.56 +    SDL_memset (SDL_KeyState, 0, sizeof (SDL_KeyState));
    1.57 +    _this->InitOSKeymap (_this);
    1.58  
    1.59 -	SDL_EnableKeyRepeat(0, 0);
    1.60 +    SDL_EnableKeyRepeat (0, 0);
    1.61  
    1.62 -	/* Fill in the blanks in keynames */
    1.63 -	keynames[SDLK_BACKSPACE] = "backspace";
    1.64 -	keynames[SDLK_TAB] = "tab";
    1.65 -	keynames[SDLK_CLEAR] = "clear";
    1.66 -	keynames[SDLK_RETURN] = "return";
    1.67 -	keynames[SDLK_PAUSE] = "pause";
    1.68 -	keynames[SDLK_ESCAPE] = "escape";
    1.69 -	keynames[SDLK_SPACE] = "space";
    1.70 -	keynames[SDLK_EXCLAIM]  = "!";
    1.71 -	keynames[SDLK_QUOTEDBL]  = "\"";
    1.72 -	keynames[SDLK_HASH]  = "#";
    1.73 -	keynames[SDLK_DOLLAR]  = "$";
    1.74 -	keynames[SDLK_AMPERSAND]  = "&";
    1.75 -	keynames[SDLK_QUOTE] = "'";
    1.76 -	keynames[SDLK_LEFTPAREN] = "(";
    1.77 -	keynames[SDLK_RIGHTPAREN] = ")";
    1.78 -	keynames[SDLK_ASTERISK] = "*";
    1.79 -	keynames[SDLK_PLUS] = "+";
    1.80 -	keynames[SDLK_COMMA] = ",";
    1.81 -	keynames[SDLK_MINUS] = "-";
    1.82 -	keynames[SDLK_PERIOD] = ".";
    1.83 -	keynames[SDLK_SLASH] = "/";
    1.84 -	keynames[SDLK_0] = "0";
    1.85 -	keynames[SDLK_1] = "1";
    1.86 -	keynames[SDLK_2] = "2";
    1.87 -	keynames[SDLK_3] = "3";
    1.88 -	keynames[SDLK_4] = "4";
    1.89 -	keynames[SDLK_5] = "5";
    1.90 -	keynames[SDLK_6] = "6";
    1.91 -	keynames[SDLK_7] = "7";
    1.92 -	keynames[SDLK_8] = "8";
    1.93 -	keynames[SDLK_9] = "9";
    1.94 -	keynames[SDLK_COLON] = ":";
    1.95 -	keynames[SDLK_SEMICOLON] = ";";
    1.96 -	keynames[SDLK_LESS] = "<";
    1.97 -	keynames[SDLK_EQUALS] = "=";
    1.98 -	keynames[SDLK_GREATER] = ">";
    1.99 -	keynames[SDLK_QUESTION] = "?";
   1.100 -	keynames[SDLK_AT] = "@";
   1.101 -	keynames[SDLK_LEFTBRACKET] = "[";
   1.102 -	keynames[SDLK_BACKSLASH] = "\\";
   1.103 -	keynames[SDLK_RIGHTBRACKET] = "]";
   1.104 -	keynames[SDLK_CARET] = "^";
   1.105 -	keynames[SDLK_UNDERSCORE] = "_";
   1.106 -	keynames[SDLK_BACKQUOTE] = "`";
   1.107 -	keynames[SDLK_a] = "a";
   1.108 -	keynames[SDLK_b] = "b";
   1.109 -	keynames[SDLK_c] = "c";
   1.110 -	keynames[SDLK_d] = "d";
   1.111 -	keynames[SDLK_e] = "e";
   1.112 -	keynames[SDLK_f] = "f";
   1.113 -	keynames[SDLK_g] = "g";
   1.114 -	keynames[SDLK_h] = "h";
   1.115 -	keynames[SDLK_i] = "i";
   1.116 -	keynames[SDLK_j] = "j";
   1.117 -	keynames[SDLK_k] = "k";
   1.118 -	keynames[SDLK_l] = "l";
   1.119 -	keynames[SDLK_m] = "m";
   1.120 -	keynames[SDLK_n] = "n";
   1.121 -	keynames[SDLK_o] = "o";
   1.122 -	keynames[SDLK_p] = "p";
   1.123 -	keynames[SDLK_q] = "q";
   1.124 -	keynames[SDLK_r] = "r";
   1.125 -	keynames[SDLK_s] = "s";
   1.126 -	keynames[SDLK_t] = "t";
   1.127 -	keynames[SDLK_u] = "u";
   1.128 -	keynames[SDLK_v] = "v";
   1.129 -	keynames[SDLK_w] = "w";
   1.130 -	keynames[SDLK_x] = "x";
   1.131 -	keynames[SDLK_y] = "y";
   1.132 -	keynames[SDLK_z] = "z";
   1.133 -	keynames[SDLK_DELETE] = "delete";
   1.134 +    /* Fill in the blanks in keynames */
   1.135 +    keynames[SDLK_BACKSPACE] = "backspace";
   1.136 +    keynames[SDLK_TAB] = "tab";
   1.137 +    keynames[SDLK_CLEAR] = "clear";
   1.138 +    keynames[SDLK_RETURN] = "return";
   1.139 +    keynames[SDLK_PAUSE] = "pause";
   1.140 +    keynames[SDLK_ESCAPE] = "escape";
   1.141 +    keynames[SDLK_SPACE] = "space";
   1.142 +    keynames[SDLK_EXCLAIM] = "!";
   1.143 +    keynames[SDLK_QUOTEDBL] = "\"";
   1.144 +    keynames[SDLK_HASH] = "#";
   1.145 +    keynames[SDLK_DOLLAR] = "$";
   1.146 +    keynames[SDLK_AMPERSAND] = "&";
   1.147 +    keynames[SDLK_QUOTE] = "'";
   1.148 +    keynames[SDLK_LEFTPAREN] = "(";
   1.149 +    keynames[SDLK_RIGHTPAREN] = ")";
   1.150 +    keynames[SDLK_ASTERISK] = "*";
   1.151 +    keynames[SDLK_PLUS] = "+";
   1.152 +    keynames[SDLK_COMMA] = ",";
   1.153 +    keynames[SDLK_MINUS] = "-";
   1.154 +    keynames[SDLK_PERIOD] = ".";
   1.155 +    keynames[SDLK_SLASH] = "/";
   1.156 +    keynames[SDLK_0] = "0";
   1.157 +    keynames[SDLK_1] = "1";
   1.158 +    keynames[SDLK_2] = "2";
   1.159 +    keynames[SDLK_3] = "3";
   1.160 +    keynames[SDLK_4] = "4";
   1.161 +    keynames[SDLK_5] = "5";
   1.162 +    keynames[SDLK_6] = "6";
   1.163 +    keynames[SDLK_7] = "7";
   1.164 +    keynames[SDLK_8] = "8";
   1.165 +    keynames[SDLK_9] = "9";
   1.166 +    keynames[SDLK_COLON] = ":";
   1.167 +    keynames[SDLK_SEMICOLON] = ";";
   1.168 +    keynames[SDLK_LESS] = "<";
   1.169 +    keynames[SDLK_EQUALS] = "=";
   1.170 +    keynames[SDLK_GREATER] = ">";
   1.171 +    keynames[SDLK_QUESTION] = "?";
   1.172 +    keynames[SDLK_AT] = "@";
   1.173 +    keynames[SDLK_LEFTBRACKET] = "[";
   1.174 +    keynames[SDLK_BACKSLASH] = "\\";
   1.175 +    keynames[SDLK_RIGHTBRACKET] = "]";
   1.176 +    keynames[SDLK_CARET] = "^";
   1.177 +    keynames[SDLK_UNDERSCORE] = "_";
   1.178 +    keynames[SDLK_BACKQUOTE] = "`";
   1.179 +    keynames[SDLK_a] = "a";
   1.180 +    keynames[SDLK_b] = "b";
   1.181 +    keynames[SDLK_c] = "c";
   1.182 +    keynames[SDLK_d] = "d";
   1.183 +    keynames[SDLK_e] = "e";
   1.184 +    keynames[SDLK_f] = "f";
   1.185 +    keynames[SDLK_g] = "g";
   1.186 +    keynames[SDLK_h] = "h";
   1.187 +    keynames[SDLK_i] = "i";
   1.188 +    keynames[SDLK_j] = "j";
   1.189 +    keynames[SDLK_k] = "k";
   1.190 +    keynames[SDLK_l] = "l";
   1.191 +    keynames[SDLK_m] = "m";
   1.192 +    keynames[SDLK_n] = "n";
   1.193 +    keynames[SDLK_o] = "o";
   1.194 +    keynames[SDLK_p] = "p";
   1.195 +    keynames[SDLK_q] = "q";
   1.196 +    keynames[SDLK_r] = "r";
   1.197 +    keynames[SDLK_s] = "s";
   1.198 +    keynames[SDLK_t] = "t";
   1.199 +    keynames[SDLK_u] = "u";
   1.200 +    keynames[SDLK_v] = "v";
   1.201 +    keynames[SDLK_w] = "w";
   1.202 +    keynames[SDLK_x] = "x";
   1.203 +    keynames[SDLK_y] = "y";
   1.204 +    keynames[SDLK_z] = "z";
   1.205 +    keynames[SDLK_DELETE] = "delete";
   1.206  
   1.207 -	keynames[SDLK_WORLD_0] = "world 0";
   1.208 -	keynames[SDLK_WORLD_1] = "world 1";
   1.209 -	keynames[SDLK_WORLD_2] = "world 2";
   1.210 -	keynames[SDLK_WORLD_3] = "world 3";
   1.211 -	keynames[SDLK_WORLD_4] = "world 4";
   1.212 -	keynames[SDLK_WORLD_5] = "world 5";
   1.213 -	keynames[SDLK_WORLD_6] = "world 6";
   1.214 -	keynames[SDLK_WORLD_7] = "world 7";
   1.215 -	keynames[SDLK_WORLD_8] = "world 8";
   1.216 -	keynames[SDLK_WORLD_9] = "world 9";
   1.217 -	keynames[SDLK_WORLD_10] = "world 10";
   1.218 -	keynames[SDLK_WORLD_11] = "world 11";
   1.219 -	keynames[SDLK_WORLD_12] = "world 12";
   1.220 -	keynames[SDLK_WORLD_13] = "world 13";
   1.221 -	keynames[SDLK_WORLD_14] = "world 14";
   1.222 -	keynames[SDLK_WORLD_15] = "world 15";
   1.223 -	keynames[SDLK_WORLD_16] = "world 16";
   1.224 -	keynames[SDLK_WORLD_17] = "world 17";
   1.225 -	keynames[SDLK_WORLD_18] = "world 18";
   1.226 -	keynames[SDLK_WORLD_19] = "world 19";
   1.227 -	keynames[SDLK_WORLD_20] = "world 20";
   1.228 -	keynames[SDLK_WORLD_21] = "world 21";
   1.229 -	keynames[SDLK_WORLD_22] = "world 22";
   1.230 -	keynames[SDLK_WORLD_23] = "world 23";
   1.231 -	keynames[SDLK_WORLD_24] = "world 24";
   1.232 -	keynames[SDLK_WORLD_25] = "world 25";
   1.233 -	keynames[SDLK_WORLD_26] = "world 26";
   1.234 -	keynames[SDLK_WORLD_27] = "world 27";
   1.235 -	keynames[SDLK_WORLD_28] = "world 28";
   1.236 -	keynames[SDLK_WORLD_29] = "world 29";
   1.237 -	keynames[SDLK_WORLD_30] = "world 30";
   1.238 -	keynames[SDLK_WORLD_31] = "world 31";
   1.239 -	keynames[SDLK_WORLD_32] = "world 32";
   1.240 -	keynames[SDLK_WORLD_33] = "world 33";
   1.241 -	keynames[SDLK_WORLD_34] = "world 34";
   1.242 -	keynames[SDLK_WORLD_35] = "world 35";
   1.243 -	keynames[SDLK_WORLD_36] = "world 36";
   1.244 -	keynames[SDLK_WORLD_37] = "world 37";
   1.245 -	keynames[SDLK_WORLD_38] = "world 38";
   1.246 -	keynames[SDLK_WORLD_39] = "world 39";
   1.247 -	keynames[SDLK_WORLD_40] = "world 40";
   1.248 -	keynames[SDLK_WORLD_41] = "world 41";
   1.249 -	keynames[SDLK_WORLD_42] = "world 42";
   1.250 -	keynames[SDLK_WORLD_43] = "world 43";
   1.251 -	keynames[SDLK_WORLD_44] = "world 44";
   1.252 -	keynames[SDLK_WORLD_45] = "world 45";
   1.253 -	keynames[SDLK_WORLD_46] = "world 46";
   1.254 -	keynames[SDLK_WORLD_47] = "world 47";
   1.255 -	keynames[SDLK_WORLD_48] = "world 48";
   1.256 -	keynames[SDLK_WORLD_49] = "world 49";
   1.257 -	keynames[SDLK_WORLD_50] = "world 50";
   1.258 -	keynames[SDLK_WORLD_51] = "world 51";
   1.259 -	keynames[SDLK_WORLD_52] = "world 52";
   1.260 -	keynames[SDLK_WORLD_53] = "world 53";
   1.261 -	keynames[SDLK_WORLD_54] = "world 54";
   1.262 -	keynames[SDLK_WORLD_55] = "world 55";
   1.263 -	keynames[SDLK_WORLD_56] = "world 56";
   1.264 -	keynames[SDLK_WORLD_57] = "world 57";
   1.265 -	keynames[SDLK_WORLD_58] = "world 58";
   1.266 -	keynames[SDLK_WORLD_59] = "world 59";
   1.267 -	keynames[SDLK_WORLD_60] = "world 60";
   1.268 -	keynames[SDLK_WORLD_61] = "world 61";
   1.269 -	keynames[SDLK_WORLD_62] = "world 62";
   1.270 -	keynames[SDLK_WORLD_63] = "world 63";
   1.271 -	keynames[SDLK_WORLD_64] = "world 64";
   1.272 -	keynames[SDLK_WORLD_65] = "world 65";
   1.273 -	keynames[SDLK_WORLD_66] = "world 66";
   1.274 -	keynames[SDLK_WORLD_67] = "world 67";
   1.275 -	keynames[SDLK_WORLD_68] = "world 68";
   1.276 -	keynames[SDLK_WORLD_69] = "world 69";
   1.277 -	keynames[SDLK_WORLD_70] = "world 70";
   1.278 -	keynames[SDLK_WORLD_71] = "world 71";
   1.279 -	keynames[SDLK_WORLD_72] = "world 72";
   1.280 -	keynames[SDLK_WORLD_73] = "world 73";
   1.281 -	keynames[SDLK_WORLD_74] = "world 74";
   1.282 -	keynames[SDLK_WORLD_75] = "world 75";
   1.283 -	keynames[SDLK_WORLD_76] = "world 76";
   1.284 -	keynames[SDLK_WORLD_77] = "world 77";
   1.285 -	keynames[SDLK_WORLD_78] = "world 78";
   1.286 -	keynames[SDLK_WORLD_79] = "world 79";
   1.287 -	keynames[SDLK_WORLD_80] = "world 80";
   1.288 -	keynames[SDLK_WORLD_81] = "world 81";
   1.289 -	keynames[SDLK_WORLD_82] = "world 82";
   1.290 -	keynames[SDLK_WORLD_83] = "world 83";
   1.291 -	keynames[SDLK_WORLD_84] = "world 84";
   1.292 -	keynames[SDLK_WORLD_85] = "world 85";
   1.293 -	keynames[SDLK_WORLD_86] = "world 86";
   1.294 -	keynames[SDLK_WORLD_87] = "world 87";
   1.295 -	keynames[SDLK_WORLD_88] = "world 88";
   1.296 -	keynames[SDLK_WORLD_89] = "world 89";
   1.297 -	keynames[SDLK_WORLD_90] = "world 90";
   1.298 -	keynames[SDLK_WORLD_91] = "world 91";
   1.299 -	keynames[SDLK_WORLD_92] = "world 92";
   1.300 -	keynames[SDLK_WORLD_93] = "world 93";
   1.301 -	keynames[SDLK_WORLD_94] = "world 94";
   1.302 -	keynames[SDLK_WORLD_95] = "world 95";
   1.303 +    keynames[SDLK_WORLD_0] = "world 0";
   1.304 +    keynames[SDLK_WORLD_1] = "world 1";
   1.305 +    keynames[SDLK_WORLD_2] = "world 2";
   1.306 +    keynames[SDLK_WORLD_3] = "world 3";
   1.307 +    keynames[SDLK_WORLD_4] = "world 4";
   1.308 +    keynames[SDLK_WORLD_5] = "world 5";
   1.309 +    keynames[SDLK_WORLD_6] = "world 6";
   1.310 +    keynames[SDLK_WORLD_7] = "world 7";
   1.311 +    keynames[SDLK_WORLD_8] = "world 8";
   1.312 +    keynames[SDLK_WORLD_9] = "world 9";
   1.313 +    keynames[SDLK_WORLD_10] = "world 10";
   1.314 +    keynames[SDLK_WORLD_11] = "world 11";
   1.315 +    keynames[SDLK_WORLD_12] = "world 12";
   1.316 +    keynames[SDLK_WORLD_13] = "world 13";
   1.317 +    keynames[SDLK_WORLD_14] = "world 14";
   1.318 +    keynames[SDLK_WORLD_15] = "world 15";
   1.319 +    keynames[SDLK_WORLD_16] = "world 16";
   1.320 +    keynames[SDLK_WORLD_17] = "world 17";
   1.321 +    keynames[SDLK_WORLD_18] = "world 18";
   1.322 +    keynames[SDLK_WORLD_19] = "world 19";
   1.323 +    keynames[SDLK_WORLD_20] = "world 20";
   1.324 +    keynames[SDLK_WORLD_21] = "world 21";
   1.325 +    keynames[SDLK_WORLD_22] = "world 22";
   1.326 +    keynames[SDLK_WORLD_23] = "world 23";
   1.327 +    keynames[SDLK_WORLD_24] = "world 24";
   1.328 +    keynames[SDLK_WORLD_25] = "world 25";
   1.329 +    keynames[SDLK_WORLD_26] = "world 26";
   1.330 +    keynames[SDLK_WORLD_27] = "world 27";
   1.331 +    keynames[SDLK_WORLD_28] = "world 28";
   1.332 +    keynames[SDLK_WORLD_29] = "world 29";
   1.333 +    keynames[SDLK_WORLD_30] = "world 30";
   1.334 +    keynames[SDLK_WORLD_31] = "world 31";
   1.335 +    keynames[SDLK_WORLD_32] = "world 32";
   1.336 +    keynames[SDLK_WORLD_33] = "world 33";
   1.337 +    keynames[SDLK_WORLD_34] = "world 34";
   1.338 +    keynames[SDLK_WORLD_35] = "world 35";
   1.339 +    keynames[SDLK_WORLD_36] = "world 36";
   1.340 +    keynames[SDLK_WORLD_37] = "world 37";
   1.341 +    keynames[SDLK_WORLD_38] = "world 38";
   1.342 +    keynames[SDLK_WORLD_39] = "world 39";
   1.343 +    keynames[SDLK_WORLD_40] = "world 40";
   1.344 +    keynames[SDLK_WORLD_41] = "world 41";
   1.345 +    keynames[SDLK_WORLD_42] = "world 42";
   1.346 +    keynames[SDLK_WORLD_43] = "world 43";
   1.347 +    keynames[SDLK_WORLD_44] = "world 44";
   1.348 +    keynames[SDLK_WORLD_45] = "world 45";
   1.349 +    keynames[SDLK_WORLD_46] = "world 46";
   1.350 +    keynames[SDLK_WORLD_47] = "world 47";
   1.351 +    keynames[SDLK_WORLD_48] = "world 48";
   1.352 +    keynames[SDLK_WORLD_49] = "world 49";
   1.353 +    keynames[SDLK_WORLD_50] = "world 50";
   1.354 +    keynames[SDLK_WORLD_51] = "world 51";
   1.355 +    keynames[SDLK_WORLD_52] = "world 52";
   1.356 +    keynames[SDLK_WORLD_53] = "world 53";
   1.357 +    keynames[SDLK_WORLD_54] = "world 54";
   1.358 +    keynames[SDLK_WORLD_55] = "world 55";
   1.359 +    keynames[SDLK_WORLD_56] = "world 56";
   1.360 +    keynames[SDLK_WORLD_57] = "world 57";
   1.361 +    keynames[SDLK_WORLD_58] = "world 58";
   1.362 +    keynames[SDLK_WORLD_59] = "world 59";
   1.363 +    keynames[SDLK_WORLD_60] = "world 60";
   1.364 +    keynames[SDLK_WORLD_61] = "world 61";
   1.365 +    keynames[SDLK_WORLD_62] = "world 62";
   1.366 +    keynames[SDLK_WORLD_63] = "world 63";
   1.367 +    keynames[SDLK_WORLD_64] = "world 64";
   1.368 +    keynames[SDLK_WORLD_65] = "world 65";
   1.369 +    keynames[SDLK_WORLD_66] = "world 66";
   1.370 +    keynames[SDLK_WORLD_67] = "world 67";
   1.371 +    keynames[SDLK_WORLD_68] = "world 68";
   1.372 +    keynames[SDLK_WORLD_69] = "world 69";
   1.373 +    keynames[SDLK_WORLD_70] = "world 70";
   1.374 +    keynames[SDLK_WORLD_71] = "world 71";
   1.375 +    keynames[SDLK_WORLD_72] = "world 72";
   1.376 +    keynames[SDLK_WORLD_73] = "world 73";
   1.377 +    keynames[SDLK_WORLD_74] = "world 74";
   1.378 +    keynames[SDLK_WORLD_75] = "world 75";
   1.379 +    keynames[SDLK_WORLD_76] = "world 76";
   1.380 +    keynames[SDLK_WORLD_77] = "world 77";
   1.381 +    keynames[SDLK_WORLD_78] = "world 78";
   1.382 +    keynames[SDLK_WORLD_79] = "world 79";
   1.383 +    keynames[SDLK_WORLD_80] = "world 80";
   1.384 +    keynames[SDLK_WORLD_81] = "world 81";
   1.385 +    keynames[SDLK_WORLD_82] = "world 82";
   1.386 +    keynames[SDLK_WORLD_83] = "world 83";
   1.387 +    keynames[SDLK_WORLD_84] = "world 84";
   1.388 +    keynames[SDLK_WORLD_85] = "world 85";
   1.389 +    keynames[SDLK_WORLD_86] = "world 86";
   1.390 +    keynames[SDLK_WORLD_87] = "world 87";
   1.391 +    keynames[SDLK_WORLD_88] = "world 88";
   1.392 +    keynames[SDLK_WORLD_89] = "world 89";
   1.393 +    keynames[SDLK_WORLD_90] = "world 90";
   1.394 +    keynames[SDLK_WORLD_91] = "world 91";
   1.395 +    keynames[SDLK_WORLD_92] = "world 92";
   1.396 +    keynames[SDLK_WORLD_93] = "world 93";
   1.397 +    keynames[SDLK_WORLD_94] = "world 94";
   1.398 +    keynames[SDLK_WORLD_95] = "world 95";
   1.399  
   1.400 -	keynames[SDLK_KP0] = "[0]";
   1.401 -	keynames[SDLK_KP1] = "[1]";
   1.402 -	keynames[SDLK_KP2] = "[2]";
   1.403 -	keynames[SDLK_KP3] = "[3]";
   1.404 -	keynames[SDLK_KP4] = "[4]";
   1.405 -	keynames[SDLK_KP5] = "[5]";
   1.406 -	keynames[SDLK_KP6] = "[6]";
   1.407 -	keynames[SDLK_KP7] = "[7]";
   1.408 -	keynames[SDLK_KP8] = "[8]";
   1.409 -	keynames[SDLK_KP9] = "[9]";
   1.410 -	keynames[SDLK_KP_PERIOD] = "[.]";
   1.411 -	keynames[SDLK_KP_DIVIDE] = "[/]";
   1.412 -	keynames[SDLK_KP_MULTIPLY] = "[*]";
   1.413 -	keynames[SDLK_KP_MINUS] = "[-]";
   1.414 -	keynames[SDLK_KP_PLUS] = "[+]";
   1.415 -	keynames[SDLK_KP_ENTER] = "enter";
   1.416 -	keynames[SDLK_KP_EQUALS] = "equals";
   1.417 +    keynames[SDLK_KP0] = "[0]";
   1.418 +    keynames[SDLK_KP1] = "[1]";
   1.419 +    keynames[SDLK_KP2] = "[2]";
   1.420 +    keynames[SDLK_KP3] = "[3]";
   1.421 +    keynames[SDLK_KP4] = "[4]";
   1.422 +    keynames[SDLK_KP5] = "[5]";
   1.423 +    keynames[SDLK_KP6] = "[6]";
   1.424 +    keynames[SDLK_KP7] = "[7]";
   1.425 +    keynames[SDLK_KP8] = "[8]";
   1.426 +    keynames[SDLK_KP9] = "[9]";
   1.427 +    keynames[SDLK_KP_PERIOD] = "[.]";
   1.428 +    keynames[SDLK_KP_DIVIDE] = "[/]";
   1.429 +    keynames[SDLK_KP_MULTIPLY] = "[*]";
   1.430 +    keynames[SDLK_KP_MINUS] = "[-]";
   1.431 +    keynames[SDLK_KP_PLUS] = "[+]";
   1.432 +    keynames[SDLK_KP_ENTER] = "enter";
   1.433 +    keynames[SDLK_KP_EQUALS] = "equals";
   1.434  
   1.435 -	keynames[SDLK_UP] = "up";
   1.436 -	keynames[SDLK_DOWN] = "down";
   1.437 -	keynames[SDLK_RIGHT] = "right";
   1.438 -	keynames[SDLK_LEFT] = "left";
   1.439 -	keynames[SDLK_DOWN] = "down";
   1.440 -	keynames[SDLK_INSERT] = "insert";
   1.441 -	keynames[SDLK_HOME] = "home";
   1.442 -	keynames[SDLK_END] = "end";
   1.443 -	keynames[SDLK_PAGEUP] = "page up";
   1.444 -	keynames[SDLK_PAGEDOWN] = "page down";
   1.445 +    keynames[SDLK_UP] = "up";
   1.446 +    keynames[SDLK_DOWN] = "down";
   1.447 +    keynames[SDLK_RIGHT] = "right";
   1.448 +    keynames[SDLK_LEFT] = "left";
   1.449 +    keynames[SDLK_DOWN] = "down";
   1.450 +    keynames[SDLK_INSERT] = "insert";
   1.451 +    keynames[SDLK_HOME] = "home";
   1.452 +    keynames[SDLK_END] = "end";
   1.453 +    keynames[SDLK_PAGEUP] = "page up";
   1.454 +    keynames[SDLK_PAGEDOWN] = "page down";
   1.455  
   1.456 -	keynames[SDLK_F1] = "f1";
   1.457 -	keynames[SDLK_F2] = "f2";
   1.458 -	keynames[SDLK_F3] = "f3";
   1.459 -	keynames[SDLK_F4] = "f4";
   1.460 -	keynames[SDLK_F5] = "f5";
   1.461 -	keynames[SDLK_F6] = "f6";
   1.462 -	keynames[SDLK_F7] = "f7";
   1.463 -	keynames[SDLK_F8] = "f8";
   1.464 -	keynames[SDLK_F9] = "f9";
   1.465 -	keynames[SDLK_F10] = "f10";
   1.466 -	keynames[SDLK_F11] = "f11";
   1.467 -	keynames[SDLK_F12] = "f12";
   1.468 -	keynames[SDLK_F13] = "f13";
   1.469 -	keynames[SDLK_F14] = "f14";
   1.470 -	keynames[SDLK_F15] = "f15";
   1.471 +    keynames[SDLK_F1] = "f1";
   1.472 +    keynames[SDLK_F2] = "f2";
   1.473 +    keynames[SDLK_F3] = "f3";
   1.474 +    keynames[SDLK_F4] = "f4";
   1.475 +    keynames[SDLK_F5] = "f5";
   1.476 +    keynames[SDLK_F6] = "f6";
   1.477 +    keynames[SDLK_F7] = "f7";
   1.478 +    keynames[SDLK_F8] = "f8";
   1.479 +    keynames[SDLK_F9] = "f9";
   1.480 +    keynames[SDLK_F10] = "f10";
   1.481 +    keynames[SDLK_F11] = "f11";
   1.482 +    keynames[SDLK_F12] = "f12";
   1.483 +    keynames[SDLK_F13] = "f13";
   1.484 +    keynames[SDLK_F14] = "f14";
   1.485 +    keynames[SDLK_F15] = "f15";
   1.486  
   1.487 -	keynames[SDLK_NUMLOCK] = "numlock";
   1.488 -	keynames[SDLK_CAPSLOCK] = "caps lock";
   1.489 -	keynames[SDLK_SCROLLOCK] = "scroll lock";
   1.490 -	keynames[SDLK_RSHIFT] = "right shift";
   1.491 -	keynames[SDLK_LSHIFT] = "left shift";
   1.492 -	keynames[SDLK_RCTRL] = "right ctrl";
   1.493 -	keynames[SDLK_LCTRL] = "left ctrl";
   1.494 -	keynames[SDLK_RALT] = "right alt";
   1.495 -	keynames[SDLK_LALT] = "left alt";
   1.496 -	keynames[SDLK_RMETA] = "right meta";
   1.497 -	keynames[SDLK_LMETA] = "left meta";
   1.498 -	keynames[SDLK_LSUPER] = "left super";	/* "Windows" keys */
   1.499 -	keynames[SDLK_RSUPER] = "right super";	
   1.500 -	keynames[SDLK_MODE] = "alt gr";
   1.501 -	keynames[SDLK_COMPOSE] = "compose";
   1.502 +    keynames[SDLK_NUMLOCK] = "numlock";
   1.503 +    keynames[SDLK_CAPSLOCK] = "caps lock";
   1.504 +    keynames[SDLK_SCROLLOCK] = "scroll lock";
   1.505 +    keynames[SDLK_RSHIFT] = "right shift";
   1.506 +    keynames[SDLK_LSHIFT] = "left shift";
   1.507 +    keynames[SDLK_RCTRL] = "right ctrl";
   1.508 +    keynames[SDLK_LCTRL] = "left ctrl";
   1.509 +    keynames[SDLK_RALT] = "right alt";
   1.510 +    keynames[SDLK_LALT] = "left alt";
   1.511 +    keynames[SDLK_RMETA] = "right meta";
   1.512 +    keynames[SDLK_LMETA] = "left meta";
   1.513 +    keynames[SDLK_LSUPER] = "left super";       /* "Windows" keys */
   1.514 +    keynames[SDLK_RSUPER] = "right super";
   1.515 +    keynames[SDLK_MODE] = "alt gr";
   1.516 +    keynames[SDLK_COMPOSE] = "compose";
   1.517  
   1.518 -	keynames[SDLK_HELP] = "help";
   1.519 -	keynames[SDLK_PRINT] = "print screen";
   1.520 -	keynames[SDLK_SYSREQ] = "sys req";
   1.521 -	keynames[SDLK_BREAK] = "break";
   1.522 -	keynames[SDLK_MENU] = "menu";
   1.523 -	keynames[SDLK_POWER] = "power";
   1.524 -	keynames[SDLK_EURO] = "euro";
   1.525 -	keynames[SDLK_UNDO] = "undo";
   1.526 +    keynames[SDLK_HELP] = "help";
   1.527 +    keynames[SDLK_PRINT] = "print screen";
   1.528 +    keynames[SDLK_SYSREQ] = "sys req";
   1.529 +    keynames[SDLK_BREAK] = "break";
   1.530 +    keynames[SDLK_MENU] = "menu";
   1.531 +    keynames[SDLK_POWER] = "power";
   1.532 +    keynames[SDLK_EURO] = "euro";
   1.533 +    keynames[SDLK_UNDO] = "undo";
   1.534  
   1.535 -	/* Done.  Whew. */
   1.536 -	return(0);
   1.537 +    /* Done.  Whew. */
   1.538 +    return (0);
   1.539  }
   1.540 -void SDL_KeyboardQuit(void)
   1.541 +
   1.542 +void
   1.543 +SDL_KeyboardQuit (void)
   1.544  {
   1.545  }
   1.546  
   1.547  /* We lost the keyboard, so post key up messages for all pressed keys */
   1.548 -void SDL_ResetKeyboard(void)
   1.549 +void
   1.550 +SDL_ResetKeyboard (void)
   1.551  {
   1.552 -	SDL_keysym keysym;
   1.553 -	SDLKey key;
   1.554 +    SDL_keysym keysym;
   1.555 +    SDLKey key;
   1.556  
   1.557 -	SDL_memset(&keysym, 0, (sizeof keysym));
   1.558 -	for ( key=SDLK_FIRST; key<SDLK_LAST; ++key ) {
   1.559 -		if ( SDL_KeyState[key] == SDL_PRESSED ) {
   1.560 -			keysym.sym = key;
   1.561 -			SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
   1.562 -		}
   1.563 -	}
   1.564 -	SDL_KeyRepeat.timestamp = 0;
   1.565 +    SDL_memset (&keysym, 0, (sizeof keysym));
   1.566 +    for (key = SDLK_FIRST; key < SDLK_LAST; ++key) {
   1.567 +        if (SDL_KeyState[key] == SDL_PRESSED) {
   1.568 +            keysym.sym = key;
   1.569 +            SDL_PrivateKeyboard (SDL_RELEASED, &keysym);
   1.570 +        }
   1.571 +    }
   1.572 +    SDL_KeyRepeat.timestamp = 0;
   1.573  }
   1.574  
   1.575 -int SDL_EnableUNICODE(int enable)
   1.576 +int
   1.577 +SDL_EnableUNICODE (int enable)
   1.578  {
   1.579 -	int old_mode;
   1.580 +    int old_mode;
   1.581  
   1.582 -	old_mode = SDL_TranslateUNICODE;
   1.583 -	if ( enable >= 0 ) {
   1.584 -		SDL_TranslateUNICODE = enable;
   1.585 -	}
   1.586 -	return(old_mode);
   1.587 +    old_mode = SDL_TranslateUNICODE;
   1.588 +    if (enable >= 0) {
   1.589 +        SDL_TranslateUNICODE = enable;
   1.590 +    }
   1.591 +    return (old_mode);
   1.592  }
   1.593  
   1.594 -Uint8 * SDL_GetKeyState (int *numkeys)
   1.595 +Uint8 *
   1.596 +SDL_GetKeyState (int *numkeys)
   1.597  {
   1.598 -	if ( numkeys != (int *)0 )
   1.599 -		*numkeys = SDLK_LAST;
   1.600 -	return(SDL_KeyState);
   1.601 -}
   1.602 -SDLMod SDL_GetModState (void)
   1.603 -{
   1.604 -	return(SDL_ModState);
   1.605 -}
   1.606 -void SDL_SetModState (SDLMod modstate)
   1.607 -{
   1.608 -	SDL_ModState = modstate;
   1.609 +    if (numkeys != (int *) 0)
   1.610 +        *numkeys = SDLK_LAST;
   1.611 +    return (SDL_KeyState);
   1.612  }
   1.613  
   1.614 -char *SDL_GetKeyName(SDLKey key)
   1.615 +SDLMod
   1.616 +SDL_GetModState (void)
   1.617  {
   1.618 -	const char *keyname;
   1.619 +    return (SDL_ModState);
   1.620 +}
   1.621  
   1.622 -	keyname = NULL;
   1.623 -	if ( key < SDLK_LAST ) {
   1.624 -		keyname = keynames[key];
   1.625 -	}
   1.626 -	if ( keyname == NULL ) {
   1.627 -		keyname = "unknown key";
   1.628 -	}
   1.629 -	/* FIXME: make this function const in 1.3 */
   1.630 -	return (char *)(keyname);
   1.631 +void
   1.632 +SDL_SetModState (SDLMod modstate)
   1.633 +{
   1.634 +    SDL_ModState = modstate;
   1.635 +}
   1.636 +
   1.637 +char *
   1.638 +SDL_GetKeyName (SDLKey key)
   1.639 +{
   1.640 +    const char *keyname;
   1.641 +
   1.642 +    keyname = NULL;
   1.643 +    if (key < SDLK_LAST) {
   1.644 +        keyname = keynames[key];
   1.645 +    }
   1.646 +    if (keyname == NULL) {
   1.647 +        keyname = "unknown key";
   1.648 +    }
   1.649 +    /* FIXME: make this function const in 1.3 */
   1.650 +    return (char *) (keyname);
   1.651  }
   1.652  
   1.653  /* These are global for SDL_eventloop.c */
   1.654 -int SDL_PrivateKeyboard(Uint8 state, SDL_keysym *keysym)
   1.655 +int
   1.656 +SDL_PrivateKeyboard (Uint8 state, SDL_keysym * keysym)
   1.657  {
   1.658 -	SDL_Event event;
   1.659 -	int posted, repeatable;
   1.660 -	Uint16 modstate;
   1.661 +    SDL_Event event;
   1.662 +    int posted, repeatable;
   1.663 +    Uint16 modstate;
   1.664  
   1.665 -	SDL_memset(&event, 0, sizeof(event));
   1.666 +    SDL_memset (&event, 0, sizeof (event));
   1.667  
   1.668  #if 0
   1.669 -printf("The '%s' key has been %s\n", SDL_GetKeyName(keysym->sym), 
   1.670 -				state == SDL_PRESSED ? "pressed" : "released");
   1.671 +    printf ("The '%s' key has been %s\n", SDL_GetKeyName (keysym->sym),
   1.672 +            state == SDL_PRESSED ? "pressed" : "released");
   1.673  #endif
   1.674 -	/* Set up the keysym */
   1.675 -	modstate = (Uint16)SDL_ModState;
   1.676 +    /* Set up the keysym */
   1.677 +    modstate = (Uint16) SDL_ModState;
   1.678  
   1.679 -	repeatable = 0;
   1.680 +    repeatable = 0;
   1.681  
   1.682 -	if ( state == SDL_PRESSED ) {
   1.683 -		keysym->mod = (SDLMod)modstate;
   1.684 -		switch (keysym->sym) {
   1.685 -			case SDLK_UNKNOWN:
   1.686 -				break;
   1.687 -			case SDLK_NUMLOCK:
   1.688 -				modstate ^= KMOD_NUM;
   1.689 -				if ( ! (modstate&KMOD_NUM) )
   1.690 -					state = SDL_RELEASED;
   1.691 -				keysym->mod = (SDLMod)modstate;
   1.692 -				break;
   1.693 -			case SDLK_CAPSLOCK:
   1.694 -				modstate ^= KMOD_CAPS;
   1.695 -				if ( ! (modstate&KMOD_CAPS) )
   1.696 -					state = SDL_RELEASED;
   1.697 -				keysym->mod = (SDLMod)modstate;
   1.698 -				break;
   1.699 -			case SDLK_LCTRL:
   1.700 -				modstate |= KMOD_LCTRL;
   1.701 -				break;
   1.702 -			case SDLK_RCTRL:
   1.703 -				modstate |= KMOD_RCTRL;
   1.704 -				break;
   1.705 -			case SDLK_LSHIFT:
   1.706 -				modstate |= KMOD_LSHIFT;
   1.707 -				break;
   1.708 -			case SDLK_RSHIFT:
   1.709 -				modstate |= KMOD_RSHIFT;
   1.710 -				break;
   1.711 -			case SDLK_LALT:
   1.712 -				modstate |= KMOD_LALT;
   1.713 -				break;
   1.714 -			case SDLK_RALT:
   1.715 -				modstate |= KMOD_RALT;
   1.716 -				break;
   1.717 -			case SDLK_LMETA:
   1.718 -				modstate |= KMOD_LMETA;
   1.719 -				break;
   1.720 -			case SDLK_RMETA:
   1.721 -				modstate |= KMOD_RMETA;
   1.722 -				break;
   1.723 -			case SDLK_MODE:
   1.724 -				modstate |= KMOD_MODE;
   1.725 -				break;
   1.726 -			default:
   1.727 -				repeatable = 1;
   1.728 -				break;
   1.729 -		}
   1.730 -	} else {
   1.731 -		switch (keysym->sym) {
   1.732 -			case SDLK_UNKNOWN:
   1.733 -				break;
   1.734 -			case SDLK_NUMLOCK:
   1.735 -			case SDLK_CAPSLOCK:
   1.736 -				/* Only send keydown events */
   1.737 -				return(0);
   1.738 -			case SDLK_LCTRL:
   1.739 -				modstate &= ~KMOD_LCTRL;
   1.740 -				break;
   1.741 -			case SDLK_RCTRL:
   1.742 -				modstate &= ~KMOD_RCTRL;
   1.743 -				break;
   1.744 -			case SDLK_LSHIFT:
   1.745 -				modstate &= ~KMOD_LSHIFT;
   1.746 -				break;
   1.747 -			case SDLK_RSHIFT:
   1.748 -				modstate &= ~KMOD_RSHIFT;
   1.749 -				break;
   1.750 -			case SDLK_LALT:
   1.751 -				modstate &= ~KMOD_LALT;
   1.752 -				break;
   1.753 -			case SDLK_RALT:
   1.754 -				modstate &= ~KMOD_RALT;
   1.755 -				break;
   1.756 -			case SDLK_LMETA:
   1.757 -				modstate &= ~KMOD_LMETA;
   1.758 -				break;
   1.759 -			case SDLK_RMETA:
   1.760 -				modstate &= ~KMOD_RMETA;
   1.761 -				break;
   1.762 -			case SDLK_MODE:
   1.763 -				modstate &= ~KMOD_MODE;
   1.764 -				break;
   1.765 -			default:
   1.766 -				break;
   1.767 -		}
   1.768 -		keysym->mod = (SDLMod)modstate;
   1.769 -	}
   1.770 +    if (state == SDL_PRESSED) {
   1.771 +        keysym->mod = (SDLMod) modstate;
   1.772 +        switch (keysym->sym) {
   1.773 +        case SDLK_UNKNOWN:
   1.774 +            break;
   1.775 +        case SDLK_NUMLOCK:
   1.776 +            modstate ^= KMOD_NUM;
   1.777 +            if (!(modstate & KMOD_NUM))
   1.778 +                state = SDL_RELEASED;
   1.779 +            keysym->mod = (SDLMod) modstate;
   1.780 +            break;
   1.781 +        case SDLK_CAPSLOCK:
   1.782 +            modstate ^= KMOD_CAPS;
   1.783 +            if (!(modstate & KMOD_CAPS))
   1.784 +                state = SDL_RELEASED;
   1.785 +            keysym->mod = (SDLMod) modstate;
   1.786 +            break;
   1.787 +        case SDLK_LCTRL:
   1.788 +            modstate |= KMOD_LCTRL;
   1.789 +            break;
   1.790 +        case SDLK_RCTRL:
   1.791 +            modstate |= KMOD_RCTRL;
   1.792 +            break;
   1.793 +        case SDLK_LSHIFT:
   1.794 +            modstate |= KMOD_LSHIFT;
   1.795 +            break;
   1.796 +        case SDLK_RSHIFT:
   1.797 +            modstate |= KMOD_RSHIFT;
   1.798 +            break;
   1.799 +        case SDLK_LALT:
   1.800 +            modstate |= KMOD_LALT;
   1.801 +            break;
   1.802 +        case SDLK_RALT:
   1.803 +            modstate |= KMOD_RALT;
   1.804 +            break;
   1.805 +        case SDLK_LMETA:
   1.806 +            modstate |= KMOD_LMETA;
   1.807 +            break;
   1.808 +        case SDLK_RMETA:
   1.809 +            modstate |= KMOD_RMETA;
   1.810 +            break;
   1.811 +        case SDLK_MODE:
   1.812 +            modstate |= KMOD_MODE;
   1.813 +            break;
   1.814 +        default:
   1.815 +            repeatable = 1;
   1.816 +            break;
   1.817 +        }
   1.818 +    } else {
   1.819 +        switch (keysym->sym) {
   1.820 +        case SDLK_UNKNOWN:
   1.821 +            break;
   1.822 +        case SDLK_NUMLOCK:
   1.823 +        case SDLK_CAPSLOCK:
   1.824 +            /* Only send keydown events */
   1.825 +            return (0);
   1.826 +        case SDLK_LCTRL:
   1.827 +            modstate &= ~KMOD_LCTRL;
   1.828 +            break;
   1.829 +        case SDLK_RCTRL:
   1.830 +            modstate &= ~KMOD_RCTRL;
   1.831 +            break;
   1.832 +        case SDLK_LSHIFT:
   1.833 +            modstate &= ~KMOD_LSHIFT;
   1.834 +            break;
   1.835 +        case SDLK_RSHIFT:
   1.836 +            modstate &= ~KMOD_RSHIFT;
   1.837 +            break;
   1.838 +        case SDLK_LALT:
   1.839 +            modstate &= ~KMOD_LALT;
   1.840 +            break;
   1.841 +        case SDLK_RALT:
   1.842 +            modstate &= ~KMOD_RALT;
   1.843 +            break;
   1.844 +        case SDLK_LMETA:
   1.845 +            modstate &= ~KMOD_LMETA;
   1.846 +            break;
   1.847 +        case SDLK_RMETA:
   1.848 +            modstate &= ~KMOD_RMETA;
   1.849 +            break;
   1.850 +        case SDLK_MODE:
   1.851 +            modstate &= ~KMOD_MODE;
   1.852 +            break;
   1.853 +        default:
   1.854 +            break;
   1.855 +        }
   1.856 +        keysym->mod = (SDLMod) modstate;
   1.857 +    }
   1.858  
   1.859 -	/* Figure out what type of event this is */
   1.860 -	switch (state) {
   1.861 -		case SDL_PRESSED:
   1.862 -			event.type = SDL_KEYDOWN;
   1.863 -			break;
   1.864 -		case SDL_RELEASED:
   1.865 -			event.type = SDL_KEYUP;
   1.866 -			/*
   1.867 -			 * jk 991215 - Added
   1.868 -			 */
   1.869 -			if ( SDL_KeyRepeat.timestamp &&
   1.870 -			     SDL_KeyRepeat.evt.key.keysym.sym == keysym->sym ) {
   1.871 -				SDL_KeyRepeat.timestamp = 0;
   1.872 -			}
   1.873 -			break;
   1.874 -		default:
   1.875 -			/* Invalid state -- bail */
   1.876 -			return(0);
   1.877 -	}
   1.878 +    /* Figure out what type of event this is */
   1.879 +    switch (state) {
   1.880 +    case SDL_PRESSED:
   1.881 +        event.type = SDL_KEYDOWN;
   1.882 +        break;
   1.883 +    case SDL_RELEASED:
   1.884 +        event.type = SDL_KEYUP;
   1.885 +        /*
   1.886 +         * jk 991215 - Added
   1.887 +         */
   1.888 +        if (SDL_KeyRepeat.timestamp &&
   1.889 +            SDL_KeyRepeat.evt.key.keysym.sym == keysym->sym) {
   1.890 +            SDL_KeyRepeat.timestamp = 0;
   1.891 +        }
   1.892 +        break;
   1.893 +    default:
   1.894 +        /* Invalid state -- bail */
   1.895 +        return (0);
   1.896 +    }
   1.897  
   1.898 -	if ( keysym->sym != SDLK_UNKNOWN ) {
   1.899 -		/* Drop events that don't change state */
   1.900 -		if ( SDL_KeyState[keysym->sym] == state ) {
   1.901 +    if (keysym->sym != SDLK_UNKNOWN) {
   1.902 +        /* Drop events that don't change state */
   1.903 +        if (SDL_KeyState[keysym->sym] == state) {
   1.904  #if 0
   1.905 -printf("Keyboard event didn't change state - dropped!\n");
   1.906 +            printf ("Keyboard event didn't change state - dropped!\n");
   1.907  #endif
   1.908 -			return(0);
   1.909 -		}
   1.910 +            return (0);
   1.911 +        }
   1.912  
   1.913 -		/* Update internal keyboard state */
   1.914 -		SDL_ModState = (SDLMod)modstate;
   1.915 -		SDL_KeyState[keysym->sym] = state;
   1.916 -	}
   1.917 +        /* Update internal keyboard state */
   1.918 +        SDL_ModState = (SDLMod) modstate;
   1.919 +        SDL_KeyState[keysym->sym] = state;
   1.920 +    }
   1.921  
   1.922 -	/* Post the event, if desired */
   1.923 -	posted = 0;
   1.924 -	if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
   1.925 -		event.key.state = state;
   1.926 -		event.key.keysym = *keysym;
   1.927 -		/*
   1.928 -		 * jk 991215 - Added
   1.929 -		 */
   1.930 -		if (repeatable && (SDL_KeyRepeat.delay != 0)) {
   1.931 -			SDL_KeyRepeat.evt = event;
   1.932 -			SDL_KeyRepeat.firsttime = 1;
   1.933 -			SDL_KeyRepeat.timestamp=SDL_GetTicks();
   1.934 -		}
   1.935 -		if ( (SDL_EventOK == NULL) || SDL_EventOK(&event) ) {
   1.936 -			posted = 1;
   1.937 -			SDL_PushEvent(&event);
   1.938 -		}
   1.939 -	}
   1.940 -	return(posted);
   1.941 +    /* Post the event, if desired */
   1.942 +    posted = 0;
   1.943 +    if (SDL_ProcessEvents[event.type] == SDL_ENABLE) {
   1.944 +        event.key.state = state;
   1.945 +        event.key.keysym = *keysym;
   1.946 +        /*
   1.947 +         * jk 991215 - Added
   1.948 +         */
   1.949 +        if (repeatable && (SDL_KeyRepeat.delay != 0)) {
   1.950 +            SDL_KeyRepeat.evt = event;
   1.951 +            SDL_KeyRepeat.firsttime = 1;
   1.952 +            SDL_KeyRepeat.timestamp = SDL_GetTicks ();
   1.953 +        }
   1.954 +        if ((SDL_EventOK == NULL) || SDL_EventOK (&event)) {
   1.955 +            posted = 1;
   1.956 +            SDL_PushEvent (&event);
   1.957 +        }
   1.958 +    }
   1.959 +    return (posted);
   1.960  }
   1.961  
   1.962  /*
   1.963   * jk 991215 - Added
   1.964   */
   1.965 -void SDL_CheckKeyRepeat(void)
   1.966 +void
   1.967 +SDL_CheckKeyRepeat (void)
   1.968  {
   1.969 -	if ( SDL_KeyRepeat.timestamp ) {
   1.970 -		Uint32 now, interval;
   1.971 +    if (SDL_KeyRepeat.timestamp) {
   1.972 +        Uint32 now, interval;
   1.973  
   1.974 -		now = SDL_GetTicks();
   1.975 -		interval = (now - SDL_KeyRepeat.timestamp);
   1.976 -		if ( SDL_KeyRepeat.firsttime ) {
   1.977 -			if ( interval > (Uint32)SDL_KeyRepeat.delay ) {
   1.978 -				SDL_KeyRepeat.timestamp = now;
   1.979 -				SDL_KeyRepeat.firsttime = 0;
   1.980 -			}
   1.981 -		} else {
   1.982 -			if ( interval > (Uint32)SDL_KeyRepeat.interval ) {
   1.983 -				SDL_KeyRepeat.timestamp = now;
   1.984 -				if ( (SDL_EventOK == NULL) || SDL_EventOK(&SDL_KeyRepeat.evt) ) {
   1.985 -					SDL_PushEvent(&SDL_KeyRepeat.evt);
   1.986 -				}
   1.987 -			}
   1.988 -		}
   1.989 -	}
   1.990 +        now = SDL_GetTicks ();
   1.991 +        interval = (now - SDL_KeyRepeat.timestamp);
   1.992 +        if (SDL_KeyRepeat.firsttime) {
   1.993 +            if (interval > (Uint32) SDL_KeyRepeat.delay) {
   1.994 +                SDL_KeyRepeat.timestamp = now;
   1.995 +                SDL_KeyRepeat.firsttime = 0;
   1.996 +            }
   1.997 +        } else {
   1.998 +            if (interval > (Uint32) SDL_KeyRepeat.interval) {
   1.999 +                SDL_KeyRepeat.timestamp = now;
  1.1000 +                if ((SDL_EventOK == NULL)
  1.1001 +                    || SDL_EventOK (&SDL_KeyRepeat.evt)) {
  1.1002 +                    SDL_PushEvent (&SDL_KeyRepeat.evt);
  1.1003 +                }
  1.1004 +            }
  1.1005 +        }
  1.1006 +    }
  1.1007  }
  1.1008  
  1.1009 -int SDL_EnableKeyRepeat(int delay, int interval)
  1.1010 +int
  1.1011 +SDL_EnableKeyRepeat (int delay, int interval)
  1.1012  {
  1.1013 -	if ( (delay < 0) || (interval < 0) ) {
  1.1014 -		SDL_SetError("keyboard repeat value less than zero");
  1.1015 -		return(-1);
  1.1016 -	}
  1.1017 -	SDL_KeyRepeat.firsttime = 0;
  1.1018 -	SDL_KeyRepeat.delay = delay;
  1.1019 -	SDL_KeyRepeat.interval = interval;
  1.1020 -	SDL_KeyRepeat.timestamp = 0;
  1.1021 -	return(0);
  1.1022 +    if ((delay < 0) || (interval < 0)) {
  1.1023 +        SDL_SetError ("keyboard repeat value less than zero");
  1.1024 +        return (-1);
  1.1025 +    }
  1.1026 +    SDL_KeyRepeat.firsttime = 0;
  1.1027 +    SDL_KeyRepeat.delay = delay;
  1.1028 +    SDL_KeyRepeat.interval = interval;
  1.1029 +    SDL_KeyRepeat.timestamp = 0;
  1.1030 +    return (0);
  1.1031  }
  1.1032  
  1.1033 -void SDL_GetKeyRepeat(int *delay, int *interval)
  1.1034 +void
  1.1035 +SDL_GetKeyRepeat (int *delay, int *interval)
  1.1036  {
  1.1037 -	*delay = SDL_KeyRepeat.delay;
  1.1038 -	*interval = SDL_KeyRepeat.interval;
  1.1039 +    *delay = SDL_KeyRepeat.delay;
  1.1040 +    *interval = SDL_KeyRepeat.interval;
  1.1041  }
  1.1042  
  1.1043 +/* vi: set ts=4 sw=4 expandtab: */