When using Xinerama, XVidMode always works on screen 0. Otherwise use the real X11 screen.
authorSam Lantinga <slouken@libsdl.org>
Sat, 06 Oct 2012 11:23:47 -0700
changeset 65651f3c0df426dc
parent 6564 fa0c355cbcdd
child 6566 dd7e57847ea9
When using Xinerama, XVidMode always works on screen 0. Otherwise use the real X11 screen.
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11modes.h
     1.1 --- a/src/video/x11/SDL_x11modes.c	Sat Oct 06 10:53:47 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11modes.c	Sat Oct 06 11:23:47 2012 -0700
     1.3 @@ -573,7 +573,12 @@
     1.4  #endif
     1.5              use_vidmode) {
     1.6              displaydata->use_vidmode = use_vidmode;
     1.7 -            XF86VidModeGetModeInfo(data->display, screen, &modedata->vm_mode);
     1.8 +            if (displaydata->use_xinerama) {
     1.9 +                displaydata->vidmode_screen = 0;
    1.10 +            } else {
    1.11 +                displaydata->vidmode_screen = screen;
    1.12 +            }
    1.13 +            XF86VidModeGetModeInfo(data->display, displaydata->vidmode_screen, &modedata->vm_mode);
    1.14          }
    1.15  #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
    1.16  
    1.17 @@ -674,7 +679,7 @@
    1.18  
    1.19  #if SDL_VIDEO_DRIVER_X11_XVIDMODE
    1.20      if (data->use_vidmode &&
    1.21 -        XF86VidModeGetAllModeLines(display, data->screen, &nmodes, &modes)) {
    1.22 +        XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) {
    1.23          int i;
    1.24  
    1.25  #ifdef X11MODES_DEBUG
    1.26 @@ -767,7 +772,7 @@
    1.27  
    1.28  #if SDL_VIDEO_DRIVER_X11_XVIDMODE
    1.29      if (data->use_vidmode) {
    1.30 -        XF86VidModeSwitchToMode(display, data->screen, &modedata->vm_mode);
    1.31 +        XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode);
    1.32      }
    1.33  #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
    1.34  
     2.1 --- a/src/video/x11/SDL_x11modes.h	Sat Oct 06 10:53:47 2012 -0700
     2.2 +++ b/src/video/x11/SDL_x11modes.h	Sat Oct 06 11:23:47 2012 -0700
     2.3 @@ -45,6 +45,10 @@
     2.4      RROutput xrandr_output;
     2.5  #endif
     2.6  
     2.7 +#if SDL_VIDEO_DRIVER_X11_XVIDMODE
     2.8 +    int vidmode_screen;
     2.9 +#endif
    2.10 +
    2.11  } SDL_DisplayData;
    2.12  
    2.13  typedef struct