diff src/video/x11/SDL_x11video.c @ 1765:c2c6ff414ef5

Fixed bug #45 Improved Xinerama support. Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment variable, currently supported on X11 Xinerama configurations. Only use the VidMode extension on the primary head.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 04 May 2006 16:51:07 +0000
parents 5cf11b00b900
children ae9f6be81810
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Thu May 04 13:47:19 2006 +0000
+++ b/src/video/x11/SDL_x11video.c	Thu May 04 16:51:07 2006 +0000
@@ -197,7 +197,7 @@
 	     (((e->error_code == BadRequest)&&(e->request_code == vm_error)) ||
 	      ((e->error_code > vm_error) &&
 	       (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) {
-#ifdef XFREE86_DEBUG
+#ifdef X11_DEBUG
 { char errmsg[1024];
   XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
 printf("VidMode error: %s\n", errmsg);
@@ -212,7 +212,7 @@
         if ( (dga_error >= 0) &&
 	     ((e->error_code > dga_error) &&
 	      (e->error_code <= (dga_error+XF86DGANumberErrors))) ) {
-#ifdef XFREE86_DEBUG
+#ifdef X11_DEBUG
 { char errmsg[1024];
   XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
 printf("DGA error: %s\n", errmsg);
@@ -244,7 +244,7 @@
 static int (*Xext_handler)(Display *, _Xconst char *, _Xconst char *) = NULL;
 static int xext_errhandler(Display *d, _Xconst char *ext, _Xconst char *reason)
 {
-#ifdef XFREE86_DEBUG
+#ifdef X11_DEBUG
 	printf("Xext error inside SDL (may be harmless):\n");
 	printf("  Extension \"%s\" %s on display \"%s\".\n",
 	       ext, reason, XDisplayString(d));
@@ -310,6 +310,7 @@
 /* Create auxiliary (toplevel) windows with the current visual */
 static void create_aux_windows(_THIS)
 {
+    int x = 0, y = 0;
     Atom _NET_WM_NAME;
     Atom _NET_WM_ICON_NAME;
     char classname[1024];
@@ -333,13 +334,19 @@
     if(FSwindow)
 	XDestroyWindow(SDL_Display, FSwindow);
 
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
+    if ( use_xinerama ) {
+        x = xinerama_info.x_org;
+        y = xinerama_info.y_org;
+    }
+#endif
     xattr.override_redirect = True;
     xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0;
     xattr.border_pixel = 0;
     xattr.colormap = SDL_XColorMap;
 
     FSwindow = XCreateWindow(SDL_Display, SDL_Root,
-                             xinerama_x, xinerama_y, 32, 32, 0,
+                             x, y, 32, 32, 0,
 			     this->hidden->depth, InputOutput, SDL_Visual,
 			     CWOverrideRedirect | CWBackPixel | CWBorderPixel
 			     | CWColormap,
@@ -379,7 +386,8 @@
 
     /* Create the window for windowed management */
     /* (reusing the xattr structure above) */
-    WMwindow = XCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0,
+    WMwindow = XCreateWindow(SDL_Display, SDL_Root,
+                             x, y, 32, 32, 0,
 			     this->hidden->depth, InputOutput, SDL_Visual,
 			     CWBackPixel | CWBorderPixel | CWColormap,
 			     &xattr);