Integrate XFixes and XDamage into the build system.
authorSunny Sachanandani <sunnysachanandani@gmail.com>
Mon, 19 Jul 2010 20:05:53 +0530
changeset 4604d7535d7a40ea
parent 4603 dffa432f0e2b
child 4605 0b3a509c53a0
Integrate XFixes and XDamage into the build system.
configure.in
include/SDL_config.h.in
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11render.c
src/video/x11/SDL_x11sym.h
     1.1 --- a/configure.in	Mon Jul 19 18:57:02 2010 +0530
     1.2 +++ b/configure.in	Mon Jul 19 20:05:53 2010 +0530
     1.3 @@ -1055,7 +1055,9 @@
     1.4                      xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
     1.5                      xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
     1.6                      xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
     1.7 -                    ;;
     1.8 +                    xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
     1.9 +                    xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    1.10 +;;
    1.11              esac
    1.12  
    1.13              if test x$ac_cv_func_shmat != xyes; then
    1.14 @@ -1222,14 +1224,50 @@
    1.15              if test x$definitely_enable_video_x11_xrender = xyes; then
    1.16                  AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
    1.17              fi
    1.18 -
    1.19 +            AC_ARG_ENABLE(video-x11-xdamage-xfixes,
    1.20 +AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
    1.21 +                            , enable_video_x11_xdamage=yes)
    1.22 +            if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
    1.23 +                AC_CHECK_HEADER(X11/extensions/Xdamage.h,
    1.24 +                                have_xdamage_h_hdr=yes,
    1.25 +                                have_xdamage_h_hdr=no,
    1.26 +                                [#include <X11/Xlib.h>
    1.27 +                                ])
    1.28 +                AC_CHECK_HEADER(X11/extensions/Xfixes.h,
    1.29 +                                have_xfixes_h_hdr=yes,
    1.30 +                                have_xfixes_h_hdr=no,
    1.31 +                                [#include <X11/Xlib.h>
    1.32 +                                ])
    1.33 +                if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
    1.34 +                    if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
    1.35 +                        echo "-- dynamic libXdamage -> $xdamage_lib"
    1.36 +                        echo "-- dynamic libXfixes -> $xfixes_lib"
    1.37 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
    1.38 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
    1.39 +                        definitely_enable_video_x11_xdamage=yes
    1.40 +                        definitely_enable_video_x11_xfixes=yes
    1.41 +                    else
    1.42 +                        AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
    1.43 +                        AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
    1.44 +                        if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
    1.45 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
    1.46 +                            definitely_enable_video_x11_xdamage=yes
    1.47 +                            definitely_enable_video_x11_xfixes=yes
    1.48 +                        fi
    1.49 +                    fi
    1.50 +                fi
    1.51 +            fi
    1.52 +            if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
    1.53 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
    1.54 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
    1.55 +            fi
    1.56              AC_ARG_ENABLE(render-x11,
    1.57  AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
    1.58                                  , enable_render_x11=yes)
    1.59              if test x$enable_render_x11 = xyes; then
    1.60                  AC_DEFINE(SDL_VIDEO_RENDER_X11)
    1.61              fi
    1.62 -        fi
    1.63 +       fi
    1.64      fi
    1.65  }
    1.66  
     2.1 --- a/include/SDL_config.h.in	Mon Jul 19 18:57:02 2010 +0530
     2.2 +++ b/include/SDL_config.h.in	Mon Jul 19 20:05:53 2010 +0530
     2.3 @@ -272,6 +272,8 @@
     2.4  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
     2.5  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
     2.6  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
     2.7 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE
     2.8 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
     2.9  #undef SDL_VIDEO_DRIVER_X11_VIDMODE
    2.10  #undef SDL_VIDEO_DRIVER_X11_XINERAMA
    2.11  #undef SDL_VIDEO_DRIVER_X11_XRANDR
    2.12 @@ -279,6 +281,8 @@
    2.13  #undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
    2.14  #undef SDL_VIDEO_DRIVER_X11_XV
    2.15  #undef SDL_VIDEO_DRIVER_X11_XRENDER
    2.16 +#undef SDL_VIDEO_DRIVER_X11_XDAMAGE
    2.17 +#undef SDL_VIDEO_DRIVER_X11_XFIXES
    2.18  
    2.19  #undef SDL_VIDEO_RENDER_X11
    2.20  
     3.1 --- a/src/video/x11/SDL_x11dyn.h	Mon Jul 19 18:57:02 2010 +0530
     3.2 +++ b/src/video/x11/SDL_x11dyn.h	Mon Jul 19 20:05:53 2010 +0530
     3.3 @@ -56,6 +56,14 @@
     3.4  #include <X11/extensions/Xrender.h>
     3.5  #endif
     3.6  
     3.7 +#if SDL_VIDEO_DRIVER_X11_XDAMAGE
     3.8 +#include <X11/extensions/Xdamage.h>
     3.9 +#endif
    3.10 +
    3.11 +#if SDL_VIDEO_DRIVER_X11_XFIXES
    3.12 +#include <X11/extensions/Xfixes.h>
    3.13 +#endif
    3.14 +
    3.15  /*
    3.16   * When using the "dynamic X11" functionality, we duplicate all the Xlib
    3.17   *  symbols that would be referenced by SDL inside of SDL itself.
     4.1 --- a/src/video/x11/SDL_x11render.c	Mon Jul 19 18:57:02 2010 +0530
     4.2 +++ b/src/video/x11/SDL_x11render.c	Mon Jul 19 20:05:53 2010 +0530
     4.3 @@ -31,11 +31,6 @@
     4.4  #include "../SDL_pixels_c.h"
     4.5  #include "../SDL_yuv_sw_c.h"
     4.6  
     4.7 -#include <X11/extensions/Xdamage.h>
     4.8 -#include <X11/extensions/Xfixes.h>
     4.9 -
    4.10 -#define SDL_VIDEO_DRIVER_X11_XDAMAGE
    4.11 -
    4.12  /* X11 renderer implementation */
    4.13  
    4.14  static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags);
    4.15 @@ -271,21 +266,23 @@
    4.16      }
    4.17  #ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
    4.18      if (data->use_xrender) {
    4.19 +        if(SDL_X11_HAVE_XDAMAGE && SDL_X11_HAVE_XFIXES) {
    4.20          /* Query XDamage and XFixes */
    4.21 -        if(XDamageQueryExtension(data->display,
    4.22 -                                 &event_basep,
    4.23 -                                 &error_basep) == True && 
    4.24 -           (XFixesQueryExtension(data->display,
    4.25 -                                    &event_basep,
    4.26 -                                    &error_basep) == True)) {
    4.27 -                int major_version, minor_version;
    4.28 -                XFixesQueryVersion(data->display,
    4.29 -                                   &major_version,
    4.30 -                                   &minor_version);
    4.31 -                /* Only XFixes v 2 or greater
    4.32 -                 * Required for XFixesSetPictureClipRegion() */
    4.33 -                if(major_version >= 2)
    4.34 -                    data->use_xdamage = SDL_TRUE;
    4.35 +            if(XDamageQueryExtension(data->display,
    4.36 +                                     &event_basep,
    4.37 +                                     &error_basep) == True && 
    4.38 +               (XFixesQueryExtension(data->display,
    4.39 +                                        &event_basep,
    4.40 +                                        &error_basep) == True)) {
    4.41 +                    int major_version, minor_version;
    4.42 +                    XFixesQueryVersion(data->display,
    4.43 +                                       &major_version,
    4.44 +                                       &minor_version);
    4.45 +                    /* Only XFixes v 2 or greater
    4.46 +                     * Required for XFixesSetPictureClipRegion() */
    4.47 +                    if(major_version >= 2)
    4.48 +                        data->use_xdamage = SDL_TRUE;
    4.49 +            }
    4.50          }
    4.51  #endif
    4.52          /* Find the PictFormat from the visual.
     5.1 --- a/src/video/x11/SDL_x11sym.h	Mon Jul 19 18:57:02 2010 +0530
     5.2 +++ b/src/video/x11/SDL_x11sym.h	Mon Jul 19 20:05:53 2010 +0530
     5.3 @@ -252,6 +252,22 @@
     5.4  SDL_X11_SYM(void,XRenderFillRectangle,(Display *dpy,int op,Picture dst,_Xconst XRenderColor *color,int x,int y,unsigned int width,unsigned int height),(dpy,op,dst,color,x,y,width,height),return)
     5.5  SDL_X11_SYM(void,XRenderFillRectangles,(Display *dpy,int op,Picture dst,_Xconst XRenderColor *color,_Xconst XRectangle *rectangles,int n_rects),(dpy,op,dst,color,rectangles,n_rects),return)
     5.6  #endif
     5.7 +
     5.8 +#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
     5.9 +SDL_X11_MODULE(XDAMAGE)
    5.10 +SDL_X11_SYM(Bool,XDamageQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return)
    5.11 +SDL_X11_SYM(Damage,XDamageCreate,(Display *dpy,Drawable d,int level),(dpy,d,level),return)
    5.12 +SDL_X11_SYM(void,XDamageSubtract,(Display *dpy,Damage damage,XserverRegion repair,XserverRegion parts),(dpy,damage,repair,parts),return)
    5.13 +SDL_X11_SYM(void,XDamageDestroy,(Display *dpy,Damage damage),(dpy,damage),return)
    5.14 +#endif
    5.15 +
    5.16 +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES
    5.17 +SDL_X11_MODULE(XFIXES)
    5.18 +SDL_X11_SYM(Bool,XFixesQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return)
    5.19 +SDL_X11_SYM(Status,XFixesQueryVersion,(Display *dpy,int *major,int *minor),(dpy,major,minor),return)
    5.20 +SDL_X11_SYM(void,XFixesSetGCClipRegion,(Display *dpy,GC gc,int clip_x,int clip_y,XserverRegion region),(dpy,gc,clip_x,clip_y,region),return)
    5.21 +SDL_X11_SYM(void,XFixesSetPictureClipRegion,(Display *dpy,XID picture,int clip_x,int clip_y,XserverRegion region),(dpy,picture,clip_x,clip_y,region),return)
    5.22 +#endif
    5.23  /* *INDENT-ON* */
    5.24  
    5.25  /* vi: set ts=4 sw=4 expandtab: */