Date: Thu, 13 Nov 2003 12:21:05 +0100 From: Stefan Dirsch To: sdl@libsdl.org Subject: [SDL] Patch for Xinerama/Fullscreen support 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);