test/testime.c
changeset 6318 49b2cb56db6e
parent 6256 1d905b13b102
child 6785 c094c438c0a6
     1.1 --- a/test/testime.c	Thu May 31 09:06:47 2012 -0400
     1.2 +++ b/test/testime.c	Thu May 31 19:23:30 2012 +0300
     1.3 @@ -11,15 +11,6 @@
     1.4  */
     1.5  /* A simple program to test the Input Method support in the SDL library (2.0+) */
     1.6  
     1.7 -#if 1 /* FIXME: Rework this using the 2.0 API */
     1.8 -#include <stdio.h>
     1.9 -
    1.10 -int main(int argc, char *argv[])
    1.11 -{
    1.12 -    printf("FIXME\n");
    1.13 -    return 0;
    1.14 -}
    1.15 -#else
    1.16  #include <stdlib.h>
    1.17  #include <stdio.h>
    1.18  #include <string.h>
    1.19 @@ -29,20 +20,22 @@
    1.20  #include "SDL_ttf.h"
    1.21  #endif
    1.22  
    1.23 +#include "common.h"
    1.24 +
    1.25  #define DEFAULT_PTSIZE  30
    1.26  #define DEFAULT_FONT    "/System/Library/Fonts/华文细黑.ttf"
    1.27  #define MAX_TEXT_LENGTH 256
    1.28  
    1.29 -SDL_Surface *screen;
    1.30 -
    1.31 +static CommonState *state;
    1.32 +static SDL_Rect textRect, markedRect;
    1.33 +static SDL_Color lineColor = {0,0,0,0};
    1.34 +static SDL_Color backColor = {255,255,255,0};
    1.35 +static SDL_Color textColor = {0,0,0,0};
    1.36 +static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
    1.37 +static int cursor = 0;
    1.38  #ifdef HAVE_SDL_TTF
    1.39 -TTF_Font *font;
    1.40 +static TTF_Font *font;
    1.41  #endif
    1.42 -SDL_Rect textRect, markedRect;
    1.43 -Uint32 lineColor, backColor;
    1.44 -SDL_Color textColor = { 0, 0, 0 };
    1.45 -char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
    1.46 -int cursor = 0;
    1.47  
    1.48  size_t utf8_length(unsigned char c)
    1.49  {
    1.50 @@ -87,24 +80,150 @@
    1.51  
    1.52  void usage()
    1.53  {
    1.54 -    printf("usage: testime [--font fontfile] [--fullscreen]\n");
    1.55 +    printf("usage: testime [--font fontfile]\n");
    1.56      exit(0);
    1.57  }
    1.58  
    1.59 -void InitVideo(int argc, char *argv[])
    1.60 +void InitInput()
    1.61  {
    1.62 -    int width = 640, height = 480;
    1.63 -    int flags = SDL_HWSURFACE;
    1.64 +
    1.65 +    /* Prepare a rect for text input */
    1.66 +    textRect.x = textRect.y = 100;
    1.67 +    textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x;
    1.68 +    textRect.h = 50;
    1.69 +
    1.70 +    text[0] = 0;
    1.71 +    markedRect = textRect;
    1.72 +    markedText[0] = 0;
    1.73 +
    1.74 +    SDL_StartTextInput();
    1.75 +}
    1.76 +
    1.77 +void CleanupVideo()
    1.78 +{
    1.79 +    SDL_StopTextInput();
    1.80 +#ifdef HAVE_SDL_TTF
    1.81 +    TTF_CloseFont(font);
    1.82 +    TTF_Quit();
    1.83 +#endif
    1.84 +}
    1.85 +
    1.86 +
    1.87 +void _Redraw(SDL_Renderer * renderer) {
    1.88 +    int w = 0, h = textRect.h;
    1.89 +    SDL_Rect cursorRect, underlineRect;
    1.90 +
    1.91 +    SDL_SetRenderDrawColor(renderer, 255,255,255,255);
    1.92 +    SDL_RenderFillRect(renderer,&textRect);
    1.93 +
    1.94 +#ifdef HAVE_SDL_TTF
    1.95 +    if (*text)
    1.96 +    {
    1.97 +        SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor);
    1.98 +        SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h };
    1.99 +
   1.100 +        SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
   1.101 +        SDL_FreeSurface(textSur);
   1.102 +
   1.103 +        SDL_RenderCopy(renderer,texture,NULL,&dest);
   1.104 +        SDL_DestroyTexture(texture);
   1.105 +        TTF_SizeUTF8(font, text, &w, &h);
   1.106 +    }
   1.107 +#endif
   1.108 +
   1.109 +    markedRect.x = textRect.x + w;
   1.110 +    markedRect.w = textRect.w - w;
   1.111 +    if (markedRect.w < 0)
   1.112 +    {
   1.113 +        // Stop text input because we cannot hold any more characters
   1.114 +        SDL_StopTextInput();
   1.115 +        return;
   1.116 +    }
   1.117 +    else
   1.118 +    {
   1.119 +        SDL_StartTextInput();
   1.120 +    }
   1.121 +
   1.122 +    cursorRect = markedRect;
   1.123 +    cursorRect.w = 2;
   1.124 +    cursorRect.h = h;
   1.125 +
   1.126 +    SDL_SetRenderDrawColor(renderer, 255,255,255,255);
   1.127 +    SDL_RenderFillRect(renderer,&markedRect);
   1.128 +
   1.129 +    if (markedText[0])
   1.130 +    {
   1.131 +#ifdef HAVE_SDL_TTF
   1.132 +        if (cursor)
   1.133 +        {
   1.134 +            char *p = utf8_advance(markedText, cursor);
   1.135 +            char c = 0;
   1.136 +            if (!p)
   1.137 +                p = &markedText[strlen(markedText)];
   1.138 +
   1.139 +            c = *p;
   1.140 +            *p = 0;
   1.141 +            TTF_SizeUTF8(font, markedText, &w, 0);
   1.142 +            cursorRect.x += w;
   1.143 +            *p = c;
   1.144 +        }
   1.145 +        SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor);
   1.146 +        SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h };
   1.147 +        TTF_SizeUTF8(font, markedText, &w, &h);
   1.148 +        SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
   1.149 +        SDL_FreeSurface(textSur);
   1.150 +
   1.151 +        SDL_RenderCopy(renderer,texture,NULL,&dest);
   1.152 +        SDL_DestroyTexture(texture);
   1.153 +#endif
   1.154 +
   1.155 +        underlineRect = markedRect;
   1.156 +        underlineRect.y += (h - 2);
   1.157 +        underlineRect.h = 2;
   1.158 +        underlineRect.w = w;
   1.159 +
   1.160 +        SDL_SetRenderDrawColor(renderer, 0,0,0,0);
   1.161 +        SDL_RenderFillRect(renderer,&markedRect);
   1.162 +    }
   1.163 +
   1.164 +    SDL_SetRenderDrawColor(renderer, 0,0,0,0);
   1.165 +    SDL_RenderFillRect(renderer,&cursorRect);
   1.166 +
   1.167 +    SDL_SetTextInputRect(&markedRect);
   1.168 +}
   1.169 +
   1.170 +void Redraw() {
   1.171 +    int i;
   1.172 +    for (i = 0; i < state->num_windows; ++i) {
   1.173 +        SDL_Renderer *renderer = state->renderers[i];
   1.174 +        SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
   1.175 +        SDL_RenderClear(renderer);
   1.176 +
   1.177 +        _Redraw(renderer);
   1.178 +
   1.179 +        SDL_RenderPresent(renderer);
   1.180 +    }
   1.181 +}
   1.182 +
   1.183 +int main(int argc, char *argv[]) {
   1.184 +    int i, done;
   1.185 +    SDL_Event event;
   1.186      const char *fontname = DEFAULT_FONT;
   1.187 -    int fullscreen = 0;
   1.188  
   1.189 +    /* Initialize test framework */
   1.190 +    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   1.191 +    if (!state) {
   1.192 +        return 1;
   1.193 +    }
   1.194 +    for (i = 1; i < argc;i++) {
   1.195 +        CommonArg(state, i);
   1.196 +    }
   1.197      for (argc--, argv++; argc > 0; argc--, argv++)
   1.198      {
   1.199 -        if (strcmp(argv[0], "--help") == 0)
   1.200 +        if (strcmp(argv[0], "--help") == 0) {
   1.201              usage();
   1.202 -
   1.203 -        else if (strcmp(argv[0], "--fullscreen") == 0)
   1.204 -            fullscreen = 1;
   1.205 +            return 0;
   1.206 +        }
   1.207  
   1.208          else if (strcmp(argv[0], "--font") == 0)
   1.209          {
   1.210 @@ -113,17 +232,17 @@
   1.211  
   1.212              if (argc > 0)
   1.213                  fontname = argv[0];
   1.214 -            else
   1.215 +            else {
   1.216                  usage();
   1.217 +                return 0;
   1.218 +            }
   1.219          }
   1.220      }
   1.221 +    
   1.222 +    if (!CommonInit(state)) {
   1.223 +        return 2;
   1.224 +    }
   1.225  
   1.226 -    SDL_setenv("SDL_VIDEO_WINDOW_POS", "center", 1);
   1.227 -    if (SDL_Init(SDL_INIT_VIDEO) < 0)
   1.228 -    {
   1.229 -        fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
   1.230 -        exit(-1);
   1.231 -    }
   1.232  
   1.233  #ifdef HAVE_SDL_TTF
   1.234      /* Initialize fonts */
   1.235 @@ -140,258 +259,111 @@
   1.236      printf("Using font: %s\n", fontname);
   1.237      atexit(SDL_Quit);
   1.238  
   1.239 -    if (fullscreen)
   1.240 -    {
   1.241 -        /* Use the desktop mode */
   1.242 -        width = 0;
   1.243 -        height = 0;
   1.244 -        flags |= SDL_FULLSCREEN;
   1.245 +    InitInput();
   1.246 +    /* Create the windows and initialize the renderers */
   1.247 +    for (i = 0; i < state->num_windows; ++i) {
   1.248 +        SDL_Renderer *renderer = state->renderers[i];
   1.249 +        SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
   1.250 +        SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
   1.251 +        SDL_RenderClear(renderer);
   1.252      }
   1.253 +    Redraw();    
   1.254 +    /* Main render loop */
   1.255 +    done = 0;
   1.256 +    while (!done) {
   1.257 +        /* Check for events */
   1.258 +        while (SDL_PollEvent(&event)) {
   1.259 +            CommonEvent(state, &event, &done);
   1.260 +            switch(event.type) {
   1.261 +                case SDL_KEYDOWN: {
   1.262 +                    switch (event.key.keysym.sym)
   1.263 +                    {
   1.264 +                        case SDLK_RETURN:
   1.265 +                             text[0]=0x00;
   1.266 +                             Redraw();
   1.267 +                             break;
   1.268 +                        case SDLK_BACKSPACE:
   1.269 +                             {
   1.270 +                                 int textlen=SDL_strlen(text);
   1.271  
   1.272 -    /* Create window */
   1.273 -    screen = SDL_SetVideoMode(width, height, 32, flags);
   1.274 -    if (screen == NULL)
   1.275 -    {
   1.276 -        fprintf(stderr, "Unable to set %dx%d video: %s\n",
   1.277 -                width, height, SDL_GetError());
   1.278 -        exit(-1);
   1.279 +                                 do {
   1.280 +                                     if (textlen==0)
   1.281 +                                     {
   1.282 +                                         break;
   1.283 +                                     }
   1.284 +                                     if ((text[textlen-1] & 0x80) == 0x00)
   1.285 +                                     {
   1.286 +                                         /* One byte */
   1.287 +                                         text[textlen-1]=0x00;
   1.288 +                                         break;
   1.289 +                                     }
   1.290 +                                     if ((text[textlen-1] & 0xC0) == 0x80)
   1.291 +                                     {
   1.292 +                                         /* Byte from the multibyte sequence */
   1.293 +                                         text[textlen-1]=0x00;
   1.294 +                                         textlen--;
   1.295 +                                     }
   1.296 +                                     if ((text[textlen-1] & 0xC0) == 0xC0)
   1.297 +                                     {
   1.298 +                                         /* First byte of multibyte sequence */
   1.299 +                                         text[textlen-1]=0x00;
   1.300 +                                         break;
   1.301 +                                     }
   1.302 +                                 } while(1);
   1.303 +
   1.304 +                                 Redraw();
   1.305 +                             }
   1.306 +                             break;
   1.307 +                    }
   1.308 +
   1.309 +                    if (done)
   1.310 +                    {
   1.311 +                        break;
   1.312 +                    }
   1.313 +
   1.314 +                    fprintf(stderr,
   1.315 +                            "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
   1.316 +                            event.key.keysym.scancode,
   1.317 +                            SDL_GetScancodeName(event.key.keysym.scancode),
   1.318 +                            event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
   1.319 +                    break;
   1.320 +
   1.321 +                case SDL_TEXTINPUT:
   1.322 +                    if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
   1.323 +                        markedRect.w < 0)
   1.324 +                        break;
   1.325 +
   1.326 +                    fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text);
   1.327 +
   1.328 +                    if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
   1.329 +                        SDL_strlcat(text, event.text.text, sizeof(text));
   1.330 +
   1.331 +                    fprintf(stderr, "text inputed: %s\n", text);
   1.332 +
   1.333 +                    // After text inputed, we can clear up markedText because it
   1.334 +                    // is committed
   1.335 +                    markedText[0] = 0;
   1.336 +                    Redraw();
   1.337 +                    break;
   1.338 +
   1.339 +                case SDL_TEXTEDITING:
   1.340 +                    fprintf(stderr, "text editing \"%s\", selected range (%d, %d)\n",
   1.341 +                            event.edit.text, event.edit.start, event.edit.length);
   1.342 +
   1.343 +                    strcpy(markedText, event.edit.text);
   1.344 +                    cursor = event.edit.start;
   1.345 +                    Redraw();
   1.346 +                    break;
   1.347 +                }
   1.348 +                break;
   1.349 +                    
   1.350 +            }
   1.351 +        }
   1.352      }
   1.353 +    CleanupVideo();
   1.354 +    CommonQuit(state);
   1.355 +    return 0;
   1.356  }
   1.357  
   1.358 -void CleanupVideo()
   1.359 -{
   1.360 -    SDL_StopTextInput();
   1.361 -#ifdef HAVE_SDL_TTF
   1.362 -    TTF_CloseFont(font);
   1.363 -    TTF_Quit();
   1.364 -#endif
   1.365 -}
   1.366 -
   1.367 -void InitInput()
   1.368 -{
   1.369 -    backColor = SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF);
   1.370 -    lineColor = SDL_MapRGB(screen->format, 0x0, 0x0, 0x0);
   1.371 -
   1.372 -    /* Prepare a rect for text input */
   1.373 -    textRect.x = textRect.y = 100;
   1.374 -    textRect.w = screen->w - 2 * textRect.x;
   1.375 -    textRect.h = 50;
   1.376 -
   1.377 -    text[0] = 0;
   1.378 -    markedRect = textRect;
   1.379 -    markedText[0] = 0;
   1.380 -
   1.381 -    SDL_StartTextInput();
   1.382 -}
   1.383 -
   1.384 -#ifdef HAVE_SDL_TTF
   1.385 -static void RenderText(SDL_Surface *sur,
   1.386 -                        TTF_Font *font,
   1.387 -                        const char *text,
   1.388 -                        int x, int y,
   1.389 -                        SDL_Color color)
   1.390 -{
   1.391 -    if (text && *text) {
   1.392 -        SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, color);
   1.393 -        SDL_Rect dest = { x, y, textSur->w, textSur->h };
   1.394 -
   1.395 -        SDL_BlitSurface(textSur, NULL, sur, &dest);
   1.396 -        SDL_FreeSurface(textSur);
   1.397 -    }
   1.398 -}
   1.399 -#endif
   1.400 -
   1.401 -void Redraw()
   1.402 -{
   1.403 -    int w = 0, h = textRect.h;
   1.404 -    SDL_Rect cursorRect, underlineRect;
   1.405 -
   1.406 -    SDL_FillRect(screen, &textRect, backColor);
   1.407 -
   1.408 -#ifdef HAVE_SDL_TTF
   1.409 -    if (*text)
   1.410 -    {
   1.411 -        RenderText(screen, font, text, textRect.x, textRect.y, textColor);
   1.412 -        TTF_SizeUTF8(font, text, &w, &h);
   1.413 -    }
   1.414 -#endif
   1.415 -
   1.416 -    markedRect.x = textRect.x + w;
   1.417 -    markedRect.w = textRect.w - w;
   1.418 -    if (markedRect.w < 0)
   1.419 -    {
   1.420 -        SDL_Flip(screen);
   1.421 -        // Stop text input because we cannot hold any more characters
   1.422 -        SDL_StopTextInput();
   1.423 -        return;
   1.424 -    }
   1.425 -    else
   1.426 -    {
   1.427 -        SDL_StartTextInput();
   1.428 -    }
   1.429 -
   1.430 -    cursorRect = markedRect;
   1.431 -    cursorRect.w = 2;
   1.432 -    cursorRect.h = h;
   1.433 -
   1.434 -    SDL_FillRect(screen, &markedRect, backColor);
   1.435 -    if (markedText[0])
   1.436 -    {
   1.437 -#ifdef HAVE_SDL_TTF
   1.438 -        if (cursor)
   1.439 -        {
   1.440 -            char *p = utf8_advance(markedText, cursor);
   1.441 -            char c = 0;
   1.442 -            if (!p)
   1.443 -                p = &markedText[strlen(markedText)];
   1.444 -
   1.445 -            c = *p;
   1.446 -            *p = 0;
   1.447 -            TTF_SizeUTF8(font, markedText, &w, 0);
   1.448 -            cursorRect.x += w;
   1.449 -            *p = c;
   1.450 -        }
   1.451 -        RenderText(screen, font, markedText, markedRect.x, markedRect.y, textColor);
   1.452 -        TTF_SizeUTF8(font, markedText, &w, &h);
   1.453 -#endif
   1.454 -
   1.455 -        underlineRect = markedRect;
   1.456 -        underlineRect.y += (h - 2);
   1.457 -        underlineRect.h = 2;
   1.458 -        underlineRect.w = w;
   1.459 -
   1.460 -        SDL_FillRect(screen, &underlineRect, lineColor);
   1.461 -    }
   1.462 -
   1.463 -    SDL_FillRect(screen, &cursorRect, lineColor);
   1.464 -
   1.465 -    SDL_Flip(screen);
   1.466 -
   1.467 -    SDL_SetTextInputRect(&markedRect);
   1.468 -}
   1.469 -
   1.470 -void
   1.471 -HotKey_ToggleFullScreen(void)
   1.472 -{
   1.473 -    SDL_Surface *screen;
   1.474 -
   1.475 -    screen = SDL_GetVideoSurface();
   1.476 -    if (SDL_WM_ToggleFullScreen(screen)) {
   1.477 -        printf("Toggled fullscreen mode - now %s\n",
   1.478 -               (screen->flags & SDL_FULLSCREEN) ? "fullscreen" : "windowed");
   1.479 -    } else {
   1.480 -        printf("Unable to toggle fullscreen mode\n");
   1.481 -    }
   1.482 -}
   1.483 -
   1.484 -int main(int argc, char *argv[])
   1.485 -{
   1.486 -    SDL_Event event;
   1.487 -    int done = 0;
   1.488 -
   1.489 -    InitVideo(argc, argv);
   1.490 -    InitInput();
   1.491 -    Redraw();
   1.492 -
   1.493 -    while (! done && SDL_WaitEvent(&event))
   1.494 -    {
   1.495 -        switch (event.type)
   1.496 -        {
   1.497 -        case SDL_KEYDOWN:
   1.498 -            switch (event.key.keysym.sym)
   1.499 -            {
   1.500 -                case SDLK_ESCAPE:
   1.501 -                     done = 1;
   1.502 -                     break;
   1.503 -                case SDLK_RETURN:
   1.504 -                     text[0]=0x00;
   1.505 -                     Redraw();
   1.506 -                     break;
   1.507 -                case SDLK_BACKSPACE:
   1.508 -                     {
   1.509 -                         int textlen=SDL_strlen(text);
   1.510 -
   1.511 -                         do {
   1.512 -                             if (textlen==0)
   1.513 -                             {
   1.514 -                                 break;
   1.515 -                             }
   1.516 -                             if ((text[textlen-1] & 0x80) == 0x00)
   1.517 -                             {
   1.518 -                                 /* One byte */
   1.519 -                                 text[textlen-1]=0x00;
   1.520 -                                 break;
   1.521 -                             }
   1.522 -                             if ((text[textlen-1] & 0xC0) == 0x80)
   1.523 -                             {
   1.524 -                                 /* Byte from the multibyte sequence */
   1.525 -                                 text[textlen-1]=0x00;
   1.526 -                                 textlen--;
   1.527 -                             }
   1.528 -                             if ((text[textlen-1] & 0xC0) == 0xC0)
   1.529 -                             {
   1.530 -                                 /* First byte of multibyte sequence */
   1.531 -                                 text[textlen-1]=0x00;
   1.532 -                                 break;
   1.533 -                             }
   1.534 -                         } while(1);
   1.535 -
   1.536 -                         Redraw();
   1.537 -                     }
   1.538 -                     break;
   1.539 -            }
   1.540 -
   1.541 -            if (done)
   1.542 -            {
   1.543 -                break;
   1.544 -            }
   1.545 -
   1.546 -            fprintf(stderr,
   1.547 -                    "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
   1.548 -                    event.key.keysym.scancode,
   1.549 -                    SDL_GetScancodeName(event.key.keysym.scancode),
   1.550 -                    event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
   1.551 -            break;
   1.552 -
   1.553 -        case SDL_TEXTINPUT:
   1.554 -            if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
   1.555 -                markedRect.w < 0)
   1.556 -                break;
   1.557 -
   1.558 -            fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text);
   1.559 -
   1.560 -            if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
   1.561 -                SDL_strlcat(text, event.text.text, sizeof(text));
   1.562 -
   1.563 -            fprintf(stderr, "text inputed: %s\n", text);
   1.564 -
   1.565 -            // After text inputed, we can clear up markedText because it
   1.566 -            // is committed
   1.567 -            markedText[0] = 0;
   1.568 -            Redraw();
   1.569 -            break;
   1.570 -
   1.571 -        case SDL_TEXTEDITING:
   1.572 -            fprintf(stderr, "text editing \"%s\", selected range (%d, %d)\n",
   1.573 -                    event.edit.text, event.edit.start, event.edit.length);
   1.574 -
   1.575 -            strcpy(markedText, event.edit.text);
   1.576 -            cursor = event.edit.start;
   1.577 -            Redraw();
   1.578 -            break;
   1.579 -
   1.580 -        case SDL_QUIT:
   1.581 -            done = 1;
   1.582 -            break;
   1.583 -
   1.584 -        default:
   1.585 -            break;
   1.586 -        }
   1.587 -    }
   1.588 -
   1.589 -    CleanupVideo();
   1.590 -    return 0;
   1.591 -}
   1.592 -#endif
   1.593  
   1.594  /* vi: set ts=4 sw=4 expandtab: */