Xrandr support in the X11 target.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 22 Mar 2006 11:13:58 +0000
changeset 158934cca785be57
parent 1588 e20dcef5647c
child 1590 96d8c3fec479
Xrandr support in the X11 target.

Fixes Bugzilla #109, and as a bonus, Bugzilla #145, too!
configure.in
docs/html/sdlenvvars.html
include/SDL_config.h.in
src/video/x11/SDL_x11dyn.c
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.h
     1.1 --- a/configure.in	Wed Mar 22 09:18:10 2006 +0000
     1.2 +++ b/configure.in	Wed Mar 22 11:13:58 2006 +0000
     1.3 @@ -789,9 +789,11 @@
     1.4                            , enable_x11_shared=yes)
     1.5  
     1.6              case "$host" in
     1.7 -                *-*-darwin*)
     1.8 +                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
     1.9                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
    1.10                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
    1.11 +                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
    1.12 +                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
    1.13                      ;;
    1.14                  *-*-osf*)
    1.15                      x11_lib='libX11.so'
    1.16 @@ -810,6 +812,12 @@
    1.17                          if test "x$x11ext_lib" = "x"; then
    1.18                              x11ext_lib=[`ls $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.19                          fi
    1.20 +                        if test "x$xrender_lib" = "x"; then
    1.21 +                            xrender_lib=[`ls $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.22 +                        fi
    1.23 +                        if test "x$xrandr_lib" = "x"; then
    1.24 +                            xrandr_lib=[`ls $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.25 +                        fi
    1.26                      done
    1.27                      ;;
    1.28              esac
    1.29 @@ -833,6 +841,7 @@
    1.30                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
    1.31                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
    1.32              else
    1.33 +                enable_x11_shared=no
    1.34                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
    1.35              fi
    1.36              have_video=yes
    1.37 @@ -884,6 +893,37 @@
    1.38                  AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
    1.39                  SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
    1.40              fi
    1.41 +            AC_ARG_ENABLE(video-x11-xrandr,
    1.42 +AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [default=yes]]),
    1.43 +                            , enable_video_x11_xrandr=yes)
    1.44 +            if test x$enable_video_x11_xrandr = xyes; then
    1.45 +                definitely_enable_video_x11_xrandr=no
    1.46 +                AC_CHECK_HEADER(X11/extensions/Xrandr.h,
    1.47 +                                have_xrandr_h_hdr=yes,
    1.48 +                                have_xrandr_h_hdr=no,
    1.49 +                                [#include <X11/Xlib.h>
    1.50 +                                ])
    1.51 +                if test x$have_xrandr_h_hdr = xyes; then
    1.52 +                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
    1.53 +                        echo "-- dynamic libXrender -> $xrender_lib"
    1.54 +                        echo "-- dynamic libXrandr -> $xrandr_lib"
    1.55 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
    1.56 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
    1.57 +                        definitely_enable_video_x11_xrandr=yes
    1.58 +                    else
    1.59 +                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
    1.60 +                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
    1.61 +                        if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
    1.62 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
    1.63 +                            definitely_enable_video_x11_xrandr=yes
    1.64 +                        fi
    1.65 +                    fi
    1.66 +                fi
    1.67 +            fi
    1.68 +
    1.69 +            if test x$definitely_enable_video_x11_xrandr = xyes; then
    1.70 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
    1.71 +            fi
    1.72          fi
    1.73      fi
    1.74  }
     2.1 --- a/docs/html/sdlenvvars.html	Wed Mar 22 09:18:10 2006 +0000
     2.2 +++ b/docs/html/sdlenvvars.html	Wed Mar 22 11:13:58 2006 +0000
     2.3 @@ -576,6 +576,18 @@
     2.4  ><DT
     2.5  ><TT
     2.6  CLASS="LITERAL"
     2.7 +>SDL_VIDEO_X11_NO_XRANDR</TT
     2.8 +></DT
     2.9 +><DD
    2.10 +><P
    2.11 +>If set, don't attempt to use the Xrandr extension for resolution mode
    2.12 +switching.  Normally Xrandr takes precedence over the XF86VidMode
    2.13 +extension, so setting this environment variable will cause the 
    2.14 +XF86VidMode extension to be used if it is available.</P
    2.15 +></DD
    2.16 +><DT
    2.17 +><TT
    2.18 +CLASS="LITERAL"
    2.19  >SDL_VIDEO_YUV_DIRECT</TT
    2.20  ></DT
    2.21  ><DD
    2.22 @@ -1209,4 +1221,4 @@
    2.23  ></DIV
    2.24  ></BODY
    2.25  ></HTML
    2.26 ->
    2.27 \ No newline at end of file
    2.28 +>
     3.1 --- a/include/SDL_config.h.in	Wed Mar 22 09:18:10 2006 +0000
     3.2 +++ b/include/SDL_config.h.in	Wed Mar 22 11:13:58 2006 +0000
     3.3 @@ -278,9 +278,12 @@
     3.4  #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
     3.5  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
     3.6  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
     3.7 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
     3.8 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
     3.9  #undef SDL_VIDEO_DRIVER_X11_VIDMODE
    3.10  #undef SDL_VIDEO_DRIVER_X11_XINERAMA
    3.11  #undef SDL_VIDEO_DRIVER_X11_XME
    3.12 +#undef SDL_VIDEO_DRIVER_X11_XRANDR
    3.13  #undef SDL_VIDEO_DRIVER_X11_XV
    3.14  #undef SDL_VIDEO_DRIVER_XBIOS
    3.15  
     4.1 --- a/src/video/x11/SDL_x11dyn.c	Wed Mar 22 09:18:10 2006 +0000
     4.2 +++ b/src/video/x11/SDL_x11dyn.c	Wed Mar 22 11:13:58 2006 +0000
     4.3 @@ -21,13 +21,11 @@
     4.4  */
     4.5  #include "SDL_config.h"
     4.6  
     4.7 -#if 0
     4.8 -#define DEBUG_DYNAMIC_X11 1
     4.9 -#endif
    4.10 +#define DEBUG_DYNAMIC_X11 0
    4.11  
    4.12  #include "SDL_x11dyn.h"
    4.13  
    4.14 -#ifdef DEBUG_DYNAMIC_X11
    4.15 +#if DEBUG_DYNAMIC_X11
    4.16  #include <stdio.h>
    4.17  #endif
    4.18  
    4.19 @@ -39,6 +37,10 @@
    4.20  static void *x11_handle = NULL;
    4.21  static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT;
    4.22  static void *x11ext_handle = NULL;
    4.23 +static const char *xrender_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER;
    4.24 +static void *xrender_handle = NULL;
    4.25 +static const char *xrandr_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR;
    4.26 +static void *xrandr_handle = NULL;
    4.27  
    4.28  typedef struct
    4.29  {
    4.30 @@ -54,6 +56,8 @@
    4.31  	{
    4.32  		{ x11_handle, "libX11" },
    4.33  		{ x11ext_handle, "libX11ext" },
    4.34 +		{ xrender_handle, "libXrender" },
    4.35 +		{ xrandr_handle, "libXrandr" },
    4.36  	};
    4.37  
    4.38  	for (i = 0; i < (sizeof (libs) / sizeof (libs[0])); i++)
    4.39 @@ -130,6 +134,14 @@
    4.40  				SDL_UnloadObject(x11ext_handle);
    4.41  				x11ext_handle = NULL;
    4.42  			}
    4.43 +			if (xrender_handle != NULL) {
    4.44 +				SDL_UnloadObject(xrender_handle);
    4.45 +				xrender_handle = NULL;
    4.46 +			}
    4.47 +			if (xrandr_handle != NULL) {
    4.48 +				SDL_UnloadObject(xrandr_handle);
    4.49 +				xrandr_handle = NULL;
    4.50 +			}
    4.51  		}
    4.52  	}
    4.53  	#endif
    4.54 @@ -146,6 +158,8 @@
    4.55  		int *thismod = NULL;
    4.56  		x11_handle = SDL_LoadObject(x11_library);
    4.57  		x11ext_handle = SDL_LoadObject(x11ext_library);
    4.58 +		xrender_handle = SDL_LoadObject(xrender_library);
    4.59 +		xrandr_handle = SDL_LoadObject(xrandr_library);
    4.60  		#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
    4.61  		#define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod);
    4.62  		#include "SDL_x11sym.h"
     5.1 --- a/src/video/x11/SDL_x11dyn.h	Wed Mar 22 09:18:10 2006 +0000
     5.2 +++ b/src/video/x11/SDL_x11dyn.h	Wed Mar 22 11:13:58 2006 +0000
     5.3 @@ -38,6 +38,10 @@
     5.4  #include <X11/extensions/XShm.h>
     5.5  #endif
     5.6  
     5.7 +#if SDL_VIDEO_DRIVER_X11_XRANDR
     5.8 +#include <X11/extensions/Xrandr.h>
     5.9 +#endif
    5.10 +
    5.11  /*
    5.12   * When using the "dynamic X11" functionality, we duplicate all the Xlib
    5.13   *  symbols that would be referenced by SDL inside of SDL itself.
     6.1 --- a/src/video/x11/SDL_x11modes.c	Wed Mar 22 09:18:10 2006 +0000
     6.2 +++ b/src/video/x11/SDL_x11modes.c	Wed Mar 22 11:13:58 2006 +0000
     6.3 @@ -86,6 +86,18 @@
     6.4  }
     6.5  #endif
     6.6  
     6.7 +#if SDL_VIDEO_DRIVER_X11_XRANDR
     6.8 +static int cmpmodelist(const void *va, const void *vb)
     6.9 +{
    6.10 +    const SDL_Rect *a = *(const SDL_Rect **)va;
    6.11 +    const SDL_Rect *b = *(const SDL_Rect **)vb;
    6.12 +    if ( a->w == b->w )
    6.13 +        return b->h - a->h;
    6.14 +    else
    6.15 +        return b->w - a->w;
    6.16 +}
    6.17 +#endif
    6.18 +
    6.19  static void get_real_resolution(_THIS, int* w, int* h);
    6.20  
    6.21  static void set_best_resolution(_THIS, int width, int height)
    6.22 @@ -180,6 +192,55 @@
    6.23      }
    6.24  #endif /* SDL_VIDEO_DRIVER_X11_XME */
    6.25  
    6.26 +#if SDL_VIDEO_DRIVER_X11_XRANDR
    6.27 +    if ( use_xrandr ) {
    6.28 +#ifdef XRANDR_DEBUG
    6.29 +        fprintf(stderr, "XRANDR: set_best_resolution(): w = %d, h = %d\n",
    6.30 +                width, height);
    6.31 +#endif
    6.32 +        if ( SDL_modelist ) {
    6.33 +            int i, nsizes;
    6.34 +            XRRScreenSize *sizes;
    6.35 +
    6.36 +            /* find the smallest resolution that is at least as big as the user requested */
    6.37 +            sizes = XRRConfigSizes(screen_config, &nsizes);
    6.38 +            for ( i = (nsizes-1); i >= 0; i-- ) {
    6.39 +                if ( (SDL_modelist[i]->w >= width) &&
    6.40 +                     (SDL_modelist[i]->h >= height) ) {
    6.41 +                    break;
    6.42 +                }
    6.43 +            }
    6.44 +
    6.45 +            if ( i >= 0 && SDL_modelist[i] ) { /* found one, lets try it */
    6.46 +                int w, h;
    6.47 +
    6.48 +                /* check current mode so we can avoid uneccessary mode changes */
    6.49 +                get_real_resolution(this, &w, &h);
    6.50 +
    6.51 +                if ( (SDL_modelist[i]->w != w) || (SDL_modelist[i]->h != h) ) {
    6.52 +                    int size_id;
    6.53 +
    6.54 +#ifdef XRANDR_DEBUG
    6.55 +                    fprintf(stderr, "XRANDR: set_best_resolution: "
    6.56 +                            "XXRSetScreenConfig: %d %d\n",
    6.57 +                            SDL_modelist[i]->w, SDL_modelist[i]->h);
    6.58 +#endif
    6.59 +
    6.60 +                    /* find the matching size entry index */
    6.61 +                    for ( size_id = 0; size_id < nsizes; ++size_id ) {
    6.62 +                        if ( (sizes[size_id].width == SDL_modelist[i]->w) &&
    6.63 +                             (sizes[size_id].height == SDL_modelist[i]->h) )
    6.64 +                            break;
    6.65 +                    }
    6.66 +
    6.67 +                    XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root,
    6.68 +                                       size_id, saved_rotation, CurrentTime);
    6.69 +                }
    6.70 +            }
    6.71 +        }
    6.72 +    }
    6.73 +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
    6.74 +
    6.75  }
    6.76  
    6.77  static void get_real_resolution(_THIS, int* w, int* h)
    6.78 @@ -195,7 +256,7 @@
    6.79              return;
    6.80          }
    6.81      }
    6.82 -#endif
    6.83 +#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
    6.84  
    6.85  #if SDL_VIDEO_DRIVER_X11_XME
    6.86      if ( use_xme ) {
    6.87 @@ -213,7 +274,30 @@
    6.88          XFree(modelist);
    6.89          return;
    6.90      }
    6.91 -#endif /* XIG_XME */
    6.92 +#endif /* SDL_VIDEO_DRIVER_X11_XME */
    6.93 +
    6.94 +#if SDL_VIDEO_DRIVER_X11_XRANDR
    6.95 +    if ( use_xrandr ) {
    6.96 +        int nsizes;
    6.97 +        XRRScreenSize* sizes;
    6.98 +
    6.99 +        sizes = XRRConfigSizes(screen_config, &nsizes);
   6.100 +        if ( nsizes > 0 ) {
   6.101 +            int cur_size;
   6.102 +            Rotation cur_rotation;
   6.103 +
   6.104 +            cur_size = XRRConfigCurrentConfiguration(screen_config, &cur_rotation);
   6.105 +            if ( cur_size >= 0 && cur_size < nsizes ) {
   6.106 +                *w = sizes[cur_size].width;
   6.107 +                *h = sizes[cur_size].height;
   6.108 +            }
   6.109 +#ifdef XRANDR_DEBUG
   6.110 +            fprintf(stderr, "XRANDR: get_real_resolution: w = %d h = %d\n", *w, *h);
   6.111 +#endif
   6.112 +            return;
   6.113 +        }
   6.114 +    }
   6.115 +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
   6.116  
   6.117      *w = DisplayWidth(SDL_Display, SDL_Screen);
   6.118      *h = DisplayHeight(SDL_Display, SDL_Screen);
   6.119 @@ -289,15 +373,69 @@
   6.120      int ractive, nummodes;
   6.121      XiGMiscResolutionInfo *modelist;
   6.122  #endif
   6.123 +#if SDL_VIDEO_DRIVER_X11_XRANDR
   6.124 +    int xrandr_major, xrandr_minor;
   6.125 +    int nsizes;
   6.126 +    XRRScreenSize *sizes;
   6.127 +#endif
   6.128      int i, n;
   6.129      int screen_w;
   6.130      int screen_h;
   6.131  
   6.132      vm_error = -1;
   6.133      use_vidmode = 0;
   6.134 +    use_xrandr = 0;
   6.135      screen_w = DisplayWidth(SDL_Display, SDL_Screen);
   6.136      screen_h = DisplayHeight(SDL_Display, SDL_Screen);
   6.137  
   6.138 +    /* XRandR */
   6.139 +#if SDL_VIDEO_DRIVER_X11_XRANDR
   6.140 +    /* require at least XRandR v1.0 (arbitrary) */
   6.141 +    if ( ( SDL_X11_HAVE_XRANDR ) &&
   6.142 +         ( getenv("SDL_VIDEO_X11_NO_XRANDR") == NULL ) &&
   6.143 +         ( XRRQueryVersion(SDL_Display, &xrandr_major, &xrandr_minor) ) &&
   6.144 +         ( xrandr_major >= 1 ) ) {
   6.145 +
   6.146 +#ifdef XRANDR_DEBUG
   6.147 +        fprintf(stderr, "XRANDR: XRRQueryVersion: V%d.%d\n",
   6.148 +                xrandr_major, xrandr_minor);
   6.149 +#endif
   6.150 +
   6.151 +        /* save the screen configuration since we must reference it
   6.152 +           each time we toggle modes.
   6.153 +        */
   6.154 +        screen_config = XRRGetScreenInfo(SDL_Display, SDL_Root);
   6.155 +
   6.156 +        /* retrieve the list of resolution */
   6.157 +        sizes = XRRConfigSizes(screen_config, &nsizes);
   6.158 +        if (nsizes > 0) {
   6.159 +            SDL_modelist = (SDL_Rect **)malloc((nsizes+1)*sizeof(SDL_Rect *));
   6.160 +            if (SDL_modelist) {
   6.161 +                for ( i=0; i < nsizes; i++ ) {
   6.162 +                    if ((SDL_modelist[i] =
   6.163 +                         (SDL_Rect *)malloc(sizeof(SDL_Rect))) == NULL)
   6.164 +                        break;
   6.165 +#ifdef XRANDR_DEBUG
   6.166 +                    fprintf(stderr, "XRANDR: mode = %4d, w = %4d, h = %4d\n",
   6.167 +                            i, sizes[i].width, sizes[i].height);
   6.168 +#endif
   6.169 +
   6.170 +                    SDL_modelist[i]->x = 0;
   6.171 +                    SDL_modelist[i]->y = 0;
   6.172 +                    SDL_modelist[i]->w = sizes[i].width;
   6.173 +                    SDL_modelist[i]->h = sizes[i].height;
   6.174 +
   6.175 +                }
   6.176 +                /* sort the mode list descending as SDL expects */
   6.177 +                qsort(SDL_modelist, nsizes, sizeof *SDL_modelist, cmpmodelist);
   6.178 +                SDL_modelist[i] = NULL; /* terminator */
   6.179 +            }
   6.180 +            use_xrandr = xrandr_major * 100 + xrandr_minor;
   6.181 +            saved_size_id = XRRConfigCurrentConfiguration(screen_config, &saved_rotation);
   6.182 +        }
   6.183 +    }
   6.184 +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
   6.185 +
   6.186  #if SDL_VIDEO_DRIVER_X11_VIDMODE
   6.187      /* Metro-X 4.3.0 and earlier has a broken implementation of
   6.188         XF86VidModeGetAllModeLines() - it hangs the client.
   6.189 @@ -345,7 +483,7 @@
   6.190              buggy_X11 = 1;
   6.191          }
   6.192      }
   6.193 -    if ( ! buggy_X11 &&
   6.194 +    if ( ! buggy_X11 && ! use_xrandr &&
   6.195           SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display, SDL_Screen,&nmodes,&modes) ) {
   6.196  
   6.197  #ifdef XFREE86_DEBUG
   6.198 @@ -426,7 +564,7 @@
   6.199               */
   6.200              fprintf(stderr, 
   6.201  "XME: If you are using Xi Graphics CDE and a Summit server, you need to\n"
   6.202 -"XME: get the libXext update from our ftp site before fullscreen switching\n"
   6.203 +"XME: get the libXext update from Xi's ftp site before fullscreen switching\n"
   6.204  "XME: will work.  Fullscreen switching is only supported on Summit Servers\n");
   6.205            }
   6.206      } else {
   6.207 @@ -635,6 +773,14 @@
   6.208          SDL_free(SDL_modelist);
   6.209          SDL_modelist = NULL;
   6.210      }
   6.211 +
   6.212 +#if SDL_VIDEO_DRIVER_X11_XRANDR
   6.213 +    /* Free the Xrandr screen configuration */
   6.214 +    if ( screen_config ) {
   6.215 +        XRRFreeScreenConfigInfo(screen_config);
   6.216 +        screen_config = NULL;
   6.217 +    }
   6.218 +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
   6.219  }
   6.220  
   6.221  int X11_ResizeFullScreen(_THIS)
   6.222 @@ -804,6 +950,13 @@
   6.223          }
   6.224  #endif
   6.225  
   6.226 +#if SDL_VIDEO_DRIVER_X11_XRANDR
   6.227 +        if ( use_xrandr ) {
   6.228 +            XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root,
   6.229 +                               saved_size_id, saved_rotation, CurrentTime);
   6.230 +        }
   6.231 +#endif
   6.232 +
   6.233          XUnmapWindow(SDL_Display, FSwindow);
   6.234          X11_WaitUnmapped(this, FSwindow);
   6.235          XSync(SDL_Display, True);   /* Flush spurious mode change events */
     7.1 --- a/src/video/x11/SDL_x11sym.h	Wed Mar 22 09:18:10 2006 +0000
     7.2 +++ b/src/video/x11/SDL_x11sym.h	Wed Mar 22 11:13:58 2006 +0000
     7.3 @@ -176,5 +176,16 @@
     7.4  SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a, IPCard b),(a,b),return)
     7.5  #endif
     7.6  
     7.7 +/* Xrandr support. */
     7.8 +#if SDL_VIDEO_DRIVER_X11_XRANDR
     7.9 +SDL_X11_MODULE(XRANDR)
    7.10 +SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
    7.11 +SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return)
    7.12 +SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return)
    7.13 +SDL_X11_SYM(XRRScreenSize *,XRRConfigSizes,(XRRScreenConfiguration *config, int *nsizes),(config,nsizes),return)
    7.14 +SDL_X11_SYM(Status,XRRSetScreenConfig,(Display *dpy, XRRScreenConfiguration *config, Drawable draw, int size_index, Rotation rotation, Time timestamp),(dpy,config,draw,size_index,rotation,timestamp),return)
    7.15 +SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(config),)
    7.16 +#endif
    7.17 +
    7.18  /* end of SDL_x11sym.h ... */
    7.19  
     8.1 --- a/src/video/x11/SDL_x11video.h	Wed Mar 22 09:18:10 2006 +0000
     8.2 +++ b/src/video/x11/SDL_x11video.h	Wed Mar 22 11:13:58 2006 +0000
     8.3 @@ -40,6 +40,9 @@
     8.4  #if SDL_VIDEO_DRIVER_X11_XME
     8.5  #include "../Xext/extensions/xme.h"
     8.6  #endif
     8.7 +#if SDL_VIDEO_DRIVER_X11_XRANDR
     8.8 +#include <X11/extensions/Xrandr.h>
     8.9 +#endif
    8.10  
    8.11  #include "SDL_x11dyn.h"
    8.12  
    8.13 @@ -116,10 +119,16 @@
    8.14      int use_xme;
    8.15      XiGMiscResolutionInfo saved_res;
    8.16  #endif
    8.17 +#if SDL_VIDEO_DRIVER_X11_XRANDR
    8.18 +    XRRScreenConfiguration* screen_config;
    8.19 +    int saved_size_id;
    8.20 +    Rotation saved_rotation;
    8.21 +#endif
    8.22  
    8.23      int xinerama_x;
    8.24      int xinerama_y;
    8.25      int use_vidmode;
    8.26 +    int use_xrandr;
    8.27      int currently_fullscreen;
    8.28  
    8.29      /* Automatic mode switching support (entering/leaving fullscreen) */
    8.30 @@ -169,6 +178,10 @@
    8.31  #define saved_view		(this->hidden->saved_view)
    8.32  #define use_xme			(this->hidden->use_xme)
    8.33  #define saved_res		(this->hidden->saved_res)
    8.34 +#define use_xrandr		(this->hidden->use_xrandr)
    8.35 +#define screen_config		(this->hidden->screen_config)
    8.36 +#define saved_size_id		(this->hidden->saved_size_id)
    8.37 +#define saved_rotation		(this->hidden->saved_rotation)
    8.38  #define xinerama_x		(this->hidden->xinerama_x)
    8.39  #define xinerama_y		(this->hidden->xinerama_y)
    8.40  #define use_vidmode		(this->hidden->use_vidmode)