Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Integrate XFixes and XDamage into the build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyps committed Jul 19, 2010
1 parent 1cd3dbe commit ebd50fe
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 22 deletions.
44 changes: 41 additions & 3 deletions configure.in
Expand Up @@ -1055,7 +1055,9 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
;;
xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
;;
esac

if test x$ac_cv_func_shmat != xyes; then
Expand Down Expand Up @@ -1222,14 +1224,50 @@ AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[def
if test x$definitely_enable_video_x11_xrender = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
fi

AC_ARG_ENABLE(video-x11-xdamage-xfixes,
AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
, enable_video_x11_xdamage=yes)
if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
AC_CHECK_HEADER(X11/extensions/Xdamage.h,
have_xdamage_h_hdr=yes,
have_xdamage_h_hdr=no,
[#include <X11/Xlib.h>
])
AC_CHECK_HEADER(X11/extensions/Xfixes.h,
have_xfixes_h_hdr=yes,
have_xfixes_h_hdr=no,
[#include <X11/Xlib.h>
])
if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
echo "-- dynamic libXdamage -> $xdamage_lib"
echo "-- dynamic libXfixes -> $xfixes_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
definitely_enable_video_x11_xdamage=yes
definitely_enable_video_x11_xfixes=yes
else
AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
definitely_enable_video_x11_xdamage=yes
definitely_enable_video_x11_xfixes=yes
fi
fi
fi
fi
if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
fi
AC_ARG_ENABLE(render-x11,
AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
, enable_render_x11=yes)
if test x$enable_render_x11 = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_X11)
fi
fi
fi
fi
}

Expand Down
4 changes: 4 additions & 0 deletions include/SDL_config.h.in
Expand Up @@ -272,13 +272,17 @@
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XRANDR
#undef SDL_VIDEO_DRIVER_X11_XINPUT
#undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
#undef SDL_VIDEO_DRIVER_X11_XV
#undef SDL_VIDEO_DRIVER_X11_XRENDER
#undef SDL_VIDEO_DRIVER_X11_XDAMAGE
#undef SDL_VIDEO_DRIVER_X11_XFIXES

#undef SDL_VIDEO_RENDER_X11

Expand Down
8 changes: 8 additions & 0 deletions src/video/x11/SDL_x11dyn.h
Expand Up @@ -56,6 +56,14 @@
#include <X11/extensions/Xrender.h>
#endif

#if SDL_VIDEO_DRIVER_X11_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif

#if SDL_VIDEO_DRIVER_X11_XFIXES
#include <X11/extensions/Xfixes.h>
#endif

/*
* When using the "dynamic X11" functionality, we duplicate all the Xlib
* symbols that would be referenced by SDL inside of SDL itself.
Expand Down
35 changes: 16 additions & 19 deletions src/video/x11/SDL_x11render.c
Expand Up @@ -31,11 +31,6 @@
#include "../SDL_pixels_c.h"
#include "../SDL_yuv_sw_c.h"

#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>

#define SDL_VIDEO_DRIVER_X11_XDAMAGE

/* X11 renderer implementation */

static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags);
Expand Down Expand Up @@ -271,21 +266,23 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
}
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if (data->use_xrender) {
if(SDL_X11_HAVE_XDAMAGE && SDL_X11_HAVE_XFIXES) {
/* Query XDamage and XFixes */
if(XDamageQueryExtension(data->display,
&event_basep,
&error_basep) == True &&
(XFixesQueryExtension(data->display,
&event_basep,
&error_basep) == True)) {
int major_version, minor_version;
XFixesQueryVersion(data->display,
&major_version,
&minor_version);
/* Only XFixes v 2 or greater
* Required for XFixesSetPictureClipRegion() */
if(major_version >= 2)
data->use_xdamage = SDL_TRUE;
if(XDamageQueryExtension(data->display,
&event_basep,
&error_basep) == True &&
(XFixesQueryExtension(data->display,
&event_basep,
&error_basep) == True)) {
int major_version, minor_version;
XFixesQueryVersion(data->display,
&major_version,
&minor_version);
/* Only XFixes v 2 or greater
* Required for XFixesSetPictureClipRegion() */
if(major_version >= 2)
data->use_xdamage = SDL_TRUE;
}
}
#endif
/* Find the PictFormat from the visual.
Expand Down
16 changes: 16 additions & 0 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -252,6 +252,22 @@ SDL_X11_SYM(void,XRenderSetPictureTransform,(Display *dpy,Picture picture,XTrans
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)
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)
#endif

#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
SDL_X11_MODULE(XDAMAGE)
SDL_X11_SYM(Bool,XDamageQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return)
SDL_X11_SYM(Damage,XDamageCreate,(Display *dpy,Drawable d,int level),(dpy,d,level),return)
SDL_X11_SYM(void,XDamageSubtract,(Display *dpy,Damage damage,XserverRegion repair,XserverRegion parts),(dpy,damage,repair,parts),return)
SDL_X11_SYM(void,XDamageDestroy,(Display *dpy,Damage damage),(dpy,damage),return)
#endif

#ifdef SDL_VIDEO_DRIVER_X11_XFIXES
SDL_X11_MODULE(XFIXES)
SDL_X11_SYM(Bool,XFixesQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return)
SDL_X11_SYM(Status,XFixesQueryVersion,(Display *dpy,int *major,int *minor),(dpy,major,minor),return)
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)
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)
#endif
/* *INDENT-ON* */

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit ebd50fe

Please sign in to comment.