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 6565 1f3c0df426dc
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
--- a/src/video/x11/SDL_x11modes.c	Sat Oct 06 10:53:47 2012 -0700
+++ b/src/video/x11/SDL_x11modes.c	Sat Oct 06 11:23:47 2012 -0700
@@ -573,7 +573,12 @@
 #endif
             use_vidmode) {
             displaydata->use_vidmode = use_vidmode;
-            XF86VidModeGetModeInfo(data->display, screen, &modedata->vm_mode);
+            if (displaydata->use_xinerama) {
+                displaydata->vidmode_screen = 0;
+            } else {
+                displaydata->vidmode_screen = screen;
+            }
+            XF86VidModeGetModeInfo(data->display, displaydata->vidmode_screen, &modedata->vm_mode);
         }
 #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
 
@@ -674,7 +679,7 @@
 
 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
     if (data->use_vidmode &&
-        XF86VidModeGetAllModeLines(display, data->screen, &nmodes, &modes)) {
+        XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) {
         int i;
 
 #ifdef X11MODES_DEBUG
@@ -767,7 +772,7 @@
 
 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
     if (data->use_vidmode) {
-        XF86VidModeSwitchToMode(display, data->screen, &modedata->vm_mode);
+        XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode);
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
 
--- a/src/video/x11/SDL_x11modes.h	Sat Oct 06 10:53:47 2012 -0700
+++ b/src/video/x11/SDL_x11modes.h	Sat Oct 06 11:23:47 2012 -0700
@@ -45,6 +45,10 @@
     RROutput xrandr_output;
 #endif
 
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+    int vidmode_screen;
+#endif
+
 } SDL_DisplayData;
 
 typedef struct