# HG changeset patch # User Sam Lantinga # Date 1151168489 0 # Node ID 57ce47f033a5becd5a6291683a2adff6627db204 # Parent 1577404809f0dc62aac8ddf630a6c6d0cdb2e652 Passing NULL to SDL_SetDisplayMode() will set the desktop mode. diff -r 1577404809f0 -r 57ce47f033a5 include/SDL_video.h --- a/include/SDL_video.h Sat Jun 24 16:51:01 2006 +0000 +++ b/include/SDL_video.h Sat Jun 24 17:01:29 2006 +0000 @@ -458,7 +458,7 @@ * * \brief Set up the closest available mode on the current display. * - * \param mode The desired display mode + * \param mode The desired display mode, or NULL to set the desktop mode. * * \return 0 on success, or -1 if setting the display mode failed. */ diff -r 1577404809f0 -r 57ce47f033a5 src/video/SDL_video.c --- a/src/video/SDL_video.c Sat Jun 24 16:51:01 2006 +0000 +++ b/src/video/SDL_video.c Sat Jun 24 17:01:29 2006 +0000 @@ -534,10 +534,8 @@ return -1; } - /* Make sure there's an actual display mode to set */ if (!mode) { - SDL_SetError("No mode passed to SDL_SetDisplayMode"); - return -1; + mode = SDL_GetDesktopDisplayMode(); } display = &SDL_CurrentDisplay; display_mode = *mode; diff -r 1577404809f0 -r 57ce47f033a5 test/testsprite2.c --- a/test/testsprite2.c Sat Jun 24 16:51:01 2006 +0000 +++ b/test/testsprite2.c Sat Jun 24 17:01:29 2006 +0000 @@ -155,22 +155,10 @@ } } - /* Initialize the video mode, if necessary */ - current_mode = SDL_GetCurrentDisplayMode(); - if (!current_mode->w || !current_mode->h) { - SDL_DisplayMode mode; - - /* Let the driver pick something it likes, we don't care */ - mode.format = 0; - mode.w = 0; - mode.h = 0; - mode.refresh_rate = 0; - - if (SDL_SetDisplayMode(&mode) < 0) { - fprintf(stderr, "Couldn't set display mode: %s\n", - SDL_GetError()); - quit(2); - } + /* Set the desktop mode, we don't care what it is */ + if (SDL_SetDisplayMode(NULL) < 0) { + fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError()); + quit(2); } /* Create the windows, initialize the renderers, and load the textures */