[SDL] Patch for Xinerama/Fullscreen support

Stefan Dirsch sndirsch at suse.de
Thu Nov 13 03:22:01 PST 2003


Hi

I made a small patch to handle fullscreen support in Xinerama in a
better way, so that the application now starts on the first Xinerama
"screen" and not any longer above all Xinerama "screens". I found
Xinerama suppport already in SDL (1.2.5), but it was disabled as it
simply doesn't work correctly.

Any discussion about my patch would be appreciated. Maybe it will be
applied (in an improved form) for future releases of SDL.

Stefan

Public Key available
----------------------------------------------------
Stefan Dirsch (Res. & Dev.)   SuSE Linux AG
Tel: 0911-740530              Deutschherrnstr. 15-19
FAX: +49 911 741 77 55        D-90429 Nürnberg
http://www.suse.de            Germany 
----------------------------------------------------
-------------- next part --------------
diff -x requests -x Makefile.in -x Makefile -u -w -r /abuild/buildsystem.shannon.sndirsch/usr/src/packages/BUILD/SDL-1.2.5/src/video/x11/SDL_x11modes.c ./src/video/x11/SDL_x11modes.c
--- /abuild/buildsystem.shannon.sndirsch/usr/src/packages/BUILD/SDL-1.2.5/src/video/x11/SDL_x11modes.c	2002-09-30 02:35:25.000000000 +0200
+++ ./src/video/x11/SDL_x11modes.c	2003-11-12 17:06:49.684088094 +0100
@@ -170,8 +170,10 @@
 
 static void get_real_resolution(_THIS, int* w, int* h)
 {
+    Bool haveXinerama = SDL_NAME(XineramaIsActive) (SDL_Display);
+
 #ifdef XFREE86_VM
-    if ( use_vidmode ) {
+    if ( (use_vidmode) && (! haveXinerama)) {
         SDL_NAME(XF86VidModeModeLine) mode;
         int unused;
 
@@ -201,8 +203,16 @@
     }
 #endif /* XIG_XME */
 
+    if (! haveXinerama) {
     *w = DisplayWidth(SDL_Display, SDL_Screen);
     *h = DisplayHeight(SDL_Display, SDL_Screen);
+    } else {
+        int screens;
+        SDL_NAME(XineramaScreenInfo) *xinerama;
+        xinerama = SDL_NAME(XineramaQueryScreens)(SDL_Display, &screens);
+        *w = xinerama[0].width;
+        *h = xinerama[0].height;
+    }
 }
 
 /* Called after mapping a window - waits until the window is mapped */
@@ -610,6 +620,7 @@
     int real_w, real_h;
     int screen_w;
     int screen_h;
+    Bool haveXinerama = SDL_NAME(XineramaIsActive) (SDL_Display);
 
     screen_w = DisplayWidth(SDL_Display, SDL_Screen);
     screen_h = DisplayHeight(SDL_Display, SDL_Screen);
@@ -622,12 +633,14 @@
         set_best_resolution(this, current_w, current_h);
         move_cursor_to(this, x, y);
         get_real_resolution(this, &real_w, &real_h);
+        if (! haveXinerama) {
         if ( current_w > real_w ) {
             real_w = MAX(real_w, screen_w);
         }
         if ( current_h > real_h ) {
             real_h = MAX(real_h, screen_h);
         }
+        }
         XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
         move_cursor_to(this, real_w/2, real_h/2);
 
@@ -673,12 +686,14 @@
     screen_w = DisplayWidth(SDL_Display, SDL_Screen);
     screen_h = DisplayHeight(SDL_Display, SDL_Screen);
     get_real_resolution(this, &real_w, &real_h);
+    if (! (SDL_NAME(XineramaIsActive) (SDL_Display)) ) {
     if ( current_w > real_w ) {
         real_w = MAX(real_w, screen_w);
     }
     if ( current_h > real_h ) {
         real_h = MAX(real_h, screen_h);
     }
+    }
     XMoveResizeWindow(SDL_Display, FSwindow,
                       xinerama_x, xinerama_y, real_w, real_h);
     XMapRaised(SDL_Display, FSwindow);


More information about the SDL mailing list