test/testmessage.c
changeset 7458 648067e9073a
parent 7456 193c9a1723ad
child 7478 0d02f6a323f5
     1.1 --- a/test/testmessage.c	Sun Jul 14 11:58:57 2013 -0700
     1.2 +++ b/test/testmessage.c	Sun Jul 14 12:16:10 2013 -0700
     1.3 @@ -60,7 +60,7 @@
     1.4          data.message = "This is a custom messagebox from a background thread.";
     1.5      }
     1.6  
     1.7 -    success =SDL_ShowMessageBox(&data, &button);
     1.8 +    success = SDL_ShowMessageBox(&data, &button);
     1.9      if (success == -1) {
    1.10          printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.11          if (eventNumber) {
    1.12 @@ -88,13 +88,6 @@
    1.13  {
    1.14      int success;
    1.15  
    1.16 -    /* Load the SDL library */
    1.17 -    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.18 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.19 -        return (1);
    1.20 -    }
    1.21 -
    1.22 -#if 0
    1.23      success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
    1.24                  "Simple MessageBox",
    1.25                  "This is a simple error MessageBox",
    1.26 @@ -135,7 +128,16 @@
    1.27  
    1.28      button_messagebox(NULL);
    1.29  
    1.30 -    /* Test showing a message box from a background thread */
    1.31 +    /* Test showing a message box from a background thread.
    1.32 +
    1.33 +       On Mac OS X, the video subsystem needs to be initialized for this
    1.34 +       to work, since the message box events are dispatched by the Cocoa
    1.35 +       subsystem on the main thread.
    1.36 +     */
    1.37 +    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.38 +        fprintf(stderr, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
    1.39 +        return (1);
    1.40 +    }
    1.41      {
    1.42          int status = 0;
    1.43          SDL_Event event;
    1.44 @@ -153,7 +155,6 @@
    1.45  
    1.46          printf("Message box thread return %i\n", status);
    1.47      }
    1.48 -#endif
    1.49  
    1.50      /* Test showing a message box with a parent window */
    1.51      {