Fixed detection of display bounds after a mode switch when Xinerama is enabled.
authorSam Lantinga
Fri, 28 Sep 2012 11:51:16 -0700
changeset 6502f41a82de351e
parent 6501 2efafb933bd5
child 6503 8ff31baded38
Fixed detection of display bounds after a mode switch when Xinerama is enabled.
src/video/x11/SDL_x11modes.c
     1.1 --- a/src/video/x11/SDL_x11modes.c	Fri Sep 28 10:54:26 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11modes.c	Fri Sep 28 11:51:16 2012 -0700
     1.3 @@ -637,6 +637,16 @@
     1.4  
     1.5  #if SDL_VIDEO_DRIVER_X11_XINERAMA
     1.6      if (data->use_xinerama) {
     1.7 +        int screencount;
     1.8 +        XineramaScreenInfo *xinerama;
     1.9 +
    1.10 +        /* Update the current screen layout information */
    1.11 +        xinerama = XineramaQueryScreens(display, &screencount);
    1.12 +        if (xinerama && data->screen < screencount) {
    1.13 +            data->xinerama_info = xinerama[data->screen];
    1.14 +        }
    1.15 +        if (xinerama) XFree(xinerama);
    1.16 +
    1.17          *w = data->xinerama_info.width;
    1.18          *h = data->xinerama_info.height;
    1.19          *rate = 0;
    1.20 @@ -789,21 +799,20 @@
    1.21  int
    1.22  X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect)
    1.23  {
    1.24 +    Display *display = ((SDL_VideoData *) _this->driverdata)->display;
    1.25      SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
    1.26 +    int real_rate;
    1.27 +
    1.28 +    rect->x = 0;
    1.29 +    rect->y = 0;
    1.30 +    get_real_resolution(display, data, &rect->w, &rect->h, &real_rate);
    1.31  
    1.32  #if SDL_VIDEO_DRIVER_X11_XINERAMA
    1.33 -    if (data && data->use_xinerama) {
    1.34 +    if (data->use_xinerama) {
    1.35          rect->x = data->xinerama_info.x_org;
    1.36          rect->y = data->xinerama_info.y_org;
    1.37 -        rect->w = data->xinerama_info.width;
    1.38 -        rect->h = data->xinerama_info.height;
    1.39 -        return 0;
    1.40      }
    1.41  #endif
    1.42 -    rect->x = 0;
    1.43 -    rect->y = 0;
    1.44 -    rect->w = sdl_display->current_mode.w;
    1.45 -    rect->h = sdl_display->current_mode.h;
    1.46      return 0;
    1.47  }
    1.48