Be explicit about what display you're querying. The default display is 0.
authorSam Lantinga <slouken@libsdl.org>
Thu, 10 Feb 2011 12:14:37 -0800
changeset 5244762e40fb8e28
parent 5243 3a8a452b49f0
child 5245 329d435f97f4
Be explicit about what display you're querying. The default display is 0.
include/SDL_video.h
src/SDL_compat.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/x11/SDL_x11opengl.c
test/common.c
test/testgl2.c
test/testime.c
test/testvidinfo.c
     1.1 --- a/include/SDL_video.h	Thu Feb 10 11:39:08 2011 -0800
     1.2 +++ b/include/SDL_video.h	Thu Feb 10 12:14:37 2011 -0800
     1.3 @@ -236,7 +236,6 @@
     1.4   *  \brief Returns the number of available video displays.
     1.5   *  
     1.6   *  \sa SDL_GetDisplayBounds()
     1.7 - *  \sa SDL_SelectVideoDisplay()
     1.8   */
     1.9  extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
    1.10  
    1.11 @@ -248,34 +247,14 @@
    1.12   *  
    1.13   *  \sa SDL_GetNumVideoDisplays()
    1.14   */
    1.15 -extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int index, SDL_Rect * rect);
    1.16 +extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
    1.17  
    1.18  /**
    1.19 - *  \brief Set the index of the currently selected display.
    1.20 - *  
    1.21 - *  \return 0 on success, or -1 if the index is out of range.
    1.22 - *  
    1.23 - *  \sa SDL_GetNumVideoDisplays()
    1.24 - *  \sa SDL_GetCurrentVideoDisplay()
    1.25 - */
    1.26 -extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
    1.27 -
    1.28 -/**
    1.29 - *  \brief Get the index of the currently selected display.
    1.30 - *  
    1.31 - *  \return The index of the currently selected display.
    1.32 - *  
    1.33 - *  \sa SDL_GetNumVideoDisplays()
    1.34 - *  \sa SDL_SelectVideoDisplay()
    1.35 - */
    1.36 -extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
    1.37 -
    1.38 -/**
    1.39 - *  \brief Returns the number of available display modes for the current display.
    1.40 + *  \brief Returns the number of available display modes.
    1.41   *  
    1.42   *  \sa SDL_GetDisplayMode()
    1.43   */
    1.44 -extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
    1.45 +extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
    1.46  
    1.47  /**
    1.48   *  \brief Fill in information about a specific display mode.
    1.49 @@ -288,19 +267,18 @@
    1.50   *  
    1.51   *  \sa SDL_GetNumDisplayModes()
    1.52   */
    1.53 -extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
    1.54 +extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
    1.55                                                 SDL_DisplayMode * mode);
    1.56  
    1.57  /**
    1.58 - *  \brief Fill in information about the desktop display mode for the current 
    1.59 - *         display.
    1.60 + *  \brief Fill in information about the desktop display mode.
    1.61   */
    1.62 -extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
    1.63 +extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
    1.64  
    1.65  /**
    1.66   *  \brief Fill in information about the current display mode.
    1.67   */
    1.68 -extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
    1.69 +extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
    1.70  
    1.71  
    1.72  /**
    1.73 @@ -323,16 +301,13 @@
    1.74   *  \sa SDL_GetNumDisplayModes()
    1.75   *  \sa SDL_GetDisplayMode()
    1.76   */
    1.77 -extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
    1.78 -                                                                   SDL_DisplayMode
    1.79 -                                                                   * mode,
    1.80 -                                                                   SDL_DisplayMode
    1.81 -                                                                   * closest);
    1.82 +extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
    1.83  
    1.84  /**
    1.85 - *  \brief Set the display mode used when a fullscreen window is visible
    1.86 - *         on the currently selected display.  By default the window's
    1.87 - *         dimensions and the desktop format and refresh rate are used.
    1.88 + *  \brief Set the display mode used when a fullscreen window is visible.
    1.89 + *
    1.90 + *  By default the window's dimensions and the desktop format and refresh rate
    1.91 + *  are used.
    1.92   *  
    1.93   *  \param mode The mode to use, or NULL for the default mode.
    1.94   *  
    1.95 @@ -347,7 +322,7 @@
    1.96  
    1.97  /**
    1.98   *  \brief Fill in information about the display mode used when a fullscreen
    1.99 - *         window is visible on the currently selected display.
   1.100 + *         window is visible.
   1.101   *
   1.102   *  \sa SDL_SetWindowDisplayMode()
   1.103   *  \sa SDL_SetWindowFullscreen()
     2.1 --- a/src/SDL_compat.c	Thu Feb 10 11:39:08 2011 -0800
     2.2 +++ b/src/SDL_compat.c	Thu Feb 10 12:14:37 2011 -0800
     2.3 @@ -71,15 +71,17 @@
     2.4      return NULL;
     2.5  }
     2.6  
     2.7 -static void
     2.8 -SelectVideoDisplay()
     2.9 +static int
    2.10 +GetVideoDisplay()
    2.11  {
    2.12      const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
    2.13      if ( !variable ) {
    2.14          variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
    2.15      }
    2.16      if ( variable ) {
    2.17 -        SDL_SelectVideoDisplay(SDL_atoi(variable));
    2.18 +        SDL_atoi(variable);
    2.19 +    } else {
    2.20 +        return 0;
    2.21      }
    2.22  }
    2.23  
    2.24 @@ -89,10 +91,8 @@
    2.25      static SDL_VideoInfo info;
    2.26      SDL_DisplayMode mode;
    2.27  
    2.28 -    SelectVideoDisplay();
    2.29 -
    2.30      /* Memory leak, compatibility code, who cares? */
    2.31 -    if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
    2.32 +    if (!info.vfmt && SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode) == 0) {
    2.33          int bpp;
    2.34          Uint32 Rmask, Gmask, Bmask, Amask;
    2.35  
    2.36 @@ -114,17 +114,15 @@
    2.37          return 0;
    2.38      }
    2.39  
    2.40 -    SelectVideoDisplay();
    2.41 -
    2.42      if (!(flags & SDL_FULLSCREEN)) {
    2.43          SDL_DisplayMode mode;
    2.44 -        SDL_GetDesktopDisplayMode(&mode);
    2.45 +        SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode);
    2.46          return SDL_BITSPERPIXEL(mode.format);
    2.47      }
    2.48  
    2.49 -    for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
    2.50 +    for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) {
    2.51          SDL_DisplayMode mode;
    2.52 -        SDL_GetDisplayMode(i, &mode);
    2.53 +        SDL_GetDisplayMode(GetVideoDisplay(), i, &mode);
    2.54          if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) {
    2.55              if (!mode.format) {
    2.56                  return bpp;
    2.57 @@ -147,8 +145,6 @@
    2.58          return NULL;
    2.59      }
    2.60  
    2.61 -    SelectVideoDisplay();
    2.62 -
    2.63      if (!(flags & SDL_FULLSCREEN)) {
    2.64          return (SDL_Rect **) (-1);
    2.65      }
    2.66 @@ -160,11 +156,11 @@
    2.67      /* Memory leak, but this is a compatibility function, who cares? */
    2.68      nmodes = 0;
    2.69      modes = NULL;
    2.70 -    for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
    2.71 +    for (i = 0; i < SDL_GetNumDisplayModes(GetVideoDisplay()); ++i) {
    2.72          SDL_DisplayMode mode;
    2.73          int bpp;
    2.74  
    2.75 -        SDL_GetDisplayMode(i, &mode);
    2.76 +        SDL_GetDisplayMode(GetVideoDisplay(), i, &mode);
    2.77          if (!mode.w || !mode.h) {
    2.78              return (SDL_Rect **) (-1);
    2.79          }
    2.80 @@ -342,7 +338,7 @@
    2.81      }
    2.82      if (center) {
    2.83          SDL_DisplayMode mode;
    2.84 -        SDL_GetDesktopDisplayMode(&mode);
    2.85 +        SDL_GetDesktopDisplayMode(GetVideoDisplay(), &mode);
    2.86          *x = (mode.w - w) / 2;
    2.87          *y = (mode.h - h) / 2;
    2.88      }
    2.89 @@ -453,9 +449,7 @@
    2.90          }
    2.91      }
    2.92  
    2.93 -    SelectVideoDisplay();
    2.94 -
    2.95 -    SDL_GetDesktopDisplayMode(&desktop_mode);
    2.96 +    SDL_GetDesktopDisplayMode(GetVideoDisplay(), &desktop_mode);
    2.97  
    2.98      if (width == 0) {
    2.99          width = desktop_mode.w;
     3.1 --- a/src/video/SDL_sysvideo.h	Thu Feb 10 11:39:08 2011 -0800
     3.2 +++ b/src/video/SDL_sysvideo.h	Thu Feb 10 12:14:37 2011 -0800
     3.3 @@ -322,18 +322,10 @@
     3.4  extern VideoBootStrap DUMMY_bootstrap;
     3.5  #endif
     3.6  
     3.7 -#define SDL_CurrentDisplay	(&_this->displays[_this->current_display])
     3.8 -
     3.9  extern SDL_VideoDevice *SDL_GetVideoDevice(void);
    3.10  extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
    3.11  extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
    3.12  extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
    3.13 -extern int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display);
    3.14 -extern int SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode);
    3.15 -extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
    3.16 -extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
    3.17 -extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
    3.18 -extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
    3.19  
    3.20  extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
    3.21  
     4.1 --- a/src/video/SDL_video.c	Thu Feb 10 11:39:08 2011 -0800
     4.2 +++ b/src/video/SDL_video.c	Thu Feb 10 12:14:37 2011 -0800
     4.3 @@ -96,6 +96,17 @@
     4.4          return retval; \
     4.5      }
     4.6  
     4.7 +#define CHECK_DISPLAY_INDEX(displayIndex, retval) \
     4.8 +    if (!_this) { \
     4.9 +        SDL_UninitializedVideo(); \
    4.10 +        return retval; \
    4.11 +    } \
    4.12 +    if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
    4.13 +        SDL_SetError("displayIndex must be in the range 0 - %d", \
    4.14 +                     _this->num_displays - 1); \
    4.15 +        return retval; \
    4.16 +    }
    4.17 +
    4.18  /* Various local functions */
    4.19  static void SDL_UpdateWindowGrab(SDL_Window * window);
    4.20  
    4.21 @@ -581,19 +592,12 @@
    4.22  }
    4.23  
    4.24  int
    4.25 -SDL_GetDisplayBounds(int index, SDL_Rect * rect)
    4.26 +SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
    4.27  {
    4.28 -    if (!_this) {
    4.29 -        SDL_UninitializedVideo();
    4.30 -        return -1;
    4.31 -    }
    4.32 -    if (index < 0 || index >= _this->num_displays) {
    4.33 -        SDL_SetError("index must be in the range 0 - %d",
    4.34 -                     _this->num_displays - 1);
    4.35 -        return -1;
    4.36 -    }
    4.37 +    CHECK_DISPLAY_INDEX(displayIndex, -1);
    4.38 +
    4.39      if (rect) {
    4.40 -        SDL_VideoDisplay *display = &_this->displays[index];
    4.41 +        SDL_VideoDisplay *display = &_this->displays[displayIndex];
    4.42  
    4.43          if (_this->GetDisplayBounds) {
    4.44              if (_this->GetDisplayBounds(_this, display, rect) < 0) {
    4.45 @@ -601,11 +605,11 @@
    4.46              }
    4.47          } else {
    4.48              /* Assume that the displays are left to right */
    4.49 -            if (index == 0) {
    4.50 +            if (displayIndex == 0) {
    4.51                  rect->x = 0;
    4.52                  rect->y = 0;
    4.53              } else {
    4.54 -                SDL_GetDisplayBounds(index-1, rect);
    4.55 +                SDL_GetDisplayBounds(displayIndex-1, rect);
    4.56                  rect->x += rect->w;
    4.57              }
    4.58              rect->w = display->desktop_mode.w;
    4.59 @@ -615,32 +619,6 @@
    4.60      return 0;
    4.61  }
    4.62  
    4.63 -int
    4.64 -SDL_SelectVideoDisplay(int index)
    4.65 -{
    4.66 -    if (!_this) {
    4.67 -        SDL_UninitializedVideo();
    4.68 -        return (-1);
    4.69 -    }
    4.70 -    if (index < 0 || index >= _this->num_displays) {
    4.71 -        SDL_SetError("index must be in the range 0 - %d",
    4.72 -                     _this->num_displays - 1);
    4.73 -        return -1;
    4.74 -    }
    4.75 -    _this->current_display = index;
    4.76 -    return 0;
    4.77 -}
    4.78 -
    4.79 -int
    4.80 -SDL_GetCurrentVideoDisplay(void)
    4.81 -{
    4.82 -    if (!_this) {
    4.83 -        SDL_UninitializedVideo();
    4.84 -        return (-1);
    4.85 -    }
    4.86 -    return _this->current_display;
    4.87 -}
    4.88 -
    4.89  SDL_bool
    4.90  SDL_AddDisplayMode(SDL_VideoDisplay * display,  const SDL_DisplayMode * mode)
    4.91  {
    4.92 @@ -677,7 +655,7 @@
    4.93      return SDL_TRUE;
    4.94  }
    4.95  
    4.96 -int
    4.97 +static int
    4.98  SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display)
    4.99  {
   4.100      if (!display->num_display_modes && _this->GetDisplayModes) {
   4.101 @@ -689,17 +667,21 @@
   4.102  }
   4.103  
   4.104  int
   4.105 -SDL_GetNumDisplayModes()
   4.106 +SDL_GetNumDisplayModes(int displayIndex)
   4.107  {
   4.108 -    if (_this) {
   4.109 -        return SDL_GetNumDisplayModesForDisplay(SDL_CurrentDisplay);
   4.110 -    }
   4.111 -    return 0;
   4.112 +    CHECK_DISPLAY_INDEX(displayIndex, -1);
   4.113 +
   4.114 +    return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
   4.115  }
   4.116  
   4.117  int
   4.118 -SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode)
   4.119 +SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode)
   4.120  {
   4.121 +    SDL_VideoDisplay *display;
   4.122 +
   4.123 +    CHECK_DISPLAY_INDEX(displayIndex, -1);
   4.124 +
   4.125 +    display = &_this->displays[displayIndex];
   4.126      if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
   4.127          SDL_SetError("index must be in the range of 0 - %d",
   4.128                       SDL_GetNumDisplayModesForDisplay(display) - 1);
   4.129 @@ -712,14 +694,13 @@
   4.130  }
   4.131  
   4.132  int
   4.133 -SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
   4.134 +SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode)
   4.135  {
   4.136 -    return SDL_GetDisplayModeForDisplay(SDL_CurrentDisplay, index, mode);
   4.137 -}
   4.138 +    SDL_VideoDisplay *display;
   4.139  
   4.140 -int
   4.141 -SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode)
   4.142 -{
   4.143 +    CHECK_DISPLAY_INDEX(displayIndex, -1);
   4.144 +
   4.145 +    display = &_this->displays[displayIndex];
   4.146      if (mode) {
   4.147          *mode = display->desktop_mode;
   4.148      }
   4.149 @@ -727,35 +708,20 @@
   4.150  }
   4.151  
   4.152  int
   4.153 -SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
   4.154 +SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode)
   4.155  {
   4.156 -    if (!_this) {
   4.157 -        SDL_UninitializedVideo();
   4.158 -        return -1;
   4.159 -    }
   4.160 -    return SDL_GetDesktopDisplayModeForDisplay(SDL_CurrentDisplay, mode);
   4.161 -}
   4.162 +    SDL_VideoDisplay *display;
   4.163  
   4.164 -int
   4.165 -SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode)
   4.166 -{
   4.167 +    CHECK_DISPLAY_INDEX(displayIndex, -1);
   4.168 +
   4.169 +    display = &_this->displays[displayIndex];
   4.170      if (mode) {
   4.171          *mode = display->current_mode;
   4.172      }
   4.173      return 0;
   4.174  }
   4.175  
   4.176 -int
   4.177 -SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
   4.178 -{
   4.179 -    if (!_this) {
   4.180 -        SDL_UninitializedVideo();
   4.181 -        return -1;
   4.182 -    }
   4.183 -    return SDL_GetCurrentDisplayModeForDisplay(SDL_CurrentDisplay, mode);
   4.184 -}
   4.185 -
   4.186 -SDL_DisplayMode *
   4.187 +static SDL_DisplayMode *
   4.188  SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
   4.189                                      const SDL_DisplayMode * mode,
   4.190                                      SDL_DisplayMode * closest)
   4.191 @@ -863,14 +829,16 @@
   4.192  }
   4.193  
   4.194  SDL_DisplayMode *
   4.195 -SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
   4.196 +SDL_GetClosestDisplayMode(int displayIndex,
   4.197 +                          const SDL_DisplayMode * mode,
   4.198                            SDL_DisplayMode * closest)
   4.199  {
   4.200 -    if (!_this) {
   4.201 -        SDL_UninitializedVideo();
   4.202 -        return NULL;
   4.203 -    }
   4.204 -    return SDL_GetClosestDisplayModeForDisplay(SDL_CurrentDisplay, mode, closest);
   4.205 +    SDL_VideoDisplay *display;
   4.206 +
   4.207 +    CHECK_DISPLAY_INDEX(displayIndex, NULL);
   4.208 +
   4.209 +    display = &_this->displays[displayIndex];
   4.210 +    return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
   4.211  }
   4.212  
   4.213  int
   4.214 @@ -907,7 +875,7 @@
   4.215      }
   4.216  
   4.217      /* See if there's anything left to do */
   4.218 -    SDL_GetCurrentDisplayModeForDisplay(display, &current_mode);
   4.219 +    current_mode = display->current_mode;
   4.220      if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
   4.221          return 0;
   4.222      }
   4.223 @@ -1054,7 +1022,7 @@
   4.224          }
   4.225          SDL_GL_LoadLibrary(NULL);
   4.226      }
   4.227 -    display = SDL_CurrentDisplay;
   4.228 +    display = &_this->displays[0]; /* FIXME */
   4.229      window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
   4.230      window->magic = &_this->window_magic;
   4.231      window->id = _this->next_object_id++;
   4.232 @@ -1102,7 +1070,7 @@
   4.233          SDL_UninitializedVideo();
   4.234          return NULL;
   4.235      }
   4.236 -    display = SDL_CurrentDisplay;
   4.237 +    display = &_this->displays[0]; /* FIXME */
   4.238      window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
   4.239      window->magic = &_this->window_magic;
   4.240      window->id = _this->next_object_id++;
   4.241 @@ -1676,7 +1644,7 @@
   4.242      if (!_this) {
   4.243          return NULL;
   4.244      }
   4.245 -    display = SDL_CurrentDisplay;
   4.246 +    display = &_this->displays[0]; /* FIXME */
   4.247      for (window = display->windows; window; window = window->next) {
   4.248          if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
   4.249              return window;
     5.1 --- a/src/video/x11/SDL_x11opengl.c	Thu Feb 10 11:39:08 2011 -0800
     5.2 +++ b/src/video/x11/SDL_x11opengl.c	Thu Feb 10 12:14:37 2011 -0800
     5.3 @@ -220,7 +220,7 @@
     5.4  X11_GL_InitExtensions(_THIS)
     5.5  {
     5.6      Display *display = ((SDL_VideoData *) _this->driverdata)->display;
     5.7 -    int screen = ((SDL_DisplayData *) SDL_CurrentDisplay->driverdata)->screen;
     5.8 +    int screen = DefaultScreen(display);
     5.9      XVisualInfo *vinfo;
    5.10      XSetWindowAttributes xattr;
    5.11      Window w;
     6.1 --- a/test/common.c	Thu Feb 10 11:39:08 2011 -0800
     6.2 +++ b/test/common.c	Thu Feb 10 12:14:37 2011 -0800
     6.3 @@ -594,9 +594,8 @@
     6.4              fprintf(stderr, "Number of displays: %d\n", n);
     6.5              for (i = 0; i < n; ++i) {
     6.6                  fprintf(stderr, "Display %d:\n", i);
     6.7 -                SDL_SelectVideoDisplay(i);
     6.8  
     6.9 -                SDL_GetDesktopDisplayMode(&mode);
    6.10 +                SDL_GetDesktopDisplayMode(i, &mode);
    6.11                  SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
    6.12                                             &Bmask, &Amask);
    6.13                  fprintf(stderr,
    6.14 @@ -612,13 +611,13 @@
    6.15                  }
    6.16  
    6.17                  /* Print available fullscreen video modes */
    6.18 -                m = SDL_GetNumDisplayModes();
    6.19 +                m = SDL_GetNumDisplayModes(i);
    6.20                  if (m == 0) {
    6.21                      fprintf(stderr, "No available fullscreen video modes\n");
    6.22                  } else {
    6.23                      fprintf(stderr, "  Fullscreen video modes:\n");
    6.24                      for (j = 0; j < m; ++j) {
    6.25 -                        SDL_GetDisplayMode(j, &mode);
    6.26 +                        SDL_GetDisplayMode(i, j, &mode);
    6.27                          SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
    6.28                                                     &Gmask, &Bmask, &Amask);
    6.29                          fprintf(stderr,
    6.30 @@ -642,7 +641,6 @@
    6.31              }
    6.32          }
    6.33  
    6.34 -        SDL_SelectVideoDisplay(state->display);
    6.35          if (state->verbose & VERBOSE_RENDER) {
    6.36              SDL_RendererInfo info;
    6.37  
     7.1 --- a/test/testgl2.c	Thu Feb 10 11:39:08 2011 -0800
     7.2 +++ b/test/testgl2.c	Thu Feb 10 12:14:37 2011 -0800
     7.3 @@ -234,7 +234,7 @@
     7.4          SDL_GL_SetSwapInterval(0);
     7.5      }
     7.6  
     7.7 -    SDL_GetCurrentDisplayMode(&mode);
     7.8 +    SDL_GetCurrentDisplayMode(0, &mode);
     7.9      printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
    7.10      printf("\n");
    7.11      printf("Vendor     : %s\n", glGetString(GL_VENDOR));
     8.1 --- a/test/testime.c	Thu Feb 10 11:39:08 2011 -0800
     8.2 +++ b/test/testime.c	Thu Feb 10 12:14:37 2011 -0800
     8.3 @@ -122,12 +122,9 @@
     8.4  
     8.5      if (fullscreen)
     8.6      {
     8.7 -        SDL_DisplayMode mode;
     8.8 -        SDL_GetDesktopDisplayMode(&mode);
     8.9 -
    8.10 -        width = mode.w;
    8.11 -        height = mode.h;
    8.12 -        fprintf(stderr, "%dx%d\n", width, height);
    8.13 +        /* Use the desktop mode */
    8.14 +        width = 0;
    8.15 +        height = 0;
    8.16          flags |= SDL_FULLSCREEN;
    8.17      }
    8.18  
    8.19 @@ -375,3 +372,5 @@
    8.20      CleanupVideo();
    8.21      return 0;
    8.22  }
    8.23 +
    8.24 +/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/test/testvidinfo.c	Thu Feb 10 11:39:08 2011 -0800
     9.2 +++ b/test/testvidinfo.c	Thu Feb 10 12:14:37 2011 -0800
     9.3 @@ -455,9 +455,7 @@
     9.4          printf("Display %d: %dx%d at %d,%d\n", d,
     9.5                 bounds.w, bounds.h, bounds.x, bounds.y);
     9.6  
     9.7 -        SDL_SelectVideoDisplay(d);
     9.8 -
     9.9 -        SDL_GetDesktopDisplayMode(&mode);
    9.10 +        SDL_GetDesktopDisplayMode(d, &mode);
    9.11          SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
    9.12                                     &Amask);
    9.13          printf("  Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w,
    9.14 @@ -471,13 +469,13 @@
    9.15          }
    9.16  
    9.17          /* Print available fullscreen video modes */
    9.18 -        nmodes = SDL_GetNumDisplayModes();
    9.19 +        nmodes = SDL_GetNumDisplayModes(d);
    9.20          if (nmodes == 0) {
    9.21              printf("No available fullscreen video modes\n");
    9.22          } else {
    9.23              printf("  Fullscreen video modes:\n");
    9.24              for (i = 0; i < nmodes; ++i) {
    9.25 -                SDL_GetDisplayMode(i, &mode);
    9.26 +                SDL_GetDisplayMode(d, i, &mode);
    9.27                  SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
    9.28                                             &Gmask, &Bmask, &Amask);
    9.29                  printf("    Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,