Added support for the Xcursor library for color cursors
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Mar 2011 13:56:53 -0800
changeset 5471179adad3ae6f
parent 5470 8f5e10ec4faf
child 5472 674d45edfaeb
Added support for the Xcursor library for color cursors
configure
configure.in
include/SDL_config.h.in
src/video/x11/SDL_x11dyn.c
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11mouse.c
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.h
     1.1 --- a/configure	Fri Mar 11 13:27:25 2011 -0800
     1.2 +++ b/configure	Fri Mar 11 13:56:53 2011 -0800
     1.3 @@ -1537,6 +1537,8 @@
     1.4    --enable-dummyaudio     support the dummy audio driver [default=yes]
     1.5    --enable-video-x11      use X11 video driver [default=yes]
     1.6    --enable-x11-shared     dynamically load X11 support [default=maybe]
     1.7 +  --enable-video-x11-xcursor
     1.8 +                          enable X11 Xcursor support [default=yes]
     1.9    --enable-video-x11-xinerama
    1.10                            enable X11 Xinerama support [default=yes]
    1.11    --enable-video-x11-xinput
    1.12 @@ -3769,13 +3771,13 @@
    1.13  else
    1.14    lt_cv_nm_interface="BSD nm"
    1.15    echo "int some_variable = 0;" > conftest.$ac_ext
    1.16 -  (eval echo "\"\$as_me:3772: $ac_compile\"" >&5)
    1.17 +  (eval echo "\"\$as_me:3774: $ac_compile\"" >&5)
    1.18    (eval "$ac_compile" 2>conftest.err)
    1.19    cat conftest.err >&5
    1.20 -  (eval echo "\"\$as_me:3775: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
    1.21 +  (eval echo "\"\$as_me:3777: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
    1.22    (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
    1.23    cat conftest.err >&5
    1.24 -  (eval echo "\"\$as_me:3778: output\"" >&5)
    1.25 +  (eval echo "\"\$as_me:3780: output\"" >&5)
    1.26    cat conftest.out >&5
    1.27    if $GREP 'External.*some_variable' conftest.out > /dev/null; then
    1.28      lt_cv_nm_interface="MS dumpbin"
    1.29 @@ -5002,7 +5004,7 @@
    1.30    ;;
    1.31  *-*-irix6*)
    1.32    # Find out which ABI we are using.
    1.33 -  echo '#line 5005 "configure"' > conftest.$ac_ext
    1.34 +  echo '#line 5007 "configure"' > conftest.$ac_ext
    1.35    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
    1.36    (eval $ac_compile) 2>&5
    1.37    ac_status=$?
    1.38 @@ -6118,7 +6120,7 @@
    1.39  else
    1.40    ac_cv_header_stdc=no
    1.41  fi
    1.42 -rm -f -r conftest*
    1.43 +rm -f conftest*
    1.44  
    1.45  fi
    1.46  
    1.47 @@ -6139,7 +6141,7 @@
    1.48  else
    1.49    ac_cv_header_stdc=no
    1.50  fi
    1.51 -rm -f -r conftest*
    1.52 +rm -f conftest*
    1.53  
    1.54  fi
    1.55  
    1.56 @@ -7163,11 +7165,11 @@
    1.57     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    1.58     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1.59     -e 's:$: $lt_compiler_flag:'`
    1.60 -   (eval echo "\"\$as_me:7166: $lt_compile\"" >&5)
    1.61 +   (eval echo "\"\$as_me:7168: $lt_compile\"" >&5)
    1.62     (eval "$lt_compile" 2>conftest.err)
    1.63     ac_status=$?
    1.64     cat conftest.err >&5
    1.65 -   echo "$as_me:7170: \$? = $ac_status" >&5
    1.66 +   echo "$as_me:7172: \$? = $ac_status" >&5
    1.67     if (exit $ac_status) && test -s "$ac_outfile"; then
    1.68       # The compiler can only warn and ignore the option if not recognized
    1.69       # So say no if there are warnings other than the usual output.
    1.70 @@ -7502,11 +7504,11 @@
    1.71     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    1.72     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1.73     -e 's:$: $lt_compiler_flag:'`
    1.74 -   (eval echo "\"\$as_me:7505: $lt_compile\"" >&5)
    1.75 +   (eval echo "\"\$as_me:7507: $lt_compile\"" >&5)
    1.76     (eval "$lt_compile" 2>conftest.err)
    1.77     ac_status=$?
    1.78     cat conftest.err >&5
    1.79 -   echo "$as_me:7509: \$? = $ac_status" >&5
    1.80 +   echo "$as_me:7511: \$? = $ac_status" >&5
    1.81     if (exit $ac_status) && test -s "$ac_outfile"; then
    1.82       # The compiler can only warn and ignore the option if not recognized
    1.83       # So say no if there are warnings other than the usual output.
    1.84 @@ -7607,11 +7609,11 @@
    1.85     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    1.86     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1.87     -e 's:$: $lt_compiler_flag:'`
    1.88 -   (eval echo "\"\$as_me:7610: $lt_compile\"" >&5)
    1.89 +   (eval echo "\"\$as_me:7612: $lt_compile\"" >&5)
    1.90     (eval "$lt_compile" 2>out/conftest.err)
    1.91     ac_status=$?
    1.92     cat out/conftest.err >&5
    1.93 -   echo "$as_me:7614: \$? = $ac_status" >&5
    1.94 +   echo "$as_me:7616: \$? = $ac_status" >&5
    1.95     if (exit $ac_status) && test -s out/conftest2.$ac_objext
    1.96     then
    1.97       # The compiler can only warn and ignore the option if not recognized
    1.98 @@ -7662,11 +7664,11 @@
    1.99     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
   1.100     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
   1.101     -e 's:$: $lt_compiler_flag:'`
   1.102 -   (eval echo "\"\$as_me:7665: $lt_compile\"" >&5)
   1.103 +   (eval echo "\"\$as_me:7667: $lt_compile\"" >&5)
   1.104     (eval "$lt_compile" 2>out/conftest.err)
   1.105     ac_status=$?
   1.106     cat out/conftest.err >&5
   1.107 -   echo "$as_me:7669: \$? = $ac_status" >&5
   1.108 +   echo "$as_me:7671: \$? = $ac_status" >&5
   1.109     if (exit $ac_status) && test -s out/conftest2.$ac_objext
   1.110     then
   1.111       # The compiler can only warn and ignore the option if not recognized
   1.112 @@ -10420,7 +10422,7 @@
   1.113    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   1.114    lt_status=$lt_dlunknown
   1.115    cat > conftest.$ac_ext <<_LT_EOF
   1.116 -#line 10423 "configure"
   1.117 +#line 10425 "configure"
   1.118  #include "confdefs.h"
   1.119  
   1.120  #if HAVE_DLFCN_H
   1.121 @@ -10516,7 +10518,7 @@
   1.122    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   1.123    lt_status=$lt_dlunknown
   1.124    cat > conftest.$ac_ext <<_LT_EOF
   1.125 -#line 10519 "configure"
   1.126 +#line 10521 "configure"
   1.127  #include "confdefs.h"
   1.128  
   1.129  #if HAVE_DLFCN_H
   1.130 @@ -14198,11 +14200,11 @@
   1.131     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
   1.132     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
   1.133     -e 's:$: $lt_compiler_flag:'`
   1.134 -   (eval echo "\"\$as_me:14201: $lt_compile\"" >&5)
   1.135 +   (eval echo "\"\$as_me:14203: $lt_compile\"" >&5)
   1.136     (eval "$lt_compile" 2>conftest.err)
   1.137     ac_status=$?
   1.138     cat conftest.err >&5
   1.139 -   echo "$as_me:14205: \$? = $ac_status" >&5
   1.140 +   echo "$as_me:14207: \$? = $ac_status" >&5
   1.141     if (exit $ac_status) && test -s "$ac_outfile"; then
   1.142       # The compiler can only warn and ignore the option if not recognized
   1.143       # So say no if there are warnings other than the usual output.
   1.144 @@ -14297,11 +14299,11 @@
   1.145     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
   1.146     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
   1.147     -e 's:$: $lt_compiler_flag:'`
   1.148 -   (eval echo "\"\$as_me:14300: $lt_compile\"" >&5)
   1.149 +   (eval echo "\"\$as_me:14302: $lt_compile\"" >&5)
   1.150     (eval "$lt_compile" 2>out/conftest.err)
   1.151     ac_status=$?
   1.152     cat out/conftest.err >&5
   1.153 -   echo "$as_me:14304: \$? = $ac_status" >&5
   1.154 +   echo "$as_me:14306: \$? = $ac_status" >&5
   1.155     if (exit $ac_status) && test -s out/conftest2.$ac_objext
   1.156     then
   1.157       # The compiler can only warn and ignore the option if not recognized
   1.158 @@ -14349,11 +14351,11 @@
   1.159     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
   1.160     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
   1.161     -e 's:$: $lt_compiler_flag:'`
   1.162 -   (eval echo "\"\$as_me:14352: $lt_compile\"" >&5)
   1.163 +   (eval echo "\"\$as_me:14354: $lt_compile\"" >&5)
   1.164     (eval "$lt_compile" 2>out/conftest.err)
   1.165     ac_status=$?
   1.166     cat out/conftest.err >&5
   1.167 -   echo "$as_me:14356: \$? = $ac_status" >&5
   1.168 +   echo "$as_me:14358: \$? = $ac_status" >&5
   1.169     if (exit $ac_status) && test -s out/conftest2.$ac_objext
   1.170     then
   1.171       # The compiler can only warn and ignore the option if not recognized
   1.172 @@ -15962,7 +15964,7 @@
   1.173  else
   1.174    ac_cv_header_stdc=no
   1.175  fi
   1.176 -rm -f -r conftest*
   1.177 +rm -f conftest*
   1.178  
   1.179  fi
   1.180  
   1.181 @@ -15983,7 +15985,7 @@
   1.182  else
   1.183    ac_cv_header_stdc=no
   1.184  fi
   1.185 -rm -f -r conftest*
   1.186 +rm -f conftest*
   1.187  
   1.188  fi
   1.189  
   1.190 @@ -16374,7 +16376,7 @@
   1.191  else
   1.192    ac_cv_define_M_PI=no
   1.193  fi
   1.194 -rm -f -r conftest*
   1.195 +rm -f conftest*
   1.196  
   1.197  
   1.198  fi
   1.199 @@ -16571,7 +16573,7 @@
   1.200  else
   1.201    ac_cv_os_cray=no
   1.202  fi
   1.203 -rm -f -r conftest*
   1.204 +rm -f conftest*
   1.205  
   1.206  fi
   1.207  { echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
   1.208 @@ -22639,7 +22641,7 @@
   1.209        eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
   1.210      done
   1.211      # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
   1.212 -    for ac_extension in a so sl dylib la dll; do
   1.213 +    for ac_extension in a so sl; do
   1.214        if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
   1.215  	 test -f "$ac_im_libdir/libX11.$ac_extension"; then
   1.216  	ac_im_usrlibdir=$ac_im_libdir; break
   1.217 @@ -22792,7 +22794,7 @@
   1.218  for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
   1.219  do
   1.220    # Don't even attempt the hair of trying to link an X program!
   1.221 -  for ac_extension in a so sl dylib la dll; do
   1.222 +  for ac_extension in a so sl; do
   1.223      if test -r "$ac_dir/libX11.$ac_extension"; then
   1.224        ac_x_libraries=$ac_dir
   1.225        break 2
   1.226 @@ -23928,10 +23930,11 @@
   1.227  
   1.228  
   1.229              case "$host" in
   1.230 -                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
   1.231 +                *-*-darwin*)
   1.232                      x11_symbols_private=yes
   1.233                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
   1.234                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
   1.235 +                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
   1.236                      xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
   1.237                      xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
   1.238                      xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
   1.239 @@ -23942,6 +23945,7 @@
   1.240                  *)
   1.241                      x11_lib=`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.242                      x11ext_lib=`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.243 +                    xcursor_lib=`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.244                      xinerama_lib=`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.245                      xinput_lib=`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.246                      xrandr_lib=`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
   1.247 @@ -23998,6 +24002,154 @@
   1.248              fi
   1.249              have_video=yes
   1.250  
   1.251 +            # Check whether --enable-video-x11-xcursor was given.
   1.252 +if test "${enable_video_x11_xcursor+set}" = set; then
   1.253 +  enableval=$enable_video_x11_xcursor;
   1.254 +else
   1.255 +  enable_video_x11_xcursor=yes
   1.256 +fi
   1.257 +
   1.258 +            if test x$enable_video_x11_xcursor = xyes; then
   1.259 +                definitely_enable_video_x11_xcursor=no
   1.260 +                { echo "$as_me:$LINENO: checking for X11/Xcursor/Xcursor.h" >&5
   1.261 +echo $ECHO_N "checking for X11/Xcursor/Xcursor.h... $ECHO_C" >&6; }
   1.262 +if test "${ac_cv_header_X11_Xcursor_Xcursor_h+set}" = set; then
   1.263 +  echo $ECHO_N "(cached) $ECHO_C" >&6
   1.264 +else
   1.265 +  cat >conftest.$ac_ext <<_ACEOF
   1.266 +/* confdefs.h.  */
   1.267 +_ACEOF
   1.268 +cat confdefs.h >>conftest.$ac_ext
   1.269 +cat >>conftest.$ac_ext <<_ACEOF
   1.270 +/* end confdefs.h.  */
   1.271 +#include <X11/Xlib.h>
   1.272 +
   1.273 +
   1.274 +#include <X11/Xcursor/Xcursor.h>
   1.275 +_ACEOF
   1.276 +rm -f conftest.$ac_objext
   1.277 +if { (ac_try="$ac_compile"
   1.278 +case "(($ac_try" in
   1.279 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.280 +  *) ac_try_echo=$ac_try;;
   1.281 +esac
   1.282 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.283 +  (eval "$ac_compile") 2>conftest.er1
   1.284 +  ac_status=$?
   1.285 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.286 +  rm -f conftest.er1
   1.287 +  cat conftest.err >&5
   1.288 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.289 +  (exit $ac_status); } && {
   1.290 +	 test -z "$ac_c_werror_flag" ||
   1.291 +	 test ! -s conftest.err
   1.292 +       } && test -s conftest.$ac_objext; then
   1.293 +  ac_cv_header_X11_Xcursor_Xcursor_h=yes
   1.294 +else
   1.295 +  echo "$as_me: failed program was:" >&5
   1.296 +sed 's/^/| /' conftest.$ac_ext >&5
   1.297 +
   1.298 +	ac_cv_header_X11_Xcursor_Xcursor_h=no
   1.299 +fi
   1.300 +
   1.301 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.302 +fi
   1.303 +{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xcursor_Xcursor_h" >&5
   1.304 +echo "${ECHO_T}$ac_cv_header_X11_Xcursor_Xcursor_h" >&6; }
   1.305 +if test $ac_cv_header_X11_Xcursor_Xcursor_h = yes; then
   1.306 +  have_xcursor_h_hdr=yes
   1.307 +else
   1.308 +  have_xcursor_h_hdr=no
   1.309 +fi
   1.310 +
   1.311 +
   1.312 +                if test x$have_xcursor_h_hdr = xyes; then
   1.313 +                    if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
   1.314 +                        echo "-- dynamic libXcursor -> $xcursor_lib"
   1.315 +                        cat >>confdefs.h <<_ACEOF
   1.316 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "$xcursor_lib"
   1.317 +_ACEOF
   1.318 +
   1.319 +                        definitely_enable_video_x11_xcursor=yes
   1.320 +                    else
   1.321 +                        { echo "$as_me:$LINENO: checking for XcursorImageCreate in -lXcursor" >&5
   1.322 +echo $ECHO_N "checking for XcursorImageCreate in -lXcursor... $ECHO_C" >&6; }
   1.323 +if test "${ac_cv_lib_Xcursor_XcursorImageCreate+set}" = set; then
   1.324 +  echo $ECHO_N "(cached) $ECHO_C" >&6
   1.325 +else
   1.326 +  ac_check_lib_save_LIBS=$LIBS
   1.327 +LIBS="-lXcursor  $LIBS"
   1.328 +cat >conftest.$ac_ext <<_ACEOF
   1.329 +/* confdefs.h.  */
   1.330 +_ACEOF
   1.331 +cat confdefs.h >>conftest.$ac_ext
   1.332 +cat >>conftest.$ac_ext <<_ACEOF
   1.333 +/* end confdefs.h.  */
   1.334 +
   1.335 +/* Override any GCC internal prototype to avoid an error.
   1.336 +   Use char because int might match the return type of a GCC
   1.337 +   builtin and then its argument prototype would still apply.  */
   1.338 +#ifdef __cplusplus
   1.339 +extern "C"
   1.340 +#endif
   1.341 +char XcursorImageCreate ();
   1.342 +int
   1.343 +main ()
   1.344 +{
   1.345 +return XcursorImageCreate ();
   1.346 +  ;
   1.347 +  return 0;
   1.348 +}
   1.349 +_ACEOF
   1.350 +rm -f conftest.$ac_objext conftest$ac_exeext
   1.351 +if { (ac_try="$ac_link"
   1.352 +case "(($ac_try" in
   1.353 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.354 +  *) ac_try_echo=$ac_try;;
   1.355 +esac
   1.356 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   1.357 +  (eval "$ac_link") 2>conftest.er1
   1.358 +  ac_status=$?
   1.359 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.360 +  rm -f conftest.er1
   1.361 +  cat conftest.err >&5
   1.362 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.363 +  (exit $ac_status); } && {
   1.364 +	 test -z "$ac_c_werror_flag" ||
   1.365 +	 test ! -s conftest.err
   1.366 +       } && test -s conftest$ac_exeext &&
   1.367 +       $as_test_x conftest$ac_exeext; then
   1.368 +  ac_cv_lib_Xcursor_XcursorImageCreate=yes
   1.369 +else
   1.370 +  echo "$as_me: failed program was:" >&5
   1.371 +sed 's/^/| /' conftest.$ac_ext >&5
   1.372 +
   1.373 +	ac_cv_lib_Xcursor_XcursorImageCreate=no
   1.374 +fi
   1.375 +
   1.376 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
   1.377 +      conftest$ac_exeext conftest.$ac_ext
   1.378 +LIBS=$ac_check_lib_save_LIBS
   1.379 +fi
   1.380 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xcursor_XcursorImageCreate" >&5
   1.381 +echo "${ECHO_T}$ac_cv_lib_Xcursor_XcursorImageCreate" >&6; }
   1.382 +if test $ac_cv_lib_Xcursor_XcursorImageCreate = yes; then
   1.383 +  have_xcursor_lib=yes
   1.384 +fi
   1.385 +
   1.386 +                        if test x$have_xcursor_lib = xyes ; then
   1.387 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
   1.388 +                            definitely_enable_video_x11_xcursor=yes
   1.389 +                        fi
   1.390 +                    fi
   1.391 +                fi
   1.392 +            fi
   1.393 +            if test x$definitely_enable_video_x11_xcursor = xyes; then
   1.394 +                cat >>confdefs.h <<\_ACEOF
   1.395 +#define SDL_VIDEO_DRIVER_X11_XCURSOR 1
   1.396 +_ACEOF
   1.397 +
   1.398 +            fi
   1.399              # Check whether --enable-video-x11-xinerama was given.
   1.400  if test "${enable_video_x11_xinerama+set}" = set; then
   1.401    enableval=$enable_video_x11_xinerama;
     2.1 --- a/configure.in	Fri Mar 11 13:27:25 2011 -0800
     2.2 +++ b/configure.in	Fri Mar 11 13:56:53 2011 -0800
     2.3 @@ -1023,10 +1023,11 @@
     2.4                            , enable_x11_shared=maybe)
     2.5  
     2.6              case "$host" in
     2.7 -                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
     2.8 +                *-*-darwin*)
     2.9                      x11_symbols_private=yes
    2.10                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
    2.11                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
    2.12 +                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
    2.13                      xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
    2.14                      xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
    2.15                      xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
    2.16 @@ -1037,6 +1038,7 @@
    2.17                  *)
    2.18                      x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.19                      x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.20 +                    xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.21                      xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.22                      xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.23                      xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
    2.24 @@ -1082,6 +1084,33 @@
    2.25              fi
    2.26              have_video=yes
    2.27  
    2.28 +            AC_ARG_ENABLE(video-x11-xcursor,
    2.29 +AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
    2.30 +                            , enable_video_x11_xcursor=yes)
    2.31 +            if test x$enable_video_x11_xcursor = xyes; then
    2.32 +                definitely_enable_video_x11_xcursor=no
    2.33 +                AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
    2.34 +                                have_xcursor_h_hdr=yes,
    2.35 +                                have_xcursor_h_hdr=no,
    2.36 +                                [#include <X11/Xlib.h>
    2.37 +                                ])
    2.38 +                if test x$have_xcursor_h_hdr = xyes; then
    2.39 +                    if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
    2.40 +                        echo "-- dynamic libXcursor -> $xcursor_lib"
    2.41 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib")
    2.42 +                        definitely_enable_video_x11_xcursor=yes
    2.43 +                    else
    2.44 +                        AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
    2.45 +                        if test x$have_xcursor_lib = xyes ; then
    2.46 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
    2.47 +                            definitely_enable_video_x11_xcursor=yes
    2.48 +                        fi
    2.49 +                    fi
    2.50 +                fi
    2.51 +            fi
    2.52 +            if test x$definitely_enable_video_x11_xcursor = xyes; then
    2.53 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR)
    2.54 +            fi
    2.55              AC_ARG_ENABLE(video-x11-xinerama,
    2.56  AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
    2.57                              , enable_video_x11_xinerama=yes)
     3.1 --- a/include/SDL_config.h.in	Fri Mar 11 13:27:25 2011 -0800
     3.2 +++ b/include/SDL_config.h.in	Fri Mar 11 13:56:53 2011 -0800
     3.3 @@ -265,11 +265,13 @@
     3.4  #undef SDL_VIDEO_DRIVER_X11
     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_XCURSOR
     3.8  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
     3.9  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
    3.10  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
    3.11  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
    3.12  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
    3.13 +#undef SDL_VIDEO_DRIVER_X11_XCURSOR
    3.14  #undef SDL_VIDEO_DRIVER_X11_XINERAMA
    3.15  #undef SDL_VIDEO_DRIVER_X11_XINPUT
    3.16  #undef SDL_VIDEO_DRIVER_X11_XRANDR
     4.1 --- a/src/video/x11/SDL_x11dyn.c	Fri Mar 11 13:27:25 2011 -0800
     4.2 +++ b/src/video/x11/SDL_x11dyn.c	Fri Mar 11 13:56:53 2011 -0800
     4.3 @@ -46,6 +46,9 @@
     4.4  #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
     4.5  #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL
     4.6  #endif
     4.7 +#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
     4.8 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL
     4.9 +#endif
    4.10  #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
    4.11  #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA NULL
    4.12  #endif
    4.13 @@ -65,6 +68,7 @@
    4.14  static x11dynlib x11libs[] = {
    4.15      {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC},
    4.16      {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT},
    4.17 +    {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR},
    4.18      {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA},
    4.19      {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT},
    4.20      {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR},
     5.1 --- a/src/video/x11/SDL_x11dyn.h	Fri Mar 11 13:27:25 2011 -0800
     5.2 +++ b/src/video/x11/SDL_x11dyn.h	Fri Mar 11 13:56:53 2011 -0800
     5.3 @@ -44,6 +44,9 @@
     5.4  #include <X11/extensions/XShm.h>
     5.5  #endif
     5.6  
     5.7 +#if SDL_VIDEO_DRIVER_X11_XCURSOR
     5.8 +#include <X11/Xcursor/Xcursor.h>
     5.9 +#endif
    5.10  #if SDL_VIDEO_DRIVER_X11_XINERAMA
    5.11  #include <X11/extensions/Xinerama.h>
    5.12  #endif
     6.1 --- a/src/video/x11/SDL_x11mouse.c	Fri Mar 11 13:27:25 2011 -0800
     6.2 +++ b/src/video/x11/SDL_x11mouse.c	Fri Mar 11 13:56:53 2011 -0800
     6.3 @@ -20,6 +20,8 @@
     6.4      slouken@libsdl.org
     6.5  */
     6.6  #include "SDL_config.h"
     6.7 +
     6.8 +#include "SDL_assert.h"
     6.9  #include "SDL_x11video.h"
    6.10  #include "SDL_x11mouse.h"
    6.11  #include "../../events/SDL_mouse_c.h"
    6.12 @@ -81,6 +83,35 @@
    6.13      return cursor;
    6.14  }
    6.15  
    6.16 +#if SDL_VIDEO_DRIVER_X11_XCURSOR
    6.17 +static Cursor
    6.18 +X11_CreateXCursorCursor(SDL_Surface * surface, int hot_x, int hot_y)
    6.19 +{
    6.20 +    Display *display = GetDisplay();
    6.21 +    Cursor cursor = None;
    6.22 +    XcursorImage *image;
    6.23 +
    6.24 +    image = XcursorImageCreate(surface->w, surface->h);
    6.25 +    if (!image) {
    6.26 +        SDL_OutOfMemory();
    6.27 +        return None;
    6.28 +    }
    6.29 +    image->xhot = hot_x;
    6.30 +    image->yhot = hot_y;
    6.31 +    image->delay = 0;
    6.32 +
    6.33 +    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
    6.34 +    SDL_assert(surface->pitch == surface->w * 4);
    6.35 +    SDL_memcpy(image->pixels, surface->pixels, surface->h * surface->pitch);
    6.36 +
    6.37 +    cursor = XcursorImageLoadCursor(display, image);
    6.38 +
    6.39 +    XcursorImageDestroy(image);
    6.40 +
    6.41 +    return cursor;
    6.42 +}
    6.43 +#endif /* SDL_VIDEO_DRIVER_X11_XCURSOR */
    6.44 +
    6.45  static Cursor
    6.46  X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
    6.47  {
    6.48 @@ -101,6 +132,9 @@
    6.49          return None;
    6.50      }
    6.51  
    6.52 +    /* Code below assumes ARGB pixel format */
    6.53 +    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
    6.54 +
    6.55      rfg = gfg = bfg = rbg = gbg = bbg = fgBits = 0;
    6.56      for (y = 0; y < surface->h; ++y) {
    6.57          ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
    6.58 @@ -162,7 +196,17 @@
    6.59  
    6.60      cursor = SDL_calloc(1, sizeof(*cursor));
    6.61      if (cursor) {
    6.62 -        cursor->driverdata = (void*)X11_CreatePixmapCursor(surface, hot_x, hot_y);
    6.63 +        Cursor x11_cursor = None;
    6.64 +
    6.65 +#if SDL_VIDEO_DRIVER_X11_XCURSOR
    6.66 +        if (SDL_X11_HAVE_XCURSOR) {
    6.67 +            x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y);
    6.68 +        }
    6.69 +#endif
    6.70 +        if (x11_cursor == None) {
    6.71 +            x11_cursor = X11_CreatePixmapCursor(surface, hot_x, hot_y);
    6.72 +        }
    6.73 +        cursor->driverdata = (void*)x11_cursor;
    6.74      } else {
    6.75          SDL_OutOfMemory();
    6.76      }
     7.1 --- a/src/video/x11/SDL_x11sym.h	Fri Mar 11 13:27:25 2011 -0800
     7.2 +++ b/src/video/x11/SDL_x11sym.h	Fri Mar 11 13:56:53 2011 -0800
     7.3 @@ -175,6 +175,14 @@
     7.4  SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return)
     7.5  #endif
     7.6  
     7.7 +/* XCursor support */
     7.8 +#if SDL_VIDEO_DRIVER_X11_XCURSOR
     7.9 +SDL_X11_MODULE(XCURSOR)
    7.10 +SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),)
    7.11 +SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),)
    7.12 +SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),)
    7.13 +#endif
    7.14 +
    7.15  /* Xinerama support */
    7.16  #if SDL_VIDEO_DRIVER_X11_XINERAMA
    7.17  SDL_X11_MODULE(XINERAMA)
     8.1 --- a/src/video/x11/SDL_x11video.h	Fri Mar 11 13:27:25 2011 -0800
     8.2 +++ b/src/video/x11/SDL_x11video.h	Fri Mar 11 13:56:53 2011 -0800
     8.3 @@ -32,6 +32,9 @@
     8.4  #include <X11/Xutil.h>
     8.5  #include <X11/Xatom.h>
     8.6  
     8.7 +#if SDL_VIDEO_DRIVER_X11_XCURSOR
     8.8 +#include <X11/Xcursor/Xcursor.h>
     8.9 +#endif
    8.10  #if SDL_VIDEO_DRIVER_X11_XINERAMA
    8.11  #include <X11/extensions/Xinerama.h>
    8.12  #endif