1.1 --- a/test/checkkeys.c Mon May 29 03:53:21 2006 +0000
1.2 +++ b/test/checkkeys.c Mon May 29 04:04:35 2006 +0000
1.3 @@ -12,128 +12,128 @@
1.4
1.5 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
1.6 static void
1.7 -quit (int rc)
1.8 +quit(int rc)
1.9 {
1.10 - SDL_Quit ();
1.11 - exit (rc);
1.12 + SDL_Quit();
1.13 + exit(rc);
1.14 }
1.15
1.16 static void
1.17 -print_modifiers (void)
1.18 +print_modifiers(void)
1.19 {
1.20 int mod;
1.21 - printf (" modifiers:");
1.22 - mod = SDL_GetModState ();
1.23 + printf(" modifiers:");
1.24 + mod = SDL_GetModState();
1.25 if (!mod) {
1.26 - printf (" (none)");
1.27 + printf(" (none)");
1.28 return;
1.29 }
1.30 if (mod & KMOD_LSHIFT)
1.31 - printf (" LSHIFT");
1.32 + printf(" LSHIFT");
1.33 if (mod & KMOD_RSHIFT)
1.34 - printf (" RSHIFT");
1.35 + printf(" RSHIFT");
1.36 if (mod & KMOD_LCTRL)
1.37 - printf (" LCTRL");
1.38 + printf(" LCTRL");
1.39 if (mod & KMOD_RCTRL)
1.40 - printf (" RCTRL");
1.41 + printf(" RCTRL");
1.42 if (mod & KMOD_LALT)
1.43 - printf (" LALT");
1.44 + printf(" LALT");
1.45 if (mod & KMOD_RALT)
1.46 - printf (" RALT");
1.47 + printf(" RALT");
1.48 if (mod & KMOD_LMETA)
1.49 - printf (" LMETA");
1.50 + printf(" LMETA");
1.51 if (mod & KMOD_RMETA)
1.52 - printf (" RMETA");
1.53 + printf(" RMETA");
1.54 if (mod & KMOD_NUM)
1.55 - printf (" NUM");
1.56 + printf(" NUM");
1.57 if (mod & KMOD_CAPS)
1.58 - printf (" CAPS");
1.59 + printf(" CAPS");
1.60 if (mod & KMOD_MODE)
1.61 - printf (" MODE");
1.62 + printf(" MODE");
1.63 }
1.64
1.65 static void
1.66 -PrintKey (SDL_keysym * sym, int pressed)
1.67 +PrintKey(SDL_keysym * sym, int pressed)
1.68 {
1.69 /* Print the keycode, name and state */
1.70 if (sym->sym) {
1.71 - printf ("Key %s: %d-%s ", pressed ? "pressed" : "released",
1.72 - sym->sym, SDL_GetKeyName (sym->sym));
1.73 + printf("Key %s: %d-%s ", pressed ? "pressed" : "released",
1.74 + sym->sym, SDL_GetKeyName(sym->sym));
1.75 } else {
1.76 - printf ("Unknown Key (scancode = %d) %s ", sym->scancode,
1.77 - pressed ? "pressed" : "released");
1.78 + printf("Unknown Key (scancode = %d) %s ", sym->scancode,
1.79 + pressed ? "pressed" : "released");
1.80 }
1.81
1.82 /* Print the translated character, if one exists */
1.83 if (sym->unicode) {
1.84 /* Is it a control-character? */
1.85 if (sym->unicode < ' ') {
1.86 - printf (" (^%c)", sym->unicode + '@');
1.87 + printf(" (^%c)", sym->unicode + '@');
1.88 } else {
1.89 #ifdef UNICODE
1.90 - printf (" (%c)", sym->unicode);
1.91 + printf(" (%c)", sym->unicode);
1.92 #else
1.93 /* This is a Latin-1 program, so only show 8-bits */
1.94 if (!(sym->unicode & 0xFF00))
1.95 - printf (" (%c)", sym->unicode);
1.96 + printf(" (%c)", sym->unicode);
1.97 else
1.98 - printf (" (0x%X)", sym->unicode);
1.99 + printf(" (0x%X)", sym->unicode);
1.100 #endif
1.101 }
1.102 }
1.103 - print_modifiers ();
1.104 - printf ("\n");
1.105 + print_modifiers();
1.106 + printf("\n");
1.107 }
1.108
1.109 int
1.110 -main (int argc, char *argv[])
1.111 +main(int argc, char *argv[])
1.112 {
1.113 SDL_Event event;
1.114 int done;
1.115 Uint32 videoflags;
1.116
1.117 /* Initialize SDL */
1.118 - if (SDL_Init (SDL_INIT_VIDEO) < 0) {
1.119 - fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ());
1.120 + if (SDL_Init(SDL_INIT_VIDEO) < 0) {
1.121 + fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
1.122 return (1);
1.123 }
1.124
1.125 videoflags = SDL_SWSURFACE;
1.126 while (argc > 1) {
1.127 --argc;
1.128 - if (argv[argc] && !strcmp (argv[argc], "-fullscreen")) {
1.129 + if (argv[argc] && !strcmp(argv[argc], "-fullscreen")) {
1.130 videoflags |= SDL_FULLSCREEN;
1.131 } else {
1.132 - fprintf (stderr, "Usage: %s [-fullscreen]\n", argv[0]);
1.133 - quit (1);
1.134 + fprintf(stderr, "Usage: %s [-fullscreen]\n", argv[0]);
1.135 + quit(1);
1.136 }
1.137 }
1.138
1.139 /* Set 640x480 video mode */
1.140 - if (SDL_SetVideoMode (640, 480, 0, videoflags) == NULL) {
1.141 - fprintf (stderr, "Couldn't set 640x480 video mode: %s\n",
1.142 - SDL_GetError ());
1.143 - quit (2);
1.144 + if (SDL_SetVideoMode(640, 480, 0, videoflags) == NULL) {
1.145 + fprintf(stderr, "Couldn't set 640x480 video mode: %s\n",
1.146 + SDL_GetError());
1.147 + quit(2);
1.148 }
1.149
1.150 /* Enable UNICODE translation for keyboard input */
1.151 - SDL_EnableUNICODE (1);
1.152 + SDL_EnableUNICODE(1);
1.153
1.154 /* Enable auto repeat for keyboard input */
1.155 - SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY,
1.156 - SDL_DEFAULT_REPEAT_INTERVAL);
1.157 + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
1.158 + SDL_DEFAULT_REPEAT_INTERVAL);
1.159
1.160 /* Watch keystrokes */
1.161 done = 0;
1.162 while (!done) {
1.163 /* Check for events */
1.164 - SDL_WaitEvent (&event);
1.165 + SDL_WaitEvent(&event);
1.166 switch (event.type) {
1.167 case SDL_KEYDOWN:
1.168 - PrintKey (&event.key.keysym, 1);
1.169 + PrintKey(&event.key.keysym, 1);
1.170 break;
1.171 case SDL_KEYUP:
1.172 - PrintKey (&event.key.keysym, 0);
1.173 + PrintKey(&event.key.keysym, 0);
1.174 break;
1.175 case SDL_MOUSEBUTTONDOWN:
1.176 /* Any button press quits the app... */
1.177 @@ -145,6 +145,6 @@
1.178 }
1.179 }
1.180
1.181 - SDL_Quit ();
1.182 + SDL_Quit();
1.183 return (0);
1.184 }