From 151966fa603aab94ac3c7072596144e2ce01b17e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 28 Apr 2006 16:55:41 +0000 Subject: [PATCH] Merge trunk-1.3-2 --- build-scripts/fatbuild.sh | 55 +++++++++++++++++++++++++++++------ configure.in | 6 ++++ include/SDL_config_macosx.h | 5 ++++ src/video/x11/SDL_x11events.c | 2 +- src/video/x11/SDL_x11mouse.c | 3 +- 5 files changed, 60 insertions(+), 11 deletions(-) diff --git a/build-scripts/fatbuild.sh b/build-scripts/fatbuild.sh index 729f441ef..b7bf30735 100755 --- a/build-scripts/fatbuild.sh +++ b/build-scripts/fatbuild.sh @@ -2,9 +2,18 @@ # # Build a fat binary on Mac OS X, thanks Ryan! +# Number of CPUs (for make -j) +NCPU=`sysctl -n hw.ncpu` +NJOB=$NCPU +#NJOB=`expr $NCPU + 1` + +# Generic, cross-platform CFLAGS you always want go here. +CFLAGS="-O3 -g -pipe" + # PowerPC compiler flags (10.2 runtime compatibility) -CC_PPC="gcc-3.3" -CFLAGS_PPC="-arch ppc" +CC_PPC="gcc-3.3 -arch ppc" +CXX_PPC="g++-3.3 -arch ppc" +CFLAGS_PPC="" CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ -nostdinc \ -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ @@ -18,8 +27,9 @@ LFLAGS_PPC="-arch ppc \ -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" # Intel compiler flags (10.4 runtime compatibility) -CC_X86="gcc-4.0" -CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4" +CC_X86="gcc-4.0 -arch i386" +CXX_X86="g++-4.0 -arch i386" +CFLAGS_X86="-mmacosx-version-min=10.4" CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ -nostdinc \ -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \ @@ -44,6 +54,7 @@ cd $srcdir # configure, configure-ppc, configure-x86, # make, make-ppc, make-x86, merge # install +# clean if test x"$1" = x; then phase=all else @@ -103,8 +114,18 @@ case $phase in install-man) install_man="yes" ;; + clean) + clean_ppc="yes" + clean_x86="yes" + ;; + clean-ppc) + clean_ppc="yes" + ;; + clean-x86) + clean_x86="yes" + ;; *) - echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge]" + echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]" exit 1 ;; esac @@ -137,10 +158,10 @@ done # if test x$configure_ppc = xyes; then (cd build/ppc && \ - sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CFLAGS="$CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 + sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 fi if test x$make_ppc = xyes; then - (cd build/ppc && make) || exit 3 + (cd build/ppc && ls include && make -j$NJOB) || exit 3 fi # @@ -148,10 +169,10 @@ fi # if test x$configure_x86 = xyes; then (cd build/x86 && \ - sh ../../configure --build=`uname -p`-apple-darwin --host=i686-apple-darwin CC="$CC_X86" CFLAGS="$CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 + sh ../../configure --build=`uname -p`-apple-darwin --host=i386-apple-darwin CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 fi if test x$make_x86 = xyes; then - (cd build/x86 && make) || exit 3 + (cd build/x86 && make -j$NJOB) || exit 3 fi # @@ -233,3 +254,19 @@ if test x$install_man = xyes; then do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \ done fi + +# +# Clean up +# +do_clean() +{ + echo $* + $* || exit 6 +} +if test x$clean_x86 = xyes; then + do_clean rm -r build/x86 +fi +if test x$clean_ppc = xyes; then + do_clean rm -r build/ppc +fi + diff --git a/configure.in b/configure.in index b69d9846a..2cc19f822 100644 --- a/configure.in +++ b/configure.in @@ -52,6 +52,11 @@ fi dnl Set up the compiler and linker flags INCLUDE="-I$srcdir/include" if test x$srcdir != x.; then + # Remove SDL_config.h from the source directory, since it's the + # default one, and we want to include the one that we generate. + if test -f $srcdir/include/SDL_config.h; then + rm $srcdir/include/SDL_config.h + fi INCLUDE="-Iinclude $INCLUDE" fi case "$host" in @@ -2332,6 +2337,7 @@ case "$host" in # use here or in sdl-config. Hence we reset it. EXTRA_LDFLAGS="" + CheckVisibilityHidden CheckDummyVideo CheckDiskAudio CheckDummyAudio diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h index b4cc8ca4c..5fc332fb1 100644 --- a/include/SDL_config_macosx.h +++ b/include/SDL_config_macosx.h @@ -46,7 +46,12 @@ #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 #define HAVE_FREE 1 + +/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ +#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) #define HAVE_ALLOCA 1 +#endif + #define HAVE_GETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index f43f818e9..dd914c335 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -666,7 +666,7 @@ void X11_PumpEvents(_THIS) } else { switch_time = now + 200; } - } else if ( now >= switch_time ) { + } else if ( (int)(switch_time-now) <= 0 ) { Uint32 go_fullscreen; go_fullscreen = switch_waiting & SDL_FULLSCREEN; diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 8fcebb3ac..c5c30a781 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -226,6 +226,7 @@ static void SetMouseAccel(_THIS, const char *accel_param) /* Check to see if we need to enter or leave mouse relative mode */ void X11_CheckMouseModeNoLock(_THIS) { + const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS); char *env_override; int enable_relative = 1; @@ -242,7 +243,7 @@ void X11_CheckMouseModeNoLock(_THIS) if ( enable_relative && !(SDL_cursorstate & CURSOR_VISIBLE) && (this->input_grab != SDL_GRAB_OFF) && - (SDL_GetAppState() & SDL_APPACTIVE) ) { + (SDL_GetAppState() & full_focus) == full_focus ) { if ( ! mouse_relative ) { X11_EnableDGAMouse(this); if ( ! (using_dga & DGA_MOUSE) ) {