Changes since SDL 1.2.0 release
authorSam Lantinga <slouken@lokigames.com>
Thu, 26 Apr 2001 16:50:19 +0000
changeset 1 cf2af46e9e2a
parent 0 74212992fb08
child 2 836aaee3f39e
Changes since SDL 1.2.0 release
acinclude.m4
configure.in
docs.html
include/SDL_audio.h
include/SDL_byteorder.h
include/SDL_version.h
ltconfig
ltmain.sh
sdl.m4
src/SDL_error.c
src/SDL_fatal.c
src/audio/SDL_audiomem.c
src/audio/SDL_mixer.c
src/audio/dma/SDL_dmaaudio.c
src/audio/dsp/SDL_dspaudio.c
src/cdrom/openbsd/SDL_syscdrom.c
src/timer/SDL_timer.c
src/timer/linux/SDL_systimer.c
src/video/Makefile.am
src/video/SDL_RLEaccel.c
src/video/SDL_blit_A.c
src/video/SDL_cursor.c
src/video/SDL_memops.h
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/bwindow/SDL_BView.h
src/video/bwindow/SDL_BWin.h
src/video/bwindow/SDL_sysevents.cc
src/video/dummy/Makefile.am
src/video/dummy/SDL_nullevents.c
src/video/dummy/SDL_nullevents_c.h
src/video/dummy/SDL_nullmouse.c
src/video/dummy/SDL_nullmouse_c.h
src/video/dummy/SDL_nullvideo.c
src/video/dummy/SDL_nullvideo.h
src/video/svga/SDL_svgavideo.c
src/video/wincommon/SDL_sysevents.c
src/video/windx5/SDL_dx5video.c
strip_fPIC.sh
test/acinclude.m4
--- a/acinclude.m4	Thu Apr 26 16:45:43 2001 +0000
+++ b/acinclude.m4	Thu Apr 26 16:50:19 2001 +0000
@@ -434,7 +434,8 @@
 if test "$ac_cv_prog_gcc" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   AC_MSG_CHECKING([for ld used by GCC])
-  ac_prog=`($CC -print-prog-name=ld | tr -d '\r') 2>&5`
+  DELCR='tr -d \015'
+  ac_prog=`($CC -print-prog-name=ld | $DELCR) 2>&5`
   case "$ac_prog" in
     # Accept absolute paths.
 changequote(,)dnl
--- a/configure.in	Thu Apr 26 16:45:43 2001 +0000
+++ b/configure.in	Thu Apr 26 16:50:19 2001 +0000
@@ -14,9 +14,9 @@
 #
 SDL_MAJOR_VERSION=1
 SDL_MINOR_VERSION=2
-SDL_MICRO_VERSION=0
-SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=0
+SDL_MICRO_VERSION=1
+SDL_INTERFACE_AGE=1
+SDL_BINARY_AGE=1
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
 AC_SUBST(SDL_MAJOR_VERSION)
@@ -251,6 +251,9 @@
           #ifdef __bsdi__
           #include <sys/soundcard.h>
           #endif
+          #ifdef __OpenBSD__
+          #include <soundcard.h>
+          #endif
           #ifdef __USLC__
           #include <sys/soundcard.h>
           #endif
@@ -680,6 +683,19 @@
     fi
 }
 
+dnl rcg04172001 Set up the Null video driver.
+CheckDummyVideo()
+{
+    AC_ARG_ENABLE(video-dummy,
+[  --enable-video-dummy   use dummy video driver [default=no]],
+                  , enable_video_dummy=no)
+    if test x$enable_video_dummy = xyes; then
+      CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
+      VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
+      VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
+    fi
+}
+
 dnl Check to see if OpenGL support is desired
 AC_ARG_ENABLE(video-opengl,
 [  --enable-video-opengl   include OpenGL context creation [default=yes]],
@@ -1012,6 +1028,7 @@
 case "$target" in
     *-*-linux*)
         ARCH=linux
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckALSA
@@ -1076,6 +1093,7 @@
         ;;
     *-*-bsdi*)
         ARCH=bsdi
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckNAS
@@ -1116,6 +1134,7 @@
         ;;
     *-*-freebsd*)
         ARCH=freebsd
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1167,6 +1186,7 @@
         ;;
     *-*-netbsd*)
         ARCH=netbsd
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1199,7 +1219,11 @@
             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
+	    if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
+		COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
+	    else
+		COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
+	    fi
             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
@@ -1213,6 +1237,8 @@
         ;;
     *-*-openbsd*)
         ARCH=openbsd
+        CFLAGS="$CFLAGS -Dunix"
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1261,6 +1287,7 @@
         ;;
     *-*-sysv5*)
         ARCH=sysv5
+        CheckDummyVideo
         CheckNASM
         CheckOSS
         CheckARTSC
@@ -1306,6 +1333,8 @@
         ;;
     *-*-solaris*)
         ARCH=solaris
+        CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
+        CheckDummyVideo
         CheckNASM
         CheckARTSC
         CheckESD
@@ -1350,6 +1379,7 @@
         ;;
     *-*-irix*)
         ARCH=irix
+        CheckDummyVideo
         CheckNAS
         CheckX11
         CheckAAlib
@@ -1407,6 +1437,7 @@
         ;;
     *-*-hpux*)
         ARCH=hpux
+        CheckDummyVideo
         CheckNAS
         CheckX11
         CheckGGI
@@ -1449,6 +1480,7 @@
         ;;
     *-*-aix*)
         ARCH=aix
+        CheckDummyVideo
         CheckNAS
         CheckX11
         CheckGGI
@@ -1490,6 +1522,7 @@
         ;;
     *-*-osf*)
         ARCH=osf
+        CheckDummyVideo
         CheckNAS
         CheckX11
         CheckGGI
@@ -1532,6 +1565,7 @@
         ;;
     *-*-qnx*)
         ARCH=qnx
+        CheckDummyVideo
         CheckNAS
         CheckPHOTON
         CheckX11
@@ -1581,8 +1615,11 @@
             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
         else
             # Look for the location of the tools and install there
-            ac_default_prefix=$BUILD_PREFIX
+            if [ "$BUILD_PREFIX" != "" ]; then
+                ac_default_prefix=$BUILD_PREFIX
+            fi
         fi
+        CheckDummyVideo
         CheckWIN32
         CheckDIRECTX
         CheckNASM
@@ -1623,11 +1660,22 @@
         fi
         # The Win32 platform requires special setup
         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
-        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
+        case "$target" in
+            *-*-cygwin*)
+                CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
+                SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
+                LIBS="$LIBS -mno-cygwin"
+                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
+                ;;
+            *-*-mingw32*)
+                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
+                ;;
+        esac
         ;;
     *-*-beos*)
         ARCH=beos
         ac_default_prefix=/boot/develop/tools/gnupro
+        CheckDummyVideo
         CheckNASM
         CheckBWINDOW
         CheckBeGL
@@ -1672,6 +1720,7 @@
         # use it at present, but Apple is working on a X-to-9 compiler
         # for which this case would be handy.
         ARCH=macos
+        CheckDummyVideo
         CheckTOOLBOX
         CheckMacGL
         # Set up files for the main() stub
@@ -1714,6 +1763,7 @@
         # just the OS X kernel sans upper layers like Carbon.  But
         # config.guess comes back with "darwin", so go with the flow.
         ARCH=macos
+        CheckDummyVideo
         CheckCARBON
         CheckMacGL
         CheckPTHREAD
@@ -1790,6 +1840,10 @@
   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
 fi
 
+if test $ARCH = openbsd; then
+  SDL_RLD_FLAGS="-Wl,-R\${exec_prefix}/lib -Wl,-R\${X11BASE}/lib"
+fi
+
 dnl Output the video drivers we use
 if test x$enable_video = xtrue; then
     if test "$VIDEO_SUBDIRS" = ""; then
@@ -1873,6 +1927,7 @@
 src/video/windx5/Makefile
 src/video/bwindow/Makefile
 src/video/photon/Makefile
+src/video/dummy/Makefile
 src/events/Makefile
 src/joystick/Makefile
 src/joystick/beos/Makefile
--- a/docs.html	Thu Apr 26 16:45:43 2001 +0000
+++ b/docs.html	Thu Apr 26 16:50:19 2001 +0000
@@ -16,6 +16,9 @@
 Major changes since SDL 1.0.0:
 </H2>
 <UL>
+	<LI> 1.2.1: Added support for building under Cygwin on Windows
+	<LI> 1.2.1: Added a dummy video driver for benchmarking (thanks Ryan!)
+	<LI> 1.2.1: Fixed fullscreen cursor offset bug on BeOS
 	<LI> 1.2.0: Added initial support for HP-UX (thanks Stephanie)
 	<LI> 1.2.0: Added initial support for BSDI (thanks Kurt)
 	<LI> 1.2.0: Fixed blitting 32-bit ARGB images to SDL_OPENGLBLIT screens
--- a/include/SDL_audio.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/include/SDL_audio.h	Thu Apr 26 16:50:19 2001 +0000
@@ -234,7 +234,7 @@
  * This is provided for convenience -- you can mix your own audio data.
  */
 #define SDL_MIX_MAXVOLUME 128
-extern DECLSPEC void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume);
+extern DECLSPEC void SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
 
 /*
  * The lock manipulated by these functions protects the callback function.
--- a/include/SDL_byteorder.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/include/SDL_byteorder.h	Thu Apr 26 16:50:19 2001 +0000
@@ -42,7 +42,8 @@
 #if  defined(__i386__) || defined(WIN32) || \
     (defined(__alpha__) || defined(__alpha)) || \
      defined(__arm__) || \
-    (defined(__mips__) && defined(__MIPSEL__))
+    (defined(__mips__) && defined(__MIPSEL__)) || \
+     defined(__LITTLE_ENDIAN__)
 #define SDL_BYTEORDER	SDL_LIL_ENDIAN
 #else
 #define SDL_BYTEORDER	SDL_BIG_ENDIAN
--- a/include/SDL_version.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/include/SDL_version.h	Thu Apr 26 16:50:19 2001 +0000
@@ -42,7 +42,7 @@
 */
 #define SDL_MAJOR_VERSION	1
 #define SDL_MINOR_VERSION	2
-#define SDL_PATCHLEVEL		0
+#define SDL_PATCHLEVEL		1
 
 typedef struct {
 	Uint8 major;
--- a/ltconfig	Thu Apr 26 16:45:43 2001 +0000
+++ b/ltconfig	Thu Apr 26 16:50:19 2001 +0000
@@ -1105,6 +1105,9 @@
     with_gnu_ld=no
   fi
   ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
 
 esac
 
@@ -1155,6 +1158,12 @@
     ;;
 
   cygwin* | mingw*)
+    # Special flag that tells Cygwin to use the native MSVC runtime
+    case "$host_os" in
+    cygwin*)
+      cygwin_use_msvcrt=true
+      ;;
+    esac
     # hardcode_libdir_flag_spec is actually meaningless, as there is
     # no search path for DLLs.
     hardcode_libdir_flag_spec='-L$libdir'
@@ -1165,13 +1174,40 @@
     # then regenerate the def file from the symbol export list, so that
     # the compiled dll only exports the symbol export list.
     # Be careful not to strip the DATA tag left by newer dlltools.
-    export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+    if [ "$cygwin_use_msvcrt" = "true" ]; then
+      export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -U__CYGWIN__ -U__CYGWIN32__ -c $soname-ltdll.c)~
+      $DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
+    else
+      export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
       test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
       $DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
       sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
+    fi
 
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+    if [ "$cygwin_use_msvcrt" = "true" ]; then
+      archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+      _lt_hint=1;
+      cat $export_symbols | while read symbol; do
+        set dummy \$symbol;
+        case \$# in
+          2) echo "	\$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
+          *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
+        esac;
+	_lt_hint=`expr 1 + \$_lt_hint`;
+      done~
+      test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -U__CYGWIN__ -U__CYGWIN32__ -c $soname-ltdll.c)~
+      $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts -L/usr/lib/mingw -mno-cygwin~
+      : strip_is_broken_with_dlls_on_win95B - strip $lib'
+    else
+      archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
       _lt_hint=1;
       cat $export_symbols | while read symbol; do
         set dummy \$symbol;
@@ -1189,8 +1225,8 @@
       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
       $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
       : strip_is_broken_with_dlls_on_win95B - strip $lib'
-
-      old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
+    fi
+    old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
     ;;
 
   netbsd*)
@@ -1403,10 +1439,21 @@
     ;;
 
   openbsd*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_shlibpath_var=no
+    case "$host_os" in
+      openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+	hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+      *)
+	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
+	hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	 if [ "`/usr/bin/file /usr/lib/libc.so.* | grep ELF`" != "" ]; then
+	   export_dynamic_flag_spec='${wl}-E'
+	 fi
+      ;;
+    esac
     ;;
 
   os2*)
@@ -1883,7 +1930,7 @@
     # See where the system libraries really are - /usr/lib won't cut it
     libuser32=`$CC --print-file-name=libuser32.a`
     win32libs=`expr $libuser32 : '\(.*\)/.*'`
-    sys_lib_search_path_spec="$sys_lib_search_path $win32libs"
+    sys_lib_search_path_spec="$sys_lib_search_path_spec $win32libs"
   fi
   lt_cv_dlopen="LoadLibrary"
   lt_cv_dlopen_libs=
@@ -2030,13 +2077,10 @@
 
 openbsd*)
   version_type=sunos
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-    need_version=no
-  fi
   library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
+  deplibs_check_method='pass_all'
   ;;
 
 os2*)
--- a/ltmain.sh	Thu Apr 26 16:45:43 2001 +0000
+++ b/ltmain.sh	Thu Apr 26 16:50:19 2001 +0000
@@ -1079,7 +1079,18 @@
 	    # These systems don't actually have c library (as such)
 	    continue
 	    ;;
+          *-*-openbsd*)
+            # Do not include libc due to us having libc/libc_r.
+            continue
+            ;;
 	  esac
+        elif test "$arg" = "-lc_r"; then
+          case "$host" in
+          *-*-openbsd*)
+            # Do not include libc_r directly, use -pthread flag.
+            continue
+            ;;
+          esac
 	elif test "$arg" = "-lm"; then
 	  case "$host" in
 	  *-*-cygwin* | *-*-beos*)
@@ -1091,6 +1102,10 @@
 	deplibs="$deplibs $arg"
 	;;
 
+      -?thread)
+        deplibs="$deplibs $arg"
+        ;;
+
       -module)
 	module=yes
 	continue
@@ -1799,6 +1814,9 @@
 	  # rhapsody is a little odd...
 	  deplibs="$deplibs -framework System"
 	  ;;
+	*-*-openbsd*)
+	  # do not include libc due to us having libc/libc_r.
+	  ;;
 	*)
 	  # Add libc to deplibs on all other systems.
 	  deplibs="$deplibs -lc"
--- a/sdl.m4	Thu Apr 26 16:45:43 2001 +0000
+++ b/sdl.m4	Thu Apr 26 16:50:19 2001 +0000
@@ -140,6 +140,11 @@
           AC_TRY_LINK([
 #include <stdio.h>
 #include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef  main
+#define main K_and_R_C_main
 ],      [ return 0; ],
         [ echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding SDL or finding the wrong"
--- a/src/SDL_error.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/SDL_error.c	Thu Apr 26 16:50:19 2001 +0000
@@ -47,6 +47,10 @@
 #define SDL_GetErrBuf()	(&SDL_global_error)
 #endif /* DISABLE_THREADS */
 
+#ifdef __CYGWIN__
+#define DISABLE_STDIO
+#endif
+
 #define SDL_ERRBUFIZE	1024
 
 /* Private functions */
@@ -120,6 +124,7 @@
 	}
 	va_end(ap);
 
+#ifndef DISABLE_STDIO
 	/* If we are in debug mode, print out an error message */
 #ifdef DEBUG_ERROR
 	fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
@@ -128,6 +133,7 @@
 		fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
 	}
 #endif
+#endif /* !DISABLE_STDIO */
 }
 
 /* Print out an integer value to a UNICODE buffer */
--- a/src/SDL_fatal.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/SDL_fatal.c	Thu Apr 26 16:50:19 2001 +0000
@@ -51,46 +51,59 @@
 #include "SDL.h"
 #include "SDL_fatal.h"
 
+#ifdef __CYGWIN__
+#define DISABLE_STDIO
+#endif
+
 /* This installs some signal handlers for the more common fatal signals,
    so that if the programmer is lazy, the app doesn't die so horribly if
    the program crashes.
 */
 
+static void print_msg(const char *text)
+{
+#ifndef DISABLE_STDIO
+	fprintf(stderr, "%s", text);
+#endif
+}
+
 static void SDL_Parachute(int sig)
 {
 	signal(sig, SIG_DFL);
-	fprintf(stderr, "Fatal signal: ");
+	print_msg("Fatal signal: ");
 	switch (sig) {
 		case SIGSEGV:
-			fprintf(stderr, "Segmentation Fault");
+			print_msg("Segmentation Fault");
 			break;
 #ifdef SIGBUS
 #if SIGBUS != SIGSEGV
 		case SIGBUS:
-			fprintf(stderr, "Bus Error");
+			print_msg("Bus Error");
 			break;
 #endif
 #endif /* SIGBUS */
 #ifdef SIGFPE
 		case SIGFPE:
-			fprintf(stderr, "Floating Point Exception");
+			print_msg("Floating Point Exception");
 			break;
 #endif /* SIGFPE */
 #ifdef SIGQUIT
 		case SIGQUIT:
-			fprintf(stderr, "Keyboard Quit");
+			print_msg("Keyboard Quit");
 			break;
 #endif /* SIGQUIT */
 #ifdef SIGPIPE
 		case SIGPIPE:
-			fprintf(stderr, "Broken Pipe");
+			print_msg("Broken Pipe");
 			break;
 #endif /* SIGPIPE */
 		default:
+#ifndef DISABLE_STDIO
 			fprintf(stderr, "# %d", sig);
+#endif
 			break;
 	}
-	fprintf(stderr, " (SDL Parachute Deployed)\n");
+	print_msg(" (SDL Parachute Deployed)\n");
 	SDL_Quit();
 	exit(-sig);
 }
--- a/src/audio/SDL_audiomem.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/audio/SDL_audiomem.c	Thu Apr 26 16:50:19 2001 +0000
@@ -29,13 +29,12 @@
 	(necessary because SDL audio emulates threads with fork()
  */
 
+#include <stdlib.h>
 #ifdef FORK_HACK
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <stddef.h>
-#else
-#include <stdlib.h>
 #endif
 
 #include "SDL_audiomem.h"
--- a/src/audio/SDL_mixer.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/audio/SDL_mixer.c	Thu Apr 26 16:50:19 2001 +0000
@@ -96,7 +96,7 @@
 #define ADJUST_VOLUME(s, v)	(s = (s*v)/SDL_MIX_MAXVOLUME)
 #define ADJUST_VOLUME_U8(s, v)	(s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
 
-void SDL_MixAudio (Uint8 *dst, Uint8 *src, Uint32 len, int volume)
+void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume)
 {
 	Uint16 format;
 
--- a/src/audio/dma/SDL_dmaaudio.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/audio/dma/SDL_dmaaudio.c	Thu Apr 26 16:50:19 2001 +0000
@@ -48,6 +48,9 @@
 #ifdef __FreeBSD__
 #include <machine/soundcard.h>
 #endif
+#ifdef __OpenBSD__
+#include <soundcard.h>
+#endif
 #ifdef __USLC__
 #include <sys/soundcard.h>
 #endif
--- a/src/audio/dsp/SDL_dspaudio.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/audio/dsp/SDL_dspaudio.c	Thu Apr 26 16:50:19 2001 +0000
@@ -46,6 +46,9 @@
 #ifdef __FreeBSD__
 #include <machine/soundcard.h>
 #endif
+#ifdef __OpenBSD__
+#include <soundcard.h>
+#endif
 #ifdef __USLC__
 #include <sys/soundcard.h>
 #endif
--- a/src/cdrom/openbsd/SDL_syscdrom.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/cdrom/openbsd/SDL_syscdrom.c	Thu Apr 26 16:50:19 2001 +0000
@@ -36,6 +36,7 @@
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
+#include <sys/ioctl.h>
 #include <sys/cdio.h>
 
 #include "SDL_error.h"
@@ -64,7 +65,8 @@
 
 /* Some ioctl() errno values which occur when the tray is empty */
 #define ERRNO_TRAYEMPTY(errno)	\
-	((errno == EIO) || (errno == ENOENT) || (errno == EINVAL))
+	((errno == EIO) || (errno == ENOENT) || (errno == EINVAL) || \
+	 (errno == ENODEV))
 
 /* Check a drive to see if it is a CD-ROM */
 static int CheckDrive(char *drive, struct stat *stbuf)
@@ -96,6 +98,8 @@
 			}
 			close(cdfd);
 		}
+		else if (ERRNO_TRAYEMPTY(errno))
+			is_cd = 1;
 	}
 	return(is_cd);
 }
@@ -137,7 +141,11 @@
 int  SDL_SYS_CDInit(void)
 {
 	static char *checklist[] = {
+#ifdef __OpenBSD__
+		"?0 cd?a", "cdrom", NULL
+#else
 		"?0 cd?c", "?0 acd?c", "cdrom", NULL
+#endif
 	};
 	char *SDLcdrom;
 	int i, j, exists;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/timer/SDL_timer.c	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,286 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    5635-34 Springhouse Dr.
+    Pleasanton, CA 94588 (USA)
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>			/* For the definition of NULL */
+
+#include "SDL_error.h"
+#include "SDL_timer.h"
+#include "SDL_timer_c.h"
+#include "SDL_mutex.h"
+#include "SDL_systimer.h"
+
+/* #define DEBUG_TIMERS */
+
+int SDL_timer_started = 0;
+int SDL_timer_running = 0;
+
+/* Data to handle a single periodic alarm */
+Uint32 SDL_alarm_interval = 0;
+SDL_TimerCallback SDL_alarm_callback;
+
+static SDL_bool list_changed = SDL_FALSE;
+
+/* Data used for a thread-based timer */
+static int SDL_timer_threaded = 0;
+
+struct _SDL_TimerID {
+	Uint32 interval;
+	SDL_NewTimerCallback cb;
+	void *param;
+	Uint32 last_alarm;
+	struct _SDL_TimerID *next;
+};
+
+static SDL_TimerID SDL_timers = NULL;
+static Uint32 num_timers = 0;
+static SDL_mutex *SDL_timer_mutex;
+
+/* Set whether or not the timer should use a thread.
+   This should not be called while the timer subsystem is running.
+*/
+int SDL_SetTimerThreaded(int value)
+{
+	int retval;
+
+	if ( SDL_timer_started ) {
+		SDL_SetError("Timer already initialized");
+		retval = -1;
+	} else {
+		retval = 0;
+		SDL_timer_threaded = value;
+	}
+	return retval;
+}
+
+int SDL_TimerInit(void)
+{
+	int retval;
+
+	SDL_timer_running = 0;
+	SDL_SetTimer(0, NULL);
+	retval = 0;
+	if ( ! SDL_timer_threaded ) {
+		retval = SDL_SYS_TimerInit();
+	}
+	if ( SDL_timer_threaded ) {
+		SDL_timer_mutex = SDL_CreateMutex();
+	}
+	SDL_timer_started = 1;
+	return(retval);
+}
+
+void SDL_TimerQuit(void)
+{
+	SDL_SetTimer(0, NULL);
+	if ( SDL_timer_threaded < 2 ) {
+		SDL_SYS_TimerQuit();
+	}
+	if ( SDL_timer_threaded ) {
+		SDL_DestroyMutex(SDL_timer_mutex);
+	}
+	SDL_timer_started = 0;
+	SDL_timer_threaded = 0;
+}
+
+void SDL_ThreadedTimerCheck(void)
+{
+	Uint32 now, ms;
+	SDL_TimerID t, prev, next;
+	int removed;
+
+	now = SDL_GetTicks();
+
+	SDL_mutexP(SDL_timer_mutex);
+	for ( prev = NULL, t = SDL_timers; t; t = next ) {
+		removed = 0;
+		ms = t->interval - SDL_TIMESLICE;
+		next = t->next;
+		if ( (t->last_alarm < now) && ((now - t->last_alarm) > ms) ) {
+			if ( (now - t->last_alarm) < t->interval ) {
+				t->last_alarm += t->interval;
+			} else {
+				t->last_alarm = now;
+			}
+			list_changed = SDL_FALSE;
+#ifdef DEBUG_TIMERS
+			printf("Executing timer %p (thread = %d)\n",
+						t, SDL_ThreadID());
+#endif
+			SDL_mutexV(SDL_timer_mutex);
+			ms = t->cb(t->interval, t->param);
+			SDL_mutexP(SDL_timer_mutex);
+			if ( list_changed ) {
+				/* Abort, list of timers has been modified */
+				break;
+			}
+			if ( ms != t->interval ) {
+				if ( ms ) {
+					t->interval = ROUND_RESOLUTION(ms);
+				} else { /* Remove the timer from the linked list */
+#ifdef DEBUG_TIMERS
+					printf("SDL: Removing timer %p\n", t);
+#endif
+					if ( prev ) {
+						prev->next = next;
+					} else {
+						SDL_timers = next;
+					}
+					free(t);
+					-- num_timers;
+					removed = 1;
+				}
+			}
+		}
+		/* Don't update prev if the timer has disappeared */
+		if ( ! removed ) {
+			prev = t;
+		}
+	}
+	SDL_mutexV(SDL_timer_mutex);
+}
+
+SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param)
+{
+	SDL_TimerID t;
+	if ( ! SDL_timer_mutex ) {
+		if ( SDL_timer_started ) {
+			SDL_SetError("This platform doesn't support multiple timers");
+		} else {
+			SDL_SetError("You must call SDL_Init(SDL_INIT_TIMER) first");
+		}
+		return NULL;
+	}
+	if ( ! SDL_timer_threaded ) {
+		SDL_SetError("Multiple timers require threaded events!");
+		return NULL;
+	}
+	SDL_mutexP(SDL_timer_mutex);
+	t = (SDL_TimerID) malloc(sizeof(struct _SDL_TimerID));
+	if ( t ) {
+		t->interval = ROUND_RESOLUTION(interval);
+		t->cb = callback;
+		t->param = param;
+		t->last_alarm = SDL_GetTicks();
+		t->next = SDL_timers;
+		SDL_timers = t;
+		++ num_timers;
+		list_changed = SDL_TRUE;
+		SDL_timer_running = 1;
+	}
+#ifdef DEBUG_TIMERS
+	printf("SDL_AddTimer(%d) = %08x num_timers = %d\n", interval, (Uint32)t, num_timers);
+#endif
+	SDL_mutexV(SDL_timer_mutex);
+	return t;
+}
+
+SDL_bool SDL_RemoveTimer(SDL_TimerID id)
+{
+	SDL_TimerID t, prev = NULL;
+	SDL_bool removed;
+
+	removed = SDL_FALSE;
+	SDL_mutexP(SDL_timer_mutex);
+	/* Look for id in the linked list of timers */
+	for (t = SDL_timers; t; prev=t, t = t->next ) {
+		if ( t == id ) {
+			if(prev) {
+				prev->next = t->next;
+			} else {
+				SDL_timers = t->next;
+			}
+			free(t);
+			-- num_timers;
+			removed = SDL_TRUE;
+			list_changed = SDL_TRUE;
+			break;
+		}
+	}
+#ifdef DEBUG_TIMERS
+	printf("SDL_RemoveTimer(%08x) = %d num_timers = %d thread = %d\n", (Uint32)id, removed, num_timers, SDL_ThreadID());
+#endif
+	SDL_mutexV(SDL_timer_mutex);
+	return removed;
+}
+
+static void SDL_RemoveAllTimers(SDL_TimerID t)
+{
+	SDL_TimerID freeme;
+
+	/* Changed to non-recursive implementation.
+	   The recursive implementation is elegant, but subject to 
+	   stack overflow if there are lots and lots of timers.
+	 */
+	while ( t ) {
+		freeme = t;
+		t = t->next;
+		free(freeme);
+	}
+}
+
+/* Old style callback functions are wrapped through this */
+static Uint32 callback_wrapper(Uint32 ms, void *param)
+{
+	SDL_TimerCallback func = (SDL_TimerCallback) param;
+	return (*func)(ms);
+}
+
+int SDL_SetTimer(Uint32 ms, SDL_TimerCallback callback)
+{
+	int retval;
+
+#ifdef DEBUG_TIMERS
+	printf("SDL_SetTimer(%d)\n", ms);
+#endif
+	retval = 0;
+	if ( SDL_timer_running ) {	/* Stop any currently running timer */
+		SDL_timer_running = 0;
+		if ( SDL_timer_threaded ) {
+			SDL_mutexP(SDL_timer_mutex);
+			SDL_RemoveAllTimers(SDL_timers);
+			SDL_timers = NULL;
+			SDL_mutexV(SDL_timer_mutex);
+		} else {
+			SDL_SYS_StopTimer();
+		}
+	}
+	if ( ms ) {
+		if ( SDL_timer_threaded ) {
+			retval = (SDL_AddTimer(ms, callback_wrapper,
+					       (void *)callback) != NULL);
+		} else {
+			SDL_timer_running = 1;
+			SDL_alarm_interval = ms;
+			SDL_alarm_callback = callback;
+			retval = SDL_SYS_StartTimer();
+		}
+	}
+	return retval;
+}
--- a/src/timer/linux/SDL_systimer.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/timer/linux/SDL_systimer.c	Thu Apr 26 16:50:19 2001 +0000
@@ -36,6 +36,10 @@
 #include "SDL_timer.h"
 #include "SDL_timer_c.h"
 
+#if _POSIX_THREAD_SYSCALL_SOFT
+#include <pthread.h>
+#endif
+
 #if defined(DISABLE_THREADS) || defined(FORK_HACK)
 #define USE_ITIMER
 #endif
@@ -96,6 +100,9 @@
 	do {
 		errno = 0;
 
+#if _POSIX_THREAD_SYSCALL_SOFT
+		pthread_yield_np();
+#endif
 #ifdef USE_NANOSLEEP
 		tv.tv_sec = elapsed.tv_sec;
 		tv.tv_nsec = elapsed.tv_nsec;
--- a/src/video/Makefile.am	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/Makefile.am	Thu Apr 26 16:50:19 2001 +0000
@@ -5,7 +5,7 @@
 
 # Define which subdirectories need to be built
 SUBDIRS = @VIDEO_SUBDIRS@
-DIST_SUBDIRS = x11 dga fbcon svga ggi aalib \
+DIST_SUBDIRS = dummy x11 dga fbcon svga ggi aalib \
                wincommon windib windx5 \
                maccommon macdsp macrom bwindow photon cybergfx
 
--- a/src/video/SDL_RLEaccel.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_RLEaccel.c	Thu Apr 26 16:50:19 2001 +0000
@@ -109,12 +109,21 @@
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
+#define PIXEL_COPY(to, from, len, bpp)			\
+do {							\
+    if(bpp == 4) {					\
+	SDL_memcpy4(to, from, (unsigned)(len));		\
+    } else {						\
+	SDL_memcpy(to, from, (unsigned)(len) * (bpp));	\
+    }							\
+} while(0)
+
 /*
  * Various colorkey blit methods, for opaque and per-surface alpha
  */
 
 #define OPAQUE_BLIT(to, from, length, bpp, alpha)	\
-    SDL_memcpy(to, from, (unsigned)(length * bpp))
+    PIXEL_COPY(to, from, length, bpp)
 
 /*
  * For 32bpp pixels on the form 0x00rrggbb:
@@ -657,9 +666,9 @@
 		    if(crun > right - cofs)				  \
 			crun = right - cofs;				  \
 		    if(crun > 0)					  \
-			SDL_memcpy(dstbuf + cofs * sizeof(Ptype),	  \
+			PIXEL_COPY(dstbuf + cofs * sizeof(Ptype),	  \
 				   srcbuf + (cofs - ofs) * sizeof(Ptype), \
-				   (unsigned)crun * sizeof(Ptype));	  \
+				   (unsigned)crun, sizeof(Ptype));	  \
 		    srcbuf += run * sizeof(Ptype);			  \
 		    ofs += run;						  \
 		} else if(!ofs)						  \
@@ -816,8 +825,8 @@
 		    run = ((Ctype *)srcbuf)[1];				 \
 		    srcbuf += 2 * sizeof(Ctype);			 \
 		    if(run) {						 \
-			SDL_memcpy(dstbuf + ofs * sizeof(Ptype), srcbuf, \
-				   run * sizeof(Ptype));		 \
+			PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
+				   run, sizeof(Ptype));			 \
 			srcbuf += run * sizeof(Ptype);			 \
 			ofs += run;					 \
 		    } else if(!ofs)					 \
--- a/src/video/SDL_blit_A.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_blit_A.c	Thu Apr 26 16:50:19 2001 +0000
@@ -195,8 +195,8 @@
 	}
 }
 
-/* fast RGB888->(A)RGB888 blending with surface alpha */
-static void BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo *info)
+/* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
+static void BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo *info)
 {
 	int width = info->d_width;
 	int height = info->d_height;
@@ -204,32 +204,58 @@
 	int srcskip = info->s_skip >> 2;
 	Uint32 *dstp = (Uint32 *)info->d_pixels;
 	int dstskip = info->d_skip >> 2;
-	SDL_PixelFormat *srcfmt = info->src;
-	unsigned alpha = srcfmt->alpha;
 
 	while(height--) {
 	    DUFFS_LOOP4({
-		Uint32 s;
-		Uint32 d;
-		Uint32 s1;
-		Uint32 d1;
-		s = *srcp;
-		d = *dstp;
-		s1 = s & 0xff00ff;
-		d1 = d & 0xff00ff;
-		d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff;
-		s &= 0xff00;
-		d &= 0xff00;
-		d = (d + ((s - d) * alpha >> 8)) & 0xff00;
-		*dstp = d1 | d | 0xff000000;
-		++srcp;
-		++dstp;
+		    Uint32 s = *srcp++;
+		    Uint32 d = *dstp;
+		    *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
+			       + (s & d & 0x00010101)) | 0xff000000;
 	    }, width);
 	    srcp += srcskip;
 	    dstp += dstskip;
 	}
 }
 
+/* fast RGB888->(A)RGB888 blending with surface alpha */
+static void BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo *info)
+{
+	unsigned alpha = info->src->alpha;
+	if(alpha == 128) {
+		BlitRGBtoRGBSurfaceAlpha128(info);
+	} else {
+		int width = info->d_width;
+		int height = info->d_height;
+		Uint32 *srcp = (Uint32 *)info->s_pixels;
+		int srcskip = info->s_skip >> 2;
+		Uint32 *dstp = (Uint32 *)info->d_pixels;
+		int dstskip = info->d_skip >> 2;
+
+		while(height--) {
+			DUFFS_LOOP4({
+				Uint32 s;
+				Uint32 d;
+				Uint32 s1;
+				Uint32 d1;
+				s = *srcp;
+				d = *dstp;
+				s1 = s & 0xff00ff;
+				d1 = d & 0xff00ff;
+				d1 = (d1 + ((s1 - d1) * alpha >> 8))
+				     & 0xff00ff;
+				s &= 0xff00;
+				d &= 0xff00;
+				d = (d + ((s - d) * alpha >> 8)) & 0xff00;
+				*dstp = d1 | d | 0xff000000;
+				++srcp;
+				++dstp;
+			}, width);
+			srcp += srcskip;
+			dstp += dstskip;
+		}
+	}
+}
+
 /* fast ARGB888->(A)RGB888 blending with pixel alpha */
 static void BlitRGBtoRGBPixelAlpha(SDL_BlitInfo *info)
 {
@@ -277,8 +303,18 @@
 	}
 }
 
-/* fast RGB565->RGB565 blending with surface alpha */
-static void Blit565to565SurfaceAlpha(SDL_BlitInfo *info)
+/* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
+
+/* blend a single 16 bit pixel at 50% */
+#define BLEND16_50(d, s, mask)						\
+	((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff)))
+
+/* blend two 16 bit pixels at 50% */
+#define BLEND2x16_50(d, s, mask)					     \
+	(((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \
+	 + (s & d & (~(mask | mask << 16))))
+
+static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask)
 {
 	int width = info->d_width;
 	int height = info->d_height;
@@ -286,56 +322,163 @@
 	int srcskip = info->s_skip >> 1;
 	Uint16 *dstp = (Uint16 *)info->d_pixels;
 	int dstskip = info->d_skip >> 1;
-	unsigned alpha = info->src->alpha >> 3; /* downscale alpha to 5 bits */
 
 	while(height--) {
-	    DUFFS_LOOP4({
-		Uint32 s = *srcp++;
-		Uint32 d = *dstp;
-		/*
-		 * shift out the middle component (green) to the high 16
-		 * bits, and process all three RGB components at the same
-		 * time.
-		 */
-		s = (s | s << 16) & 0x07e0f81f;
-		d = (d | d << 16) & 0x07e0f81f;
-		d += (s - d) * alpha >> 5;
-		d &= 0x07e0f81f;
-		*dstp++ = d | d >> 16;
-	    }, width);
-	    srcp += srcskip;
-	    dstp += dstskip;
+		if(((unsigned long)srcp ^ (unsigned long)dstp) & 2) {
+			/*
+			 * Source and destination not aligned, pipeline it.
+			 * This is mostly a win for big blits but no loss for
+			 * small ones
+			 */
+			Uint32 prev_sw;
+			int w = width;
+
+			/* handle odd destination */
+			if((unsigned long)dstp & 2) {
+				Uint16 d = *dstp, s = *srcp;
+				*dstp = BLEND16_50(d, s, mask);
+				dstp++;
+				srcp++;
+				w--;
+			}
+			srcp++;	/* srcp is now 32-bit aligned */
+
+			/* bootstrap pipeline with first halfword */
+			prev_sw = ((Uint32 *)srcp)[-1];
+
+			while(w > 1) {
+				Uint32 sw, dw, s;
+				sw = *(Uint32 *)srcp;
+				dw = *(Uint32 *)dstp;
+				if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
+					s = (prev_sw << 16) + (sw >> 16);
+				else
+					s = (prev_sw >> 16) + (sw << 16);
+				prev_sw = sw;
+				*(Uint32 *)dstp = BLEND2x16_50(dw, s, mask);
+				dstp += 2;
+				srcp += 2;
+				w -= 2;
+			}
+
+			/* final pixel if any */
+			if(w) {
+				Uint16 d = *dstp, s;
+				if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
+					s = prev_sw;
+				else
+					s = prev_sw >> 16;
+				*dstp = BLEND16_50(d, s, mask);
+				srcp++;
+				dstp++;
+			}
+			srcp += srcskip - 1;
+			dstp += dstskip;
+		} else {
+			/* source and destination are aligned */
+			int w = width;
+
+			/* first odd pixel? */
+			if((unsigned long)srcp & 2) {
+				Uint16 d = *dstp, s = *srcp;
+				*dstp = BLEND16_50(d, s, mask);
+				srcp++;
+				dstp++;
+				w--;
+			}
+			/* srcp and dstp are now 32-bit aligned */
+
+			while(w > 1) {
+				Uint32 sw = *(Uint32 *)srcp;
+				Uint32 dw = *(Uint32 *)dstp;
+				*(Uint32 *)dstp = BLEND2x16_50(dw, sw, mask);
+				srcp += 2;
+				dstp += 2;
+				w -= 2;
+			}
+
+			/* last odd pixel? */
+			if(w) {
+				Uint16 d = *dstp, s = *srcp;
+				*dstp = BLEND16_50(d, s, mask);
+				srcp++;
+				dstp++;
+			}
+			srcp += srcskip;
+			dstp += dstskip;
+		}
+	}
+}
+
+/* fast RGB565->RGB565 blending with surface alpha */
+static void Blit565to565SurfaceAlpha(SDL_BlitInfo *info)
+{
+	unsigned alpha = info->src->alpha;
+	if(alpha == 128) {
+		Blit16to16SurfaceAlpha128(info, 0xf7de);
+	} else {
+		int width = info->d_width;
+		int height = info->d_height;
+		Uint16 *srcp = (Uint16 *)info->s_pixels;
+		int srcskip = info->s_skip >> 1;
+		Uint16 *dstp = (Uint16 *)info->d_pixels;
+		int dstskip = info->d_skip >> 1;
+		alpha >>= 3;	/* downscale alpha to 5 bits */
+
+		while(height--) {
+			DUFFS_LOOP4({
+				Uint32 s = *srcp++;
+				Uint32 d = *dstp;
+				/*
+				 * shift out the middle component (green) to
+				 * the high 16 bits, and process all three RGB
+				 * components at the same time.
+				 */
+				s = (s | s << 16) & 0x07e0f81f;
+				d = (d | d << 16) & 0x07e0f81f;
+				d += (s - d) * alpha >> 5;
+				d &= 0x07e0f81f;
+				*dstp++ = d | d >> 16;
+			}, width);
+			srcp += srcskip;
+			dstp += dstskip;
+		}
 	}
 }
 
 /* fast RGB555->RGB555 blending with surface alpha */
 static void Blit555to555SurfaceAlpha(SDL_BlitInfo *info)
 {
-	int width = info->d_width;
-	int height = info->d_height;
-	Uint16 *srcp = (Uint16 *)info->s_pixels;
-	int srcskip = info->s_skip >> 1;
-	Uint16 *dstp = (Uint16 *)info->d_pixels;
-	int dstskip = info->d_skip >> 1;
-	unsigned alpha = info->src->alpha >> 3; /* downscale alpha to 5 bits */
+	unsigned alpha = info->src->alpha; /* downscale alpha to 5 bits */
+	if(alpha == 128) {
+		Blit16to16SurfaceAlpha128(info, 0xfbde);
+	} else {
+		int width = info->d_width;
+		int height = info->d_height;
+		Uint16 *srcp = (Uint16 *)info->s_pixels;
+		int srcskip = info->s_skip >> 1;
+		Uint16 *dstp = (Uint16 *)info->d_pixels;
+		int dstskip = info->d_skip >> 1;
+		alpha >>= 3;		/* downscale alpha to 5 bits */
 
-	while(height--) {
-	    DUFFS_LOOP4({
-		Uint32 s = *srcp++;
-		Uint32 d = *dstp;
-		/*
-		 * shift out the middle component (green) to the high 16
-		 * bits, and process all three RGB components at the same
-		 * time.
-		 */
-		s = (s | s << 16) & 0x03e07c1f;
-		d = (d | d << 16) & 0x03e07c1f;
-		d += (s - d) * alpha >> 5;
-		d &= 0x03e07c1f;
-		*dstp++ = d | d >> 16;
-	    }, width);
-	    srcp += srcskip;
-	    dstp += dstskip;
+		while(height--) {
+			DUFFS_LOOP4({
+				Uint32 s = *srcp++;
+				Uint32 d = *dstp;
+				/*
+				 * shift out the middle component (green) to
+				 * the high 16 bits, and process all three RGB
+				 * components at the same time.
+				 */
+				s = (s | s << 16) & 0x03e07c1f;
+				d = (d | d << 16) & 0x03e07c1f;
+				d += (s - d) * alpha >> 5;
+				d &= 0x03e07c1f;
+				*dstp++ = d | d >> 16;
+			}, width);
+			srcp += srcskip;
+			dstp += dstskip;
+		}
 	}
 }
 
--- a/src/video/SDL_cursor.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_cursor.c	Thu Apr 26 16:50:19 2001 +0000
@@ -723,7 +723,9 @@
 		SDL_Rect area;
 
 		SDL_MouseRect(&area);
-		video->UpdateRects(this, 1, &area);
+		if ( video->UpdateRects ) {
+			video->UpdateRects(this, 1, &area);
+		}
 	}
 }
 
--- a/src/video/SDL_memops.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_memops.h	Thu Apr 26 16:50:19 2001 +0000
@@ -53,6 +53,17 @@
 		: "memory" );						  \
 } while(0)
 
+#define SDL_memcpy4(dst, src, len)				\
+do {								\
+	int ecx, edi, esi;					\
+	__asm__ __volatile__ (					\
+		"cld\n\t"					\
+		"rep ; movsl"					\
+		: "=&c" (ecx), "=&D" (edi), "=&S" (esi)		\
+		: "0" ((unsigned)(len)), "1" (dst), "2" (src)	\
+		: "memory" );					\
+} while(0)
+
 #define SDL_revcpy(dst, src, len)			\
 do {							\
 	int u0, u1, u2;					\
@@ -104,9 +115,15 @@
 #ifndef SDL_memcpy
 #define SDL_memcpy(dst, src, len)	memcpy(dst, src, len)
 #endif
+
+#ifndef SDL_memcpy4
+#define SDL_memcpy4(dst, src, len)	memcpy(dst, src, (len) << 2)
+#endif
+
 #ifndef SDL_revcpy
 #define SDL_revcpy(dst, src, len)	memmove(dst, src, len)
 #endif
+
 #ifndef SDL_memset4
 #define SDL_memset4(dst, val, len)		\
 do {						\
--- a/src/video/SDL_sysvideo.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_sysvideo.h	Thu Apr 26 16:50:19 2001 +0000
@@ -355,6 +355,9 @@
 #ifdef ENABLE_BWINDOW
 extern VideoBootStrap BWINDOW_bootstrap;
 #endif
+#ifdef ENABLE_DUMMYVIDEO
+extern VideoBootStrap DUMMY_bootstrap;
+#endif
 /* MacOS X gets the proper defines from configure */
 #if defined(macintosh) && !defined(MACOSX)
 #define ENABLE_TOOLBOX
--- a/src/video/SDL_video.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_video.c	Thu Apr 26 16:50:19 2001 +0000
@@ -84,6 +84,9 @@
 #ifdef ENABLE_CYBERGRAPHICS
 	&CGX_bootstrap,
 #endif
+#ifdef ENABLE_DUMMYVIDEO
+	&DUMMY_bootstrap,
+#endif
 	NULL
 };
 SDL_VideoDevice *current_video = NULL;
--- a/src/video/bwindow/SDL_BView.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/bwindow/SDL_BView.h	Thu Apr 26 16:50:19 2001 +0000
@@ -50,6 +50,10 @@
 		xoff = x;
 		yoff = y;
 	}
+	virtual void GetXYOffset(int &x, int &y) {
+		x = xoff;
+		y = yoff;
+	}
 	/* The view changed size. If it means we're in fullscreen, we
 	 * draw a nice black box in the entire view to get black borders.
 	 */
--- a/src/video/bwindow/SDL_BWin.h	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/bwindow/SDL_BWin.h	Thu Apr 26 16:50:19 2001 +0000
@@ -156,6 +156,16 @@
 #endif
 		SDL_View->SetXYOffset(x, y);		
 	}
+	virtual void GetXYOffset(int &x, int &y) {
+#ifdef HAVE_OPENGL
+		if ( the_view == SDL_GLView ) {
+			x = 0;
+			y = 0;
+			return;
+		}
+#endif
+		SDL_View->GetXYOffset(x, y);
+	}
 	virtual bool BeginDraw(void) {
 		return(Lock());
 	}
--- a/src/video/bwindow/SDL_sysevents.cc	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/bwindow/SDL_sysevents.cc	Thu Apr 26 16:50:19 2001 +0000
@@ -262,7 +262,12 @@
 
 	/* Check for mouse motion */
 	if ( point != last_point ) {
-		SDL_PrivateMouseMotion(0, 0, (int)point.x, (int)point.y);
+		int x, y;
+
+		SDL_Win->GetXYOffset(x, y);
+		x = (int)point.x - x;
+		y = (int)point.y - y;
+		SDL_PrivateMouseMotion(0, 0, x, y);
 	}
 	last_point = point;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/Makefile.am	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,15 @@
+
+## Makefile.am for SDL using the null video driver
+
+noinst_LTLIBRARIES = libvideo_null.la
+libvideo_null_la_SOURCES = $(NULL_SRCS)
+
+# The SDL null video driver sources
+NULL_SRCS = 			\
+	SDL_nullvideo.h		\
+	SDL_nullevents.c	\
+	SDL_nullevents_c.h	\
+	SDL_nullmouse.c		\
+	SDL_nullmouse_c.h	\
+	SDL_nullvideo.c
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullevents.c	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,48 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+/* Being a null driver, there's no event stream. We just define stubs for
+   most of the API. */
+
+#include "SDL.h"
+#include "SDL_sysevents.h"
+#include "SDL_events_c.h"
+#include "SDL_nullvideo.h"
+#include "SDL_nullevents_c.h"
+
+void DUMMY_PumpEvents(_THIS)
+{
+	/* do nothing. */
+}
+
+void DUMMY_InitOSKeymap(_THIS)
+{
+	/* do nothing. */
+}
+
+/* end of SDL_nullevents.c ... */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullevents_c.h	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,37 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+#include "SDL_nullvideo.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts 
+   of the native video subsystem (SDL_sysvideo.c)
+*/
+extern void DUMMY_InitOSKeymap(_THIS);
+extern void DUMMY_PumpEvents(_THIS);
+
+/* end of SDL_nullevents_c.h ... */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullmouse.c	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,40 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+#include <stdio.h>
+
+#include "SDL_error.h"
+#include "SDL_mouse.h"
+#include "SDL_events_c.h"
+
+#include "SDL_nullmouse_c.h"
+
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+	int unused;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullmouse_c.h	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,30 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+#include "SDL_nullvideo.h"
+
+/* Functions to be exported */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullvideo.c	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,245 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+/* Dummy SDL video driver implementation; this is just enough to make an
+ *  SDL-based application THINK it's got a working video driver, for
+ *  applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it,
+ *  and also for use as a collection of stubs when porting SDL to a new
+ *  platform for which you haven't yet written a valid video driver.
+ *
+ * This is also a great way to determine bottlenecks: if you think that SDL
+ *  is a performance problem for a given platform, enable this driver, and
+ *  then see if your application runs faster without video overhead.
+ *
+ * Initial work by Ryan C. Gordon (icculus@linuxgames.com). A good portion
+ *  of this was cut-and-pasted from Stephane Peter's work in the AAlib
+ *  SDL video driver.  Renamed to "DUMMY" by Sam Lantinga.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "SDL.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_sysvideo.h"
+#include "SDL_pixels_c.h"
+#include "SDL_events_c.h"
+
+#include "SDL_nullvideo.h"
+#include "SDL_nullevents_c.h"
+#include "SDL_nullmouse_c.h"
+
+/* Initialization/Query functions */
+static int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat);
+static SDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
+static SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
+static int DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
+static void DUMMY_VideoQuit(_THIS);
+
+/* Hardware surface functions */
+static int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface);
+static int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface);
+static int DUMMY_FlipHWSurface(_THIS, SDL_Surface *surface);
+static void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface);
+static void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface);
+
+/* etc. */
+static void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
+
+/* DUMMY driver bootstrap functions */
+
+static int DUMMY_Available(void)
+{
+	return 1; /* Always available ! */
+}
+
+static void DUMMY_DeleteDevice(SDL_VideoDevice *device)
+{
+	free(device->hidden);
+	free(device);
+}
+
+static SDL_VideoDevice *DUMMY_CreateDevice(int devindex)
+{
+	SDL_VideoDevice *device;
+
+	/* Initialize all variables that we clean on shutdown */
+	device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
+	if ( device ) {
+		memset(device, 0, (sizeof *device));
+		device->hidden = (struct SDL_PrivateVideoData *)
+				malloc((sizeof *device->hidden));
+	}
+	if ( (device == NULL) || (device->hidden == NULL) ) {
+		SDL_OutOfMemory();
+		if ( device ) {
+			free(device);
+		}
+		return(0);
+	}
+	memset(device->hidden, 0, (sizeof *device->hidden));
+
+	/* Set the function pointers */
+	device->VideoInit = DUMMY_VideoInit;
+	device->ListModes = DUMMY_ListModes;
+	device->SetVideoMode = DUMMY_SetVideoMode;
+	device->CreateYUVOverlay = NULL;
+	device->SetColors = DUMMY_SetColors;
+	device->UpdateRects = DUMMY_UpdateRects;
+	device->VideoQuit = DUMMY_VideoQuit;
+	device->AllocHWSurface = DUMMY_AllocHWSurface;
+	device->CheckHWBlit = NULL;
+	device->FillHWRect = NULL;
+	device->SetHWColorKey = NULL;
+	device->SetHWAlpha = NULL;
+	device->LockHWSurface = DUMMY_LockHWSurface;
+	device->UnlockHWSurface = DUMMY_UnlockHWSurface;
+	device->FlipHWSurface = NULL;
+	device->FreeHWSurface = DUMMY_FreeHWSurface;
+	device->SetCaption = NULL;
+	device->SetIcon = NULL;
+	device->IconifyWindow = NULL;
+	device->GrabInput = NULL;
+	device->GetWMInfo = NULL;
+	device->InitOSKeymap = DUMMY_InitOSKeymap;
+	device->PumpEvents = DUMMY_PumpEvents;
+
+	device->free = DUMMY_DeleteDevice;
+
+	return device;
+}
+
+VideoBootStrap DUMMY_bootstrap = {
+	"dummy", "SDL dummy video driver",
+	DUMMY_Available, DUMMY_CreateDevice
+};
+
+
+int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat)
+{
+	fprintf(stderr, "WARNING: You are using the SDL dummy video driver!\n");
+
+	/* Determine the screen depth (use default 8-bit depth) */
+	/* we change this during the SDL_SetVideoMode implementation... */
+	vformat->BitsPerPixel = 8;
+	vformat->BytesPerPixel = 1;
+
+	/* We're done! */
+	return(0);
+}
+
+SDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
+{
+   	 return (SDL_Rect **) -1;
+}
+
+SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current,
+				int width, int height, int bpp, Uint32 flags)
+{
+	if ( this->hidden->buffer ) {
+		free( this->hidden->buffer );
+	}
+
+	this->hidden->buffer = malloc(width * height * (bpp / 8));
+	if ( ! this->hidden->buffer ) {
+		SDL_SetError("Couldn't allocate buffer for requested mode");
+		return(NULL);
+	}
+
+/* 	printf("Setting mode %dx%d\n", width, height); */
+
+	memset(this->hidden->buffer, 0, width * height * (bpp / 8));
+
+	/* Allocate the new pixel format for the screen */
+	if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
+		free(this->hidden->buffer);
+		this->hidden->buffer = NULL;
+		SDL_SetError("Couldn't allocate new pixel format for requested mode");
+		return(NULL);
+	}
+
+	/* Set up the new mode framebuffer */
+	current->flags = flags & SDL_FULLSCREEN;
+	this->hidden->w = current->w = width;
+	this->hidden->h = current->h = height;
+	current->pitch = current->w * (bpp / 8);
+	current->pixels = this->hidden->buffer;
+
+	/* We're done */
+	return(current);
+}
+
+/* We don't actually allow hardware surfaces other than the main one */
+static int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface)
+{
+	return(-1);
+}
+static void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface)
+{
+	return;
+}
+
+/* We need to wait for vertical retrace on page flipped displays */
+static int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface)
+{
+	return(0);
+}
+
+static void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface)
+{
+	return;
+}
+
+static int DUMMY_FlipHWSurface(_THIS, SDL_Surface *surface)
+{
+	return(0);
+}
+
+static void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
+{
+	/* do nothing. */
+}
+
+int DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
+{
+	/* do nothing of note. */
+	return(1);
+}
+
+/* Note:  If we are terminated, this could be called in the middle of
+   another SDL video routine -- notably UpdateRects.
+*/
+void DUMMY_VideoQuit(_THIS)
+{
+	if (this->screen->pixels != NULL)
+	{
+		free(this->screen->pixels);
+		this->screen->pixels = NULL;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/dummy/SDL_nullvideo.h	Thu Apr 26 16:50:19 2001 +0000
@@ -0,0 +1,46 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+#ifndef _SDL_nullvideo_h
+#define _SDL_nullvideo_h
+
+#include "SDL_mouse.h"
+#include "SDL_sysvideo.h"
+#include "SDL_mutex.h"
+
+/* Hidden "this" pointer for the video functions */
+#define _THIS	SDL_VideoDevice *this
+
+
+/* Private display data */
+
+struct SDL_PrivateVideoData {
+    int w, h;
+    void *buffer;
+};
+
+#endif /* _SDL_nullvideo_h */
--- a/src/video/svga/SDL_svgavideo.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/svga/SDL_svgavideo.c	Thu Apr 26 16:50:19 2001 +0000
@@ -370,6 +370,10 @@
 
 	/* Set up the new mode framebuffer */
 	current->flags = (SDL_FULLSCREEN|SDL_HWSURFACE);
+	if ( bpp == 8 ) {
+		/* FIXME: What about DirectColor? */
+		current->flags |= SDL_HWPALETTE;
+	}
 	current->w = width;
 	current->h = height;
 	current->pitch = modeinfo->linewidth;
--- a/src/video/wincommon/SDL_sysevents.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Thu Apr 26 16:50:19 2001 +0000
@@ -134,10 +134,10 @@
 		if ( keyboard[VK_RMENU] & 0x80) {
 			state |= KMOD_RALT;
 		}
-		if ( keyboard[VK_NUMLOCK] & 0x80) {
+		if ( keyboard[VK_NUMLOCK] & 0x01) {
 			state |= KMOD_NUM;
 		}
-		if ( keyboard[VK_CAPITAL] & 0x80) {
+		if ( keyboard[VK_CAPITAL] & 0x01) {
 			state |= KMOD_CAPS;
 		}
 	}
--- a/src/video/windx5/SDL_dx5video.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Thu Apr 26 16:50:19 2001 +0000
@@ -1684,6 +1684,7 @@
 	return(DX5_AllocDDSurface(this, surface, NULL, SDL_HWSURFACE));
 }
 
+#ifdef DDRAW_DEBUG
 void PrintSurface(char *title, LPDIRECTDRAWSURFACE3 surface, Uint32 flags)
 {
 	DDSURFACEDESC ddsd;
@@ -1717,6 +1718,7 @@
 	     		ddsd.ddpfPixelFormat.dwBBitMask);
 #endif
 }
+#endif /* DDRAW_DEBUG */
 
 static int DX5_HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
 					SDL_Surface *dst, SDL_Rect *dstrect)
--- a/strip_fPIC.sh	Thu Apr 26 16:45:43 2001 +0000
+++ b/strip_fPIC.sh	Thu Apr 26 16:50:19 2001 +0000
@@ -3,7 +3,7 @@
 # libtool assumes that the compiler can handle the -fPIC flag
 # This isn't always true (for example, nasm can't handle it)
 command=""
-while [ $1 ]; do
+while [ $# -gt 0 ]; do
     if [ "$1" != "-fPIC" ]; then
         if [ "$1" != "-DPIC" ]; then
             command="$command $1"
--- a/test/acinclude.m4	Thu Apr 26 16:45:43 2001 +0000
+++ b/test/acinclude.m4	Thu Apr 26 16:50:19 2001 +0000
@@ -140,6 +140,11 @@
           AC_TRY_LINK([
 #include <stdio.h>
 #include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef  main
+#define main K_and_R_C_main
 ],      [ return 0; ],
         [ echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding SDL or finding the wrong"