changeset 1657:5b0805ceb50f SDL-1.3

Merge trunk-1.3-2
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Apr 2006 16:55:41 +0000
parents 96c2f89cc7e1
children e49147870aac
files build-scripts/fatbuild.sh configure.in include/SDL_config_macosx.h src/video/x11/SDL_x11events.c src/video/x11/SDL_x11mouse.c
diffstat 5 files changed, 60 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/build-scripts/fatbuild.sh	Thu Apr 27 09:09:48 2006 +0000
+++ b/build-scripts/fatbuild.sh	Fri Apr 28 16:55:41 2006 +0000
@@ -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 @@
 -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 @@
 # 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 @@
     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 @@
 #
 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 @@
 #
 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 @@
         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
+
--- a/configure.in	Thu Apr 27 09:09:48 2006 +0000
+++ b/configure.in	Fri Apr 28 16:55:41 2006 +0000
@@ -52,6 +52,11 @@
 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 @@
         # use here or in sdl-config. Hence we reset it.
         EXTRA_LDFLAGS=""
 
+        CheckVisibilityHidden
         CheckDummyVideo
         CheckDiskAudio
         CheckDummyAudio
--- a/include/SDL_config_macosx.h	Thu Apr 27 09:09:48 2006 +0000
+++ b/include/SDL_config_macosx.h	Fri Apr 28 16:55:41 2006 +0000
@@ -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
--- a/src/video/x11/SDL_x11events.c	Thu Apr 27 09:09:48 2006 +0000
+++ b/src/video/x11/SDL_x11events.c	Fri Apr 28 16:55:41 2006 +0000
@@ -666,7 +666,7 @@
 			} 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;
--- a/src/video/x11/SDL_x11mouse.c	Thu Apr 27 09:09:48 2006 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Fri Apr 28 16:55:41 2006 +0000
@@ -226,6 +226,7 @@
 /* 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 @@
 	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) ) {