diff -Nru SDL-1.2.14/configure SDL-1.2.14-motoezx/configure
--- SDL-1.2.14/configure	2009-10-17 13:35:13.000000000 -0400
+++ SDL-1.2.14-motoezx/configure	2009-12-27 06:03:12.000000000 -0500
@@ -991,6 +991,8 @@
 enable_video_aalib
 enable_video_caca
 enable_video_qtopia
+enable_video_motoezx
+enable_audio_ezx
 enable_video_picogui
 enable_xbios
 enable_gem
@@ -1725,6 +1727,8 @@
   --enable-video-aalib    use AAlib video driver [default=no]
   --enable-video-caca     use libcaca video driver [default=no]
   --enable-video-qtopia   use Qtopia video driver [default=no]
+  --enable-video-motoezx  use Moto/EzX video driver [default=no]
+  --enable-audio-ezx      use Motorola/EZX audio driver [default=no]
   --enable-video-picogui  use PicoGUI video driver [default=no]
   --enable-video-xbios    use Atari Xbios video driver [default=yes]
   --enable-video-gem      use Atari Gem video driver [default=yes]
@@ -4629,13 +4633,13 @@
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4632: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4636: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4635: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4639: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4638: output\"" >&5)
+  (eval echo "\"\$as_me:4642: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5845,7 +5849,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5848 "configure"' > conftest.$ac_ext
+  echo '#line 5852 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7512,11 +7516,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7515: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7519: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7519: \$? = $ac_status" >&5
+   echo "$as_me:7523: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7851,11 +7855,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7854: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7858: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7858: \$? = $ac_status" >&5
+   echo "$as_me:7862: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7956,11 +7960,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7959: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7963: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7963: \$? = $ac_status" >&5
+   echo "$as_me:7967: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8011,11 +8015,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8014: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8018: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8018: \$? = $ac_status" >&5
+   echo "$as_me:8022: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10813,7 +10817,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10816 "configure"
+#line 10820 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10909,7 +10913,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10912 "configure"
+#line 10916 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15076,11 +15080,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15079: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15083: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15083: \$? = $ac_status" >&5
+   echo "$as_me:15087: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -15175,11 +15179,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15178: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15182: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15182: \$? = $ac_status" >&5
+   echo "$as_me:15186: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15227,11 +15231,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15230: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15234: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15234: \$? = $ac_status" >&5
+   echo "$as_me:15238: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -26283,6 +26287,190 @@
     fi
 }
 
+CheckMotoEzX()
+{
+    # Check whether --enable-video-motoezx was given.
+if test "${enable_video_motoezx+set}" = set; then
+  enableval=$enable_video_motoezx;
+else
+  enable_video_motoezx=no
+fi
+
+    if test x$enable_video = xyes -a x$enable_video_motoezx = xyes; then
+        { echo "$as_me:$LINENO: checking for Moto/EzX support" >&5
+echo $ECHO_N "checking for Moto/EzX support... $ECHO_C" >&6; }
+        video_motoezx=no
+        MOTOEZX_FLAGS="-nostdinc -I$CROSSTOOL_DIR/arm-linux-gnu/sys-include -I$CROSSTOOL_DIR/arm-linux-gnu/include -I$CROSSTOOL_DIR/lib/gcc-lib/arm-linux-gnu/3.3.6/include -DQWS -I${QTDIR}/include/ -I${EZXDIR}/include -DNO_DEBUG -fno-rtti -fno-exceptions"
+        ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+        OLD_CXX="$CXXFLAGS"
+        CXXFLAGS="$MOTOEZX_FLAGS"
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+         #include <zapplication.h>
+
+int
+main ()
+{
+
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+        video_motoezx=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        CXXFLAGS="$OLD_CXX"
+        { echo "$as_me:$LINENO: result: $video_motoezx" >&5
+echo "${ECHO_T}$video_motoezx" >&6; }
+        if test x$video_motoezx = xyes; then
+            cat >>confdefs.h <<\_ACEOF
+#define SDL_VIDEO_DRIVER_MOTOEZX 1
+_ACEOF
+
+            SOURCES="$SOURCES $srcdir/src/video/motoezx/*.cc"
+            SDLMAIN_SOURCES="$srcdir/src/main/motoezx/*.cc"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $MOTOEZX_FLAGS"
+            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
+            SDL_LIBS="-lSDLmain $SDL_LIBS -L${EZXDIR}/lib -Wl,-rpath-link,${EZXDIR}/lib,-rpath-link,${EZXDIR}/lib/ezx/lib,-rpath-link,${EZXDIR}/lib/ezx/lib/inputmethods -L${EZXDIR}/lib/ -L${EZXDIR}/lib/ezx/lib -lezxappbase"
+            have_video=yes
+        fi
+        ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    fi
+}
+
+CheckEZXAudio()
+{
+    # Check whether --enable-audio-ezx was given.
+if test "${enable_audio_ezx+set}" = set; then
+  enableval=$enable_audio_ezx;
+else
+  enable_audio_ezx=no
+fi
+
+    if test x$enable_audio = xyes -a x$enable_audio_ezx = xyes; then
+        { echo "$as_me:$LINENO: checking for Motorola/EZX audio support" >&5
+echo $ECHO_N "checking for Motorola/EZX audio support... $ECHO_C" >&6; }
+        audio_motoezx=no
+        MOTOEZX_FLAGS="-nostdinc -I$CROSSTOOL_DIR/arm-linux-gnu/sys-include -I$CROSSTOOL_DIR/arm-linux-gnu/include -I$CROSSTOOL_DIR/lib/gcc-lib/arm-linux-gnu/3.3.6/include -DQWS -I${QTDIR}/include/ -I${EZXDIR}/include -DNO_DEBUG -fno-rtti -fno-exceptions"
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+        OLD_CXX="$CXXFLAGS"
+        CXXFLAGS="$MOTOEZX_FLAGS"
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+         #include <ezxsound.h>
+
+int
+main ()
+{
+
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+        audio_motoezx=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        CXXFLAGS="$OLD_CXX"
+        { echo "$as_me:$LINENO: result: $audio_motoezx" >&5
+echo "${ECHO_T}$audio_motoezx" >&6; }
+        if test x$audio_motoezx = xyes; then
+            cat >>confdefs.h <<\_ACEOF
+#define SDL_AUDIO_DRIVER_EZX 1
+_ACEOF
+
+            SOURCES="$SOURCES $srcdir/src/audio/ezx/*.cc"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $MOTOEZX_FLAGS"
+            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
+            SDL_LIBS="-lSDLmain $SDL_LIBS"
+	    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L${QTDIR}/lib -L${QTDIR}/lib/ezx/lib -L${EZXDIR}/lib -lezxsound"
+            have_audio=yes
+        fi
+        ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    fi
+}
+
 CheckPicoGUI()
 {
     # Check whether --enable-video-picogui was given.
@@ -29998,6 +30186,8 @@
         CheckAAlib
         CheckCaca
         CheckQtopia
+        CheckMotoEzX
+	CheckEZXAudio
         CheckPicoGUI
         CheckOpenGLX11
         CheckInputEvents
@@ -31749,7 +31939,8 @@
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='
'
+ac_cr='
+'
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
   ac_cs_awk_cr='\\r'
diff -Nru SDL-1.2.14/configure.in SDL-1.2.14-motoezx/configure.in
--- SDL-1.2.14/configure.in	2009-10-17 13:35:03.000000000 -0400
+++ SDL-1.2.14-motoezx/configure.in	2009-12-06 15:03:01.000000000 -0500
@@ -1539,6 +1539,74 @@
     fi
 }
 
+dnl Set up the MotoEzX video driver if enabled
+CheckMotoEzX()
+{
+    AC_ARG_ENABLE(video-motoezx,
+AC_HELP_STRING([--enable-video-motoezx], [use Moto/EzX video driver [[default=no]]]),
+                  , enable_video_motoezx=no)
+    if test x$enable_video = xyes -a x$enable_video_motoezx = xyes; then
+        AC_MSG_CHECKING(for Moto/EzX support)
+        video_motoezx=no
+        MOTOEZX_FLAGS="-nostdinc -I$CROSSTOOL_DIR/arm-linux-gnu/sys-include -I$CROSSTOOL_DIR/arm-linux-gnu/include -I$CROSSTOOL_DIR/lib/gcc-lib/arm-linux-gnu/3.3.6/include -DQWS -I${QTDIR}/include/ -I${EZXDIR}/include -DNO_DEBUG -fno-rtti -fno-exceptions"
+        AC_LANG_CPLUSPLUS
+        OLD_CXX="$CXXFLAGS"
+        CXXFLAGS="$MOTOEZX_FLAGS"
+        AC_TRY_COMPILE([
+         #include <zapplication.h>
+        ],[
+        ],[
+        video_motoezx=yes
+        ])
+        CXXFLAGS="$OLD_CXX"
+        AC_MSG_RESULT($video_motoezx)
+        if test x$video_motoezx = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_MOTOEZX)
+            SOURCES="$SOURCES $srcdir/src/video/motoezx/*.cc"
+            SDLMAIN_SOURCES="$srcdir/src/main/motoezx/*.cc"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $MOTOEZX_FLAGS"
+            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
+            SDL_LIBS="-lSDLmain $SDL_LIBS -L${EZXDIR}/lib -Wl,-rpath-link,${EZXDIR}/lib,-rpath-link,${EZXDIR}/lib/ezx/lib,-rpath-link,${EZXDIR}/lib/ezx/lib/inputmethods -L${EZXDIR}/lib/ -L${EZXDIR}/lib/ezx/lib -lezxappbase"
+            have_video=yes
+        fi
+        AC_LANG_C
+    fi
+}
+
+dnl Set up the EZX audio driver if enabled
+CheckEZXAudio()
+{
+    AC_ARG_ENABLE(audio-ezx,
+AC_HELP_STRING([--enable-audio-ezx], [use Motorola/EZX audio driver [[default=no]]]),
+                  , enable_audio_ezx=no)
+    if test x$enable_audio = xyes -a x$enable_audio_ezx = xyes; then
+        AC_MSG_CHECKING(for Motorola/EZX audio support)
+        audio_motoezx=no
+        MOTOEZX_FLAGS="-nostdinc -I$CROSSTOOL_DIR/arm-linux-gnu/sys-include -I$CROSSTOOL_DIR/arm-linux-gnu/include -I$CROSSTOOL_DIR/lib/gcc-lib/arm-linux-gnu/3.3.6/include -DQWS -I${QTDIR}/include/ -I${EZXDIR}/include -DNO_DEBUG -fno-rtti -fno-exceptions"
+        AC_LANG_CPLUSPLUS
+        OLD_CXX="$CXXFLAGS"
+        CXXFLAGS="$MOTOEZX_FLAGS"
+        AC_TRY_COMPILE([
+         #include <ezxsound.h>
+        ],[
+        ],[
+        audio_motoezx=yes
+        ])
+        CXXFLAGS="$OLD_CXX"
+        AC_MSG_RESULT($audio_motoezx)
+        if test x$audio_motoezx = xyes; then
+            AC_DEFINE(SDL_AUDIO_DRIVER_EZX)
+            SOURCES="$SOURCES $srcdir/src/audio/ezx/*.cc"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $MOTOEZX_FLAGS"
+            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
+            SDL_LIBS="-lSDLmain $SDL_LIBS"
+	    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L${QPEDIR}/lib -L${QTDIR}/lib -L${QTDIR}/lib/ezx/lib -lezxsound"
+            have_audio=yes
+        fi
+        AC_LANG_C
+    fi
+}
+
 dnl Set up the PicoGUI video driver if enabled
 CheckPicoGUI()
 {
@@ -2332,6 +2400,8 @@
         CheckAAlib
         CheckCaca
         CheckQtopia
+        CheckMotoEzX
+	CheckEZXAudio
         CheckPicoGUI
         CheckOpenGLX11
         CheckInputEvents
diff -Nru SDL-1.2.14/include/SDL_config.h.in SDL-1.2.14-motoezx/include/SDL_config.h.in
--- SDL-1.2.14/include/SDL_config.h.in	2009-10-13 00:21:25.000000000 -0400
+++ SDL-1.2.14-motoezx/include/SDL_config.h.in	2009-12-06 14:28:25.000000000 -0500
@@ -183,6 +183,7 @@
 #undef SDL_AUDIO_DRIVER_SNDMGR
 #undef SDL_AUDIO_DRIVER_SUNAUDIO
 #undef SDL_AUDIO_DRIVER_WAVEOUT
+#undef SDL_AUDIO_DRIVER_EZX
 
 /* Enable various cdrom drivers */
 #undef SDL_CDROM_AIX
@@ -272,6 +273,7 @@
 #undef SDL_VIDEO_DRIVER_PS2GS
 #undef SDL_VIDEO_DRIVER_PS3
 #undef SDL_VIDEO_DRIVER_QTOPIA
+#undef SDL_VIDEO_DRIVER_MOTOEZX
 #undef SDL_VIDEO_DRIVER_QUARTZ
 #undef SDL_VIDEO_DRIVER_RISCOS
 #undef SDL_VIDEO_DRIVER_SVGALIB
diff -Nru SDL-1.2.14/sdl.pc SDL-1.2.14-motoezx/sdl.pc
--- SDL-1.2.14/sdl.pc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/sdl.pc	2009-12-25 18:45:11.000000000 -0500
@@ -0,0 +1,15 @@
+# sdl pkg-config source file
+
+prefix=/opt/toolchains/motoezx
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: sdl
+Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
+Version: 1.2.14
+Requires:
+Conflicts:
+Libs: -L${libdir} -Wl,-rpath,${libdir} -lSDLmain -lSDLmain -lSDL  -L/opt/toolchains/motoezx/a1200/ezx/lib -Wl,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib/inputmethods -L/opt/toolchains/motoezx/a1200/ezx/lib/ -L/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib -lezxappbase -lpthread
+Libs.private: -lSDLmain -lSDLmain -lSDL  -L/opt/toolchains/motoezx/a1200/ezx/lib -Wl,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib,-rpath-link,/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib/inputmethods -L/opt/toolchains/motoezx/a1200/ezx/lib/ -L/opt/toolchains/motoezx/a1200/ezx/lib/ezx/lib -lezxappbase -lpthread  -lm -ldl -L/opt/toolchains/motoezx/a1200/qt/lib -L/opt/toolchains/motoezx/a1200/qt/lib/ezx/lib -L/opt/toolchains/motoezx/a1200/ezx/lib -lezxsound -lpthread
+Cflags: -I${includedir}/SDL -D_GNU_SOURCE=1 -DQWS -Dmain=SDL_main -DQWS -Dmain=SDL_main -D_REENTRANT
diff -Nru SDL-1.2.14/src/audio/SDL_audio.c SDL-1.2.14-motoezx/src/audio/SDL_audio.c
--- SDL-1.2.14/src/audio/SDL_audio.c	2009-10-13 06:25:35.000000000 -0400
+++ SDL-1.2.14-motoezx/src/audio/SDL_audio.c	2009-12-06 14:30:15.000000000 -0500
@@ -113,6 +113,9 @@
 #if SDL_AUDIO_DRIVER_EPOCAUDIO
 	&EPOCAudio_bootstrap,
 #endif
+#if SDL_AUDIO_DRIVER_EZX
+	&EZXAudio_bootstrap,
+#endif
 	NULL
 };
 SDL_AudioDevice *current_audio = NULL;
diff -Nru SDL-1.2.14/src/audio/SDL_sysaudio.h SDL-1.2.14-motoezx/src/audio/SDL_sysaudio.h
--- SDL-1.2.14/src/audio/SDL_sysaudio.h	2009-10-12 19:07:14.000000000 -0400
+++ SDL-1.2.14-motoezx/src/audio/SDL_sysaudio.h	2009-12-06 14:31:31.000000000 -0500
@@ -177,6 +177,9 @@
 #if SDL_AUDIO_DRIVER_EPOCAUDIO
 extern AudioBootStrap EPOCAudio_bootstrap; 
 #endif
+#if SDL_AUDIO_DRIVER_EZX
+extern AudioBootStrap EZXAudio_bootstrap;
+#endif
 
 /* This is the current audio device */
 extern SDL_AudioDevice *current_audio;
diff -Nru SDL-1.2.14/src/audio/ezx/SDL_ezxaudio.cc SDL-1.2.14-motoezx/src/audio/ezx/SDL_ezxaudio.cc
--- SDL-1.2.14/src/audio/ezx/SDL_ezxaudio.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/audio/ezx/SDL_ezxaudio.cc	2009-12-17 12:03:52.000000000 -0500
@@ -0,0 +1,143 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+
+    This file written by Sergey Nizovtsev (snizovtsev@gmail.com)
+*/
+#include "SDL_config.h"
+
+/* Output audio via libezxsound.so for Motorola Z6... */
+
+#include "SDL_rwops.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+#include "SDL_ezxaudio.h"
+
+/* The tag name used by EZX audio */
+#define EZXAudio_DRIVER_NAME         "ezx"
+
+/* Shortcuts */
+#define mixbuf			(thisdevice->hidden->mixbuf)
+#define mixlen			(thisdevice->hidden->mixlen)
+#define audio_dev		(thisdevice->hidden->audio_dev)
+
+/* Audio driver functions */
+static int EZXAudio_OpenAudio(_THIS, SDL_AudioSpec *spec);
+static void EZXAudio_WaitAudio(_THIS);
+static void EZXAudio_PlayAudio(_THIS);
+static Uint8 *EZXAudio_GetAudioBuf(_THIS);
+static void EZXAudio_CloseAudio(_THIS);
+
+/* Audio driver bootstrap functions */
+static int EZXAudio_Available(void)
+{
+	return(1);
+}
+
+static void EZXAudio_DeleteDevice(SDL_AudioDevice *device)
+{
+	SDL_free(device->hidden);
+	SDL_free(device);
+}
+
+static SDL_AudioDevice *EZXAudio_CreateDevice(int devindex)
+{
+	SDL_AudioDevice *thisdevice;
+
+	/* Initialize all variables that we clean on shutdown */
+	thisdevice = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
+	if ( thisdevice ) {
+		SDL_memset(thisdevice, 0, (sizeof *thisdevice));
+		thisdevice->hidden = (struct SDL_PrivateAudioData *)
+				SDL_malloc((sizeof *thisdevice->hidden));
+	}
+	if ( (thisdevice == NULL) || (thisdevice->hidden == NULL) ) {
+		SDL_OutOfMemory();
+		if ( thisdevice ) {
+			SDL_free(thisdevice);
+		}
+		return(0);
+	}
+	SDL_memset(thisdevice->hidden, 0, (sizeof *thisdevice->hidden));
+
+	/* Set the function pointers */
+	thisdevice->OpenAudio = EZXAudio_OpenAudio;
+	thisdevice->WaitAudio = EZXAudio_WaitAudio;
+	thisdevice->PlayAudio = EZXAudio_PlayAudio;
+	thisdevice->GetAudioBuf = EZXAudio_GetAudioBuf;
+	thisdevice->CloseAudio = EZXAudio_CloseAudio;
+
+	thisdevice->free = EZXAudio_DeleteDevice;
+
+	return thisdevice;
+}
+
+AudioBootStrap EZXAudio_bootstrap = {
+	EZXAudio_DRIVER_NAME, "SDL EZX audio driver",
+	EZXAudio_Available, EZXAudio_CreateDevice
+};
+
+/* This function waits until it is possible to write a full sound buffer */
+static void EZXAudio_WaitAudio(_THIS)
+{
+	/* Not needed */
+}
+
+static void EZXAudio_PlayAudio(_THIS)
+{
+	int written = 0;
+	if (mixlen > 0)
+		written = audio_dev->write((short*)mixbuf, mixlen / 2);
+}
+
+static Uint8 *EZXAudio_GetAudioBuf(_THIS)
+{
+	return mixbuf;
+}
+
+static void EZXAudio_CloseAudio(_THIS)
+{
+	if ( mixbuf != NULL ) {
+		SDL_FreeAudioMem(mixbuf);
+		mixbuf = NULL;
+	}
+	audio_dev->flush();
+	audio_dev->close();
+	delete audio_dev;
+}
+
+static int EZXAudio_OpenAudio(_THIS, SDL_AudioSpec *spec)
+{
+	audio_dev = new ZAudioNormalDev(NORMAL_DEVICE,spec->freq,  spec->channels, 2);
+	audio_dev->setAudioDevice(spec->freq, spec->channels, 2);
+	audio_dev->setVolume(7);
+
+	/* Allocate mixing buffer */
+	mixlen = spec->size;
+	mixbuf = (Uint8 *) SDL_AllocAudioMem(mixlen);
+	if ( mixbuf == NULL ) {
+		return(-1);
+	}
+	SDL_memset(mixbuf, spec->silence, spec->size);
+	return(0);
+}
diff -Nru SDL-1.2.14/src/audio/ezx/SDL_ezxaudio.h SDL-1.2.14-motoezx/src/audio/ezx/SDL_ezxaudio.h
--- SDL-1.2.14/src/audio/ezx/SDL_ezxaudio.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/audio/ezx/SDL_ezxaudio.h	2009-12-13 07:53:45.000000000 -0500
@@ -0,0 +1,42 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_ezxaudio_h
+#define _SDL_ezxaudio_h
+
+#include <ezxsound.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the video functions */
+#define _THIS	SDL_AudioDevice *thisdevice
+
+struct SDL_PrivateAudioData {
+	/* The file descriptor for the audio device */
+	Uint8 *mixbuf;
+	Uint32 mixlen;
+	
+	ZAudioNormalDev *audio_dev;
+};
+
+#endif /* _SDL_ezxaudio_h */
diff -Nru SDL-1.2.14/src/main/motoezx/SDL_motoezx_main.cc SDL-1.2.14-motoezx/src/main/motoezx/SDL_motoezx_main.cc
--- SDL-1.2.14/src/main/motoezx/SDL_motoezx_main.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/main/motoezx/SDL_motoezx_main.cc	2009-09-12 07:27:26.000000000 -0400
@@ -0,0 +1,26 @@
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef main
+#undef main
+#endif
+#ifdef QWS
+#include <zapplication.h>
+#include <stdlib.h>
+#endif
+
+extern int SDL_main(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+#ifdef QWS
+  ZApplication a(argc, argv);
+  //QWidget dummy;
+  //a.setMainWidget(&dummy);
+  //dummy.show();
+#endif
+  int r = SDL_main(argc, argv);
+  return r;
+}
diff -Nru SDL-1.2.14/src/video/SDL_surface.c SDL-1.2.14-motoezx/src/video/SDL_surface.c
--- SDL-1.2.14/src/video/SDL_surface.c	2009-10-12 19:07:15.000000000 -0400
+++ SDL-1.2.14-motoezx/src/video/SDL_surface.c	2009-11-02 04:54:30.000000000 -0500
@@ -706,6 +706,9 @@
 			#if SDL_BYTEORDER == SDL_BIG_ENDIAN
 				color <<= 8;
 			#endif
+      #if SDL_VIDEO_DRIVER_MOTOEZX
+        //color = ((color & 0x1f) << 1) | ((color & 0x7e0) << 1) | ((color & 0xf800) << 2);
+      #endif
 			for ( y=dstrect->h; y; --y ) {
 				Uint8 *pixels = row;
 				for ( x=dstrect->w; x; --x ) {
diff -Nru SDL-1.2.14/src/video/SDL_sysvideo.h SDL-1.2.14-motoezx/src/video/SDL_sysvideo.h
--- SDL-1.2.14/src/video/SDL_sysvideo.h	2009-10-12 19:07:15.000000000 -0400
+++ SDL-1.2.14-motoezx/src/video/SDL_sysvideo.h	2009-11-02 04:57:43.000000000 -0500
@@ -335,6 +335,9 @@
 #if SDL_VIDEO_DRIVER_QTOPIA
 extern VideoBootStrap Qtopia_bootstrap;
 #endif
+#if SDL_VIDEO_DRIVER_MOTOEZX
+extern VideoBootStrap EzX_bootstrap;
+#endif
 #if SDL_VIDEO_DRIVER_WSCONS
 extern VideoBootStrap WSCONS_bootstrap;
 #endif
diff -Nru SDL-1.2.14/src/video/SDL_video.c SDL-1.2.14-motoezx/src/video/SDL_video.c
--- SDL-1.2.14/src/video/SDL_video.c	2009-10-12 19:07:15.000000000 -0400
+++ SDL-1.2.14-motoezx/src/video/SDL_video.c	2009-11-02 05:00:15.000000000 -0500
@@ -51,6 +51,9 @@
 #if SDL_VIDEO_DRIVER_QTOPIA
 	&Qtopia_bootstrap,
 #endif
+#if SDL_VIDEO_DRIVER_MOTOEZX
+	&EzX_bootstrap,
+#endif
 #if SDL_VIDEO_DRIVER_WSCONS
 	&WSCONS_bootstrap,
 #endif
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_QWin.cc SDL-1.2.14-motoezx/src/video/motoezx/SDL_QWin.cc
--- SDL-1.2.14/src/video/motoezx/SDL_QWin.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_QWin.cc	2009-12-04 16:45:41.000000000 -0500
@@ -0,0 +1,543 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_QWin.h"
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <zapplication.h>
+#include <qcopchannel_qws.h>
+#include <stdlib.h>
+
+screenRotationT screenRotation = SDL_QT_NO_ROTATION;
+
+static QCString SDL_MotoChannel;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void SDL_ChannelExists(const char *channelName);
+void SDL_ShowSplash();
+void SDL_HideSplash();
+
+extern int UTIL_GetIncomingCallStatus();
+extern int UTIL_GetFlipStatus();
+extern int UTIL_GetSideKeyLock();
+#ifdef __cplusplus
+}
+#endif
+
+static pid_t pid = -1;
+void SDL_ShowSplash()
+{
+  char buf[16];
+  sprintf(buf, "%d", getpid());
+  char *const argv[] = { "/mmc/mmca1/games/bin/splash.sh", buf, 0 };
+  if( (pid = vfork()) == 0){
+    execve("/mmc/mmca1/games/bin/splash.sh", argv, 0);
+    printf("execve splash: %s\n", strerror(errno));
+    exit(-1);
+  }
+  else if(pid < 0) printf("vfork splash: %s\n", strerror(errno));
+  else printf("show splash: %d\n", pid);
+}
+
+void SDL_HideSplash()
+{
+  printf("hide splash: %d\n", pid);
+  if(pid > 0){
+    int r = kill(pid, SIGINT);
+    if(r < 0) printf("kill splash: %s\n", strerror(errno));
+    sleep(1);
+    r = waitpid(pid, 0, WNOHANG);
+    if(r < 0) printf("wait splash: %s\n", strerror(errno));
+  }
+}
+
+static inline bool needSuspend()
+{
+  if(UTIL_GetIncomingCallStatus() || UTIL_GetFlipStatus() ||
+      UTIL_GetSideKeyLock())
+    return true;
+  return false;
+}
+
+void SDL_ChannelExists(const char *channelName)
+{
+  SDL_MotoChannel = channelName;
+  QString cmd = "/mmc/mmca1/games/bin/qcop " + SDL_MotoChannel + " up";
+  int r = system(cmd.latin1());
+  if(WIFEXITED(r)){
+    if(WEXITSTATUS(r) == 0) exit(0);
+  }
+  printf("'%s' - no such channel, run application\n", channelName);
+}
+
+SDL_QWin::SDL_QWin(const QSize& size)
+  : QWidget(0, "SDL_main", WType_TopLevel | WStyle_Customize | WStyle_NoBorder),
+		my_image(0),
+    my_inhibit_resize(false), my_mouse_pos(-1, -1), my_flags(0),
+    my_locked(0), my_special(false),
+    cur_mouse_button(EZX_LEFT_BUTTON),
+    my_suspended(false), last_mod(false)
+{
+  last.scancode = 0;
+  setBackgroundMode(NoBackground);
+  qcop = new QCopChannel(SDL_MotoChannel, 0, 0);
+  connect(qcop, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(channel(const QCString &, const QByteArray &)));
+  connect(qApp, SIGNAL(signalRaise(void)), this, SLOT(signalRaise()));
+	//connect(qApp, SIGNAL(clickAppIcon(void)), this, SLOT(clickAppIcon()));
+	setFocusPolicy(QWidget::StrongFocus);
+	vmem = (char *)-1;
+  fbdev = open("/dev/fb0", O_RDWR);
+  if(fbdev < 0){
+    printf("open(/dev/fb0): %s\n", strerror(errno));
+    return;
+  }
+
+  struct fb_fix_screeninfo fsi;
+  if(ioctl(fbdev, FBIOGET_FSCREENINFO, &fsi) < 0){
+    printf("ioctl(FBIOGET_FSCREENINFO): %s\n", strerror(errno));
+    return;
+  }
+  vmem_length = fsi.smem_len;
+
+  vmem = (char *)mmap(0, fsi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbdev, 0);
+  if(vmem == (char *)-1){
+    printf("mmap: %s\n", strerror(errno));
+  }
+  else printf("map framebuffer at %p (size %d)\n", vmem, fsi.smem_len);
+
+  setFixedSize(qApp->desktop()->size());
+  init();
+}
+
+SDL_QWin::~SDL_QWin() {
+  if(my_image) {
+    delete my_image;
+  }
+
+  if(vmem != (char *)-1){
+    munmap(vmem, vmem_length);
+    vmem = (char *)-1;
+  }
+
+  if(fbdev != -1){
+    close(fbdev);
+    fbdev = -1;
+  }
+
+  delete qcop;
+  printf("~SDL_QWin(): done\n");
+}
+
+void SDL_QWin::channel(const QCString &, const QByteArray &)
+{
+  printf("got signal from channel\n");
+  resume();
+}
+
+static bool suspended = false;
+void SDL_QWin::signalRaise()
+{
+	printf("signal raise\n");
+  resume();
+}
+
+/*void SDL_QWin::clickAppIcon()
+{
+	printf("click app icon\n");
+}*/
+
+void SDL_QWin::setImage(QImage *image) {
+  if ( my_image ) {
+    delete my_image;
+  }
+  my_image = image;
+}
+
+void SDL_QWin::resizeEvent(QResizeEvent *e) {
+}
+
+#ifdef MOTOEZX_TEST
+void SDL_QWin::focusInEvent(QFocusEvent *) {
+  printf("focus in\n");
+}
+
+void SDL_QWin::focusOutEvent(QFocusEvent *) {
+  printf("focus out\n");
+}
+#endif
+
+void SDL_QWin::init()
+{
+  grabKeyboard();
+  grabMouse();
+  my_suspended = false;
+  my_timer = startTimer(1000);
+}
+
+void SDL_QWin::suspend()
+{
+  printf("suspend\n");
+  killTimer(my_timer);
+  releaseKeyboard();
+  releaseMouse();
+  SDL_PrivateAppActive(false, SDL_APPINPUTFOCUS);
+  my_suspended = true;
+  hide();
+}
+
+void SDL_QWin::resume()
+{
+  if(!my_suspended || needSuspend()) return;
+
+  printf("resume\n");
+  init();
+  show();
+  SDL_PrivateAppActive(true, SDL_APPINPUTFOCUS);
+}
+
+void SDL_QWin::timerEvent(QTimerEvent *)
+{
+  if(needSuspend() && !my_suspended) suspend();
+}
+
+void SDL_QWin::closeEvent(QCloseEvent *e) {
+  SDL_PrivateQuit();
+  e->ignore();
+}
+
+void SDL_QWin::setMousePos(const QPoint &pos) {
+  if(my_image->width() == height()) {
+    if (screenRotation == SDL_QT_ROTATION_90)
+      my_mouse_pos = QPoint(height()-pos.y(), pos.x());
+    else if (screenRotation == SDL_QT_ROTATION_270)
+      my_mouse_pos = QPoint(pos.y(), width()-pos.x());
+  } else {
+    my_mouse_pos = pos;
+  }
+}
+
+void SDL_QWin::mouseMoveEvent(QMouseEvent *e) {
+  int sdlstate = 0;
+  if(cur_mouse_button == EZX_LEFT_BUTTON) {
+    sdlstate |= SDL_BUTTON_LMASK;
+  }
+  else {
+    sdlstate |= SDL_BUTTON_RMASK;
+  }
+  setMousePos(e->pos());
+  SDL_PrivateMouseMotion(sdlstate, 0, my_mouse_pos.x(), my_mouse_pos.y());
+}
+
+void SDL_QWin::mousePressEvent(QMouseEvent *e) {
+  mouseMoveEvent(e);
+  Qt::ButtonState button = e->button();
+  cur_mouse_button = my_special ? EZX_RIGHT_BUTTON : EZX_LEFT_BUTTON;
+  SDL_PrivateMouseButton(SDL_PRESSED, cur_mouse_button,
+			 my_mouse_pos.x(), my_mouse_pos.y());
+}
+
+void SDL_QWin::mouseReleaseEvent(QMouseEvent *e) {
+  setMousePos(e->pos());
+  Qt::ButtonState button = e->button();
+  SDL_PrivateMouseButton(SDL_RELEASED, cur_mouse_button,
+			 my_mouse_pos.x(), my_mouse_pos.y());
+  my_mouse_pos = QPoint(-1, -1);
+}
+
+void SDL_QWin::repaintRect(const QRect& rect) {
+  if(!rect.width() || !rect.height() /*|| !isVisible()*/) {
+    return;
+  }
+  
+  /* next - special for 18bpp framebuffer */
+  /* so any other - back off */
+  if(QPixmap::defaultDepth() != 18) return;
+
+#if 1
+  // 18 bpp - really 3 bytes per pixel
+  if(screenRotation == SDL_QT_ROTATION_90){
+    QRect rs = my_image->rect();
+    QRect rd;
+
+    int id, jd;
+
+    if(rect.y() + rect.height() > 240){
+      rs.setRect(rect.y(), 240 - rect.width() - rect.x(), rect.height(), rect.width());
+      rd = rect;
+      jd = rect.y() + rect.height() - 1;
+      id = rect.x();
+    }
+    else{
+      rs = rect;
+      rd.setRect(rect.y(), 320 - rect.width() - rect.x(), rect.height(), rect.width());
+      jd = 319 - rect.x();
+      id = rect.y();
+    }
+
+    //printf("rs: %d %d %d %d\n", rs.x(), rs.y(), rs.width(), rs.height());
+    //printf("rd: %d %d %d %d\n", rd.x(), rd.y(), rd.width(), rd.height());
+    //printf("id: %d, jd: %d\n", id, jd);
+
+    int ii = id, jj;
+    uchar *src0 = (uchar *)my_image->bits();
+    uchar *dst0 = (uchar *)vmem;
+    uchar *dst, *src;
+
+    src += rs.y() * my_image->bytesPerLine() + rs.x() * 2;
+
+    int is_lim = rs.y() + rs.height();
+    int dst_offset = jd * 720 + id * 3;
+    int src_offset = rs.y() * my_image->bytesPerLine() + rs.x() * 2;
+
+    for(int ii = rs.y(); ii < is_lim;
+        dst_offset += 3, src_offset += my_image->bytesPerLine(), ii++){
+      dst = dst0 + dst_offset;
+      src = src0 + src_offset;
+      for(int j = 0; j < rs.width(); j++){
+        unsigned short tmp = ((unsigned short)(src[1] & 0xf8)) << 2;
+        dst[0] = src[0] << 1;
+        dst[1] = ((src[0] & 0x80) >> 7) | ((src[1] & 0x7) << 1) | (tmp & 0xff);
+        dst[2] = (tmp & 0x300) >> 8;
+        dst -= 720;
+        src += 2;
+      }
+    }
+    //printf("done\n");
+  }
+  else if(screenRotation == SDL_QT_ROTATION_270){
+    QRect rs = my_image->rect();
+    QRect rd;
+
+    int id, jd;
+
+    if(rect.y() + rect.height() > 240){
+      rs.setRect(rect.y(), 240 - rect.width() - rect.x(), rect.height(), rect.width());
+      rd = rect;
+      jd = rect.y();
+      id = rect.x() + rect.width() - 1;
+    }
+    else{
+      rs = rect;
+      rd.setRect(rect.y(), 320 - rect.width() - rect.x(), rect.height(), rect.width());
+      jd = rect.x();
+      id = 239 - rect.y();
+    }
+
+    int ii = id, jj;
+    uchar *src0 = (uchar *)my_image->bits();
+    uchar *dst0 = (uchar *)vmem;
+    uchar *dst, *src;
+
+    src += rs.y() * my_image->bytesPerLine() + rs.x() * 2;
+
+    int is_lim = rs.y() + rs.height();
+    int dst_offset = jd * 720 + id * 3;
+    int src_offset = rs.y() * my_image->bytesPerLine() + rs.x() * 2;
+
+    for(int ii = rs.y(); ii < is_lim;
+        dst_offset -= 3, src_offset += my_image->bytesPerLine(), ii++){
+      dst = dst0 + dst_offset;
+      src = src0 + src_offset;
+      for(int j = 0; j < rs.width(); j++){
+        unsigned short tmp = ((unsigned short)(src[1] & 0xf8)) << 2;
+        dst[0] = src[0] << 1;
+        dst[1] = ((src[0] & 0x80) >> 7) | ((src[1] & 0x7) << 1) | (tmp & 0xff);
+        dst[2] = (tmp & 0x300) >> 8;
+        dst += 720;
+        src += 2;
+      }
+    }
+  }
+  else
+#endif
+  {
+    uchar *src0 = (uchar *)my_image->bits();
+    uchar *dst0 = (uchar *)vmem;
+    uchar *dst, *src;
+    
+    int is_lim = rect.y() + rect.height();
+    int s_offset = rect.y() * my_image->bytesPerLine() + rect.x() * 2;
+    int offset = rect.y() * 720 + rect.x() * 3;
+
+    for(int ii = rect.y(); ii < is_lim; ii++, offset += 720,
+                s_offset += my_image->bytesPerLine()){
+      dst = dst0 + offset;
+      src = src0 + s_offset;
+      for(int j = 0; j < rect.width(); j++){      
+        unsigned short tmp = ((unsigned short)(src[1] & 0xf8)) << 2;
+        dst[0] = src[0] << 1;
+        dst[1] = ((src[0] & 0x80) >> 7) | ((src[1] & 0x7) << 1) | (tmp & 0xff);
+        dst[2] = (tmp & 0x300) >> 8;
+        src += 2;
+        dst += 3;
+      }
+    }
+  }
+}
+
+// This paints the current buffer to the screen, when desired. 
+void SDL_QWin::paintEvent(QPaintEvent *ev) {  
+  if(my_image) {
+    repaintRect(ev->rect());
+  }
+}  
+
+inline int SDL_QWin::keyUp()
+{
+  return my_special ? SDLK_g : SDLK_UP;
+}
+
+inline int SDL_QWin::keyDown()
+{
+  return my_special ? SDLK_h : SDLK_DOWN;
+}
+
+inline int SDL_QWin::keyLeft()
+{
+  return my_special ? SDLK_i : SDLK_LEFT;
+}
+
+inline int SDL_QWin::keyRight()
+{
+  return my_special ? SDLK_j : SDLK_RIGHT;
+}
+
+/* Function to translate a keyboard transition and queue the key event
+ * This should probably be a table although this method isn't exactly
+ * slow.
+ */
+void SDL_QWin::QueueKey(QKeyEvent *e, int pressed)
+{  
+  SDL_keysym keysym;
+  int scancode = e->key();
+
+  //if(pressed){
+    if(last.scancode){
+      // we press/release mod-key without releasing another key
+      if(last_mod != my_special){
+        SDL_PrivateKeyboard(SDL_RELEASED, &last);
+      }
+    }
+  //}
+
+  /* Set the keysym information */
+  if(scancode >= 'A' && scancode <= 'Z') {
+    // Qt sends uppercase, SDL wants lowercase
+    keysym.sym = static_cast<SDLKey>(scancode + 32);
+  } else if(scancode  >= 0x1000) {
+    // Special keys
+    switch(scancode) {
+      case 0x1031: //Cancel
+        scancode = my_special ? SDLK_a : SDLK_ESCAPE;
+      break;
+      case 0x1004: //Joystick center
+        scancode = my_special ? SDLK_b : SDLK_RETURN;
+      break;
+      case 0x1012: // Qt::Key_Left
+        if (screenRotation == SDL_QT_ROTATION_90) scancode = keyUp();
+        else if (screenRotation == SDL_QT_ROTATION_270) scancode = keyDown();
+        else scancode = keyLeft();
+      break;
+      case 0x1013: // Qt::Key_Up
+        if (screenRotation == SDL_QT_ROTATION_90) scancode = keyRight();
+        else if (screenRotation == SDL_QT_ROTATION_270) scancode = keyLeft();
+        else scancode = keyUp();
+      break;
+      case 0x1014: // Qt::Key_Right
+        if (screenRotation == SDL_QT_ROTATION_90) scancode = keyDown();
+        else if (screenRotation == SDL_QT_ROTATION_270) scancode = keyUp();
+        else scancode = keyRight();
+      break;
+      case 0x1015: // Qt::Key_Down
+        if (screenRotation == SDL_QT_ROTATION_90) scancode = keyLeft();
+        else if (screenRotation == SDL_QT_ROTATION_270) scancode = keyRight();
+        else scancode = keyDown();
+      break;
+      case 0x1005: //special key
+      case 0x104d: //special key
+        if(pressed) my_special = true;
+        else my_special = false;
+      return;
+      case 0x1016: //VolUp
+        scancode = my_special ? SDLK_c : SDLK_PLUS;
+      break;
+      case 0x1017: //VolDown
+        scancode = my_special ? SDLK_d : SDLK_MINUS;
+      break;
+      case 0x1034: //Photo
+        scancode = my_special ? SDLK_e : SDLK_PAUSE;
+      break;
+      case 0x1030: //Call
+        scancode = my_special ? SDLK_f : SDLK_SPACE;
+      break;
+			case 0x104b: //Prev
+				scancode = my_special ? SDLK_k : SDLK_o;
+			break;
+			case 0x1049: //Play
+				scancode = my_special ? SDLK_l : SDLK_p;
+			break;
+			case 0x104c: //Next
+				scancode = my_special ? SDLK_m : SDLK_q;
+			break;
+			case 0x1033: //Browser
+				scancode = my_special ? SDLK_n : SDLK_r;
+			break;
+    
+      default:
+        scancode = SDLK_UNKNOWN;
+      break;
+    }
+    keysym.sym = static_cast<SDLKey>(scancode);    
+  } else {
+    keysym.sym = static_cast<SDLKey>(scancode);    
+  }
+  keysym.scancode = scancode;
+  keysym.mod = KMOD_NONE;
+  if ( SDL_TranslateUNICODE ) {
+    QChar qchar = e->text()[0];
+    keysym.unicode = qchar.unicode();
+  } else {
+    keysym.unicode = 0;
+  }
+
+  last = keysym;
+  last_mod = my_special;
+
+  /* Queue the key event */
+  if ( pressed ) {
+    SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
+  } else {
+    last.scancode = 0;
+    SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
+  }
+}
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_QWin.h SDL-1.2.14-motoezx/src/video/motoezx/SDL_QWin.h
--- SDL-1.2.14/src/video/motoezx/SDL_QWin.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_QWin.h	2009-11-24 06:23:43.000000000 -0500
@@ -0,0 +1,138 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_QWin_h
+#define _SDL_QWin_h
+
+#include <stdio.h>
+
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+#include <linux/fb.h>
+
+#include "SDL_events.h"
+
+extern "C" {
+#include "../../events/SDL_events_c.h"
+};
+
+typedef enum { 
+    SDL_QT_NO_ROTATION = 0, 
+    SDL_QT_ROTATION_90, 
+    SDL_QT_ROTATION_270 
+} screenRotationT;
+
+extern screenRotationT screenRotation;
+
+class QCopChannel;
+class SDL_QWin : public QWidget
+{
+ Q_OBJECT
+ private:
+  enum {
+    EZX_LEFT_BUTTON = 1,
+    EZX_RIGHT_BUTTON = 2
+  };
+  void QueueKey(QKeyEvent *e, int pressed);
+ public:
+  SDL_QWin(const QSize& size);
+  virtual ~SDL_QWin();
+  virtual bool shown(void) {
+    return isVisible();
+  }
+  /* If called, the next resize event will not be forwarded to SDL. */
+  virtual void inhibitResize(void) {
+    my_inhibit_resize = true;
+  }
+  void setImage(QImage *image);
+  void setOffset(int x, int y) {
+    my_offset = QPoint(x, y);
+  }
+  void GetXYOffset(int &x, int &y) {
+    x = my_offset.x();
+    y = my_offset.y();
+  }
+  QImage *image(void) { return my_image; }
+  
+  void setWFlags(WFlags flags) {
+    QWidget::setWFlags(flags);
+    my_flags = flags;
+  }
+  const QPoint& mousePos() const { return my_mouse_pos; }
+  void setMousePos(const QPoint& newpos);
+
+  void repaintRect(const QRect& rect);
+  bool isOK()
+  { return fbdev != -1 && vmem != (char *)-1; }
+  
+ public slots:
+  void channel(const QCString &, const QByteArray &);
+	void signalRaise();
+  //void clickAppIcon();
+  
+ protected:
+  /* Handle resizing of the window */
+  virtual void resizeEvent(QResizeEvent *e);
+#ifdef MOTOEZX_TEST
+  void focusInEvent(QFocusEvent *);
+  void focusOutEvent(QFocusEvent *);
+#endif
+  void timerEvent(QTimerEvent *);
+  void closeEvent(QCloseEvent *e);
+  void mouseMoveEvent(QMouseEvent *e);
+  void mousePressEvent(QMouseEvent *e);
+  void mouseReleaseEvent(QMouseEvent *e);
+  void paintEvent(QPaintEvent *ev);
+  void keyPressEvent(QKeyEvent *e)   { QueueKey(e, 1); }
+  void keyReleaseEvent(QKeyEvent *e) { QueueKey(e, 0); }
+
+ private:
+  void init();
+  void suspend();
+  void resume();
+  
+  int keyUp();
+  int keyDown();
+  int keyLeft();
+  int keyRight();
+
+  int fbdev;
+  char *vmem;
+  size_t vmem_length;
+  QImage *my_image;
+  bool my_inhibit_resize;
+  QPoint my_offset;
+  QPoint my_mouse_pos;
+  WFlags my_flags;
+  unsigned int my_locked;
+  int cur_mouse_button;
+  bool my_special;
+  QCopChannel *qcop;
+  int my_timer;
+  bool my_suspended;
+  SDL_keysym last;
+  bool last_mod;
+};
+
+#endif /* _SDL_QWin_h */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_lowvideo.h SDL-1.2.14-motoezx/src/video/motoezx/SDL_lowvideo.h
--- SDL-1.2.14/src/video/motoezx/SDL_lowvideo.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_lowvideo.h	2009-09-12 07:27:52.000000000 -0400
@@ -0,0 +1,65 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_lowvideo_h
+#define _SDL_lowvideo_h
+
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+
+/* Hidden "this" pointer for the video functions */
+#define _THIS	SDL_VideoDevice *_this
+
+/* Private display data */
+struct SDL_PrivateVideoData {
+  /* The main window */
+  SDL_QWin *SDL_Win;
+
+  /* The fullscreen mode list */
+#define NUM_MODELISTS	4		/* 8, 16, 24, and 32 bits-per-pixel */
+  int SDL_nummodes[NUM_MODELISTS];
+  SDL_Rect **SDL_modelist[NUM_MODELISTS];
+
+  /* A completely clear cursor */
+  WMcursor *BlankCursor;
+
+  /* Mouse state variables */
+  Uint32 last_buttons;
+  QPoint last_point;
+
+  /* Keyboard state variables */
+  int key_flip;
+  //struct key_info keyinfo[2];
+};
+/* Old variable names */
+#define SDL_Win		(_this->hidden->SDL_Win)
+#define saved_mode	(_this->hidden->saved_mode)
+#define SDL_nummodes	(_this->hidden->SDL_nummodes)
+#define SDL_modelist	(_this->hidden->SDL_modelist)
+#define SDL_BlankCursor	(_this->hidden->BlankCursor)
+#define last_buttons	(_this->hidden->last_buttons)
+#define last_point	(_this->hidden->last_point)
+#define key_flip	(_this->hidden->key_flip)
+#define keyinfo		(_this->hidden->keyinfo)
+
+#endif /* _SDL_lowvideo_h */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_sysevents.cc SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysevents.cc
--- SDL-1.2.14/src/video/motoezx/SDL_sysevents.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysevents.cc	2009-12-04 15:14:28.000000000 -0500
@@ -0,0 +1,47 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include <zapplication.h>
+
+#include <stdio.h>
+#include <string.h>
+#include "SDL_error.h"
+#include "SDL_events.h"
+#include "SDL_QWin.h"
+#include "SDL_lowvideo.h"
+#include "SDL_timer.h"
+
+extern "C" {
+
+void QT_PumpEvents(_THIS)
+{
+  if(!qApp) {
+    return; 
+  }
+  qApp->processEvents();
+}
+
+void QT_InitOSKeymap(_THIS)
+{}
+
+}; /* Extern C */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_sysevents_c.h SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysevents_c.h
--- SDL-1.2.14/src/video/motoezx/SDL_sysevents_c.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysevents_c.h	2009-09-12 07:27:52.000000000 -0400
@@ -0,0 +1,31 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_lowvideo.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts 
+   of the native video subsystem (SDL_sysvideo.c)
+*/
+
+extern void QT_InitOSKeymap(_THIS);
+extern void QT_PumpEvents(_THIS);
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_sysmouse.cc SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysmouse.cc
--- SDL-1.2.14/src/video/motoezx/SDL_sysmouse.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysmouse.cc	2009-12-04 15:14:27.000000000 -0500
@@ -0,0 +1,57 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_QWin.h"
+
+extern "C" {
+
+#include "SDL_sysmouse_c.h"
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+	char *bits;
+};
+WMcursor *QT_CreateWMCursor(_THIS,
+		Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
+{
+  static WMcursor dummy;
+  dummy.bits = 0;
+  return &dummy;
+}
+
+int QT_ShowWMCursor(_THIS, WMcursor *cursor)
+{
+  return 1;
+}
+
+void QT_FreeWMCursor(_THIS, WMcursor *cursor)
+{
+}
+
+void QT_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
+{
+  SDL_Win->setMousePos(QPoint(x, y));
+  SDL_PrivateMouseMotion(0, 0, x, y);
+}
+
+}; /* Extern C */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_sysmouse_c.h SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysmouse_c.h
--- SDL-1.2.14/src/video/motoezx/SDL_sysmouse_c.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysmouse_c.h	2009-09-12 07:27:52.000000000 -0400
@@ -0,0 +1,32 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_lowvideo.h"
+
+/* Functions to be exported */
+extern void QT_FreeWMCursor(_THIS, WMcursor *cursor);
+extern WMcursor *QT_CreateWMCursor(_THIS,
+		Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
+extern int QT_ShowWMCursor(_THIS, WMcursor *cursor);
+extern void QT_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
+
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_sysvideo.cc SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysvideo.cc
--- SDL-1.2.14/src/video/motoezx/SDL_sysvideo.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_sysvideo.cc	2009-12-04 16:46:11.000000000 -0500
@@ -0,0 +1,464 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+/* Moto/EzX based framebuffer implementation */
+
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/fb.h>
+
+#include <zapplication.h>
+
+#include "SDL_timer.h"
+#include "SDL_QWin.h"
+
+extern "C" {
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_pixels_c.h"
+#include "SDL_sysevents_c.h"
+#include "SDL_sysmouse_c.h"
+#include "SDL_syswm_c.h"
+#include "SDL_lowvideo.h"
+
+  //#define EZX_DEBUG
+#define QT_HIDDEN_SIZE	32	/* starting hidden window size */
+
+  /* Name of the environment variable used to invert the screen rotation or not:
+     Possible values:
+     !=0 : Screen is 270° rotated
+     0: Screen is 90° rotated*/
+#define SDL_QT_ROTATION_ENV_NAME "SDL_QT_INVERT_ROTATION"
+  
+  /* Initialization/Query functions */
+  static int QT_VideoInit(_THIS, SDL_PixelFormat *vformat);
+  static SDL_Rect **QT_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
+  static SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
+  static void QT_UpdateMouse(_THIS);
+  static int QT_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
+  static void QT_VideoQuit(_THIS);
+
+  /* Hardware surface functions */
+  static int QT_AllocHWSurface(_THIS, SDL_Surface *surface);
+  static int QT_LockHWSurface(_THIS, SDL_Surface *surface);
+  static void QT_UnlockHWSurface(_THIS, SDL_Surface *surface);
+  static void QT_FreeHWSurface(_THIS, SDL_Surface *surface);
+
+  static int QT_ToggleFullScreen(_THIS, int fullscreen);
+
+  static int QT_IconifyWindow(_THIS);
+  static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode);
+
+  /* FB driver bootstrap functions */
+
+  static int QT_Available(void)
+  {
+    return(1);
+  }
+
+  static void QT_DeleteDevice(SDL_VideoDevice *device)
+  {
+    SDL_free(device->hidden);
+    SDL_free(device);
+  }
+
+  static SDL_VideoDevice *QT_CreateDevice(int devindex)
+  {
+    SDL_VideoDevice *device;
+
+    /* Initialize all variables that we clean on shutdown */
+    device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
+    if ( device ) {
+      SDL_memset(device, 0, (sizeof *device));
+      device->hidden = (struct SDL_PrivateVideoData *)
+	SDL_malloc((sizeof *device->hidden));
+    }
+    if ( (device == NULL) || (device->hidden == NULL) ) {
+      SDL_OutOfMemory();
+      if ( device ) {
+	SDL_free(device);
+      }
+      return(0);
+    }
+    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
+
+    /* Set the function pointers */
+    device->VideoInit = QT_VideoInit;
+    device->ListModes = QT_ListModes;
+    device->SetVideoMode = QT_SetVideoMode;
+    device->UpdateMouse = QT_UpdateMouse;
+    device->SetColors = QT_SetColors;
+    device->UpdateRects = NULL;
+    device->VideoQuit = QT_VideoQuit;
+    device->AllocHWSurface = QT_AllocHWSurface;
+    device->CheckHWBlit = NULL;
+    device->FillHWRect = NULL;
+    device->SetHWColorKey = NULL;
+    device->SetHWAlpha = NULL;
+    device->LockHWSurface = QT_LockHWSurface;
+    device->UnlockHWSurface = QT_UnlockHWSurface;
+    device->FlipHWSurface = NULL;
+    device->FreeHWSurface = QT_FreeHWSurface;
+    device->SetIcon = NULL;
+    device->SetCaption = QT_SetWMCaption;
+    device->IconifyWindow = QT_IconifyWindow;
+    device->GrabInput = QT_GrabInput;
+    device->GetWMInfo = NULL;
+    device->FreeWMCursor = QT_FreeWMCursor;
+    device->CreateWMCursor = QT_CreateWMCursor;
+    device->ShowWMCursor = QT_ShowWMCursor;
+    device->WarpWMCursor = QT_WarpWMCursor;
+    device->InitOSKeymap = QT_InitOSKeymap;
+    device->PumpEvents = QT_PumpEvents;
+
+    device->free = QT_DeleteDevice;
+    device->ToggleFullScreen = QT_ToggleFullScreen;
+
+    /* Set the driver flags */
+    device->handles_any_size = 0;
+	
+    return device;
+  }
+
+  VideoBootStrap EzX_bootstrap = {
+    "EzX", "Motorola / EzX graphics",
+    QT_Available, QT_CreateDevice
+  };
+
+  /* Function to sort the display_list */
+  static int CompareModes(const void *A, const void *B)
+  {
+#if 0
+    const display_mode *a = (display_mode *)A;
+    const display_mode *b = (display_mode *)B;
+
+    if ( a->space == b->space ) {
+      return((b->virtual_width*b->virtual_height)-
+	     (a->virtual_width*a->virtual_height));
+    } else {
+      return(ColorSpaceToBitsPerPixel(b->space)-
+	     ColorSpaceToBitsPerPixel(a->space));
+    }
+#endif
+    return 0;
+  }
+
+  /* Yes, this isn't the fastest it could be, but it works nicely */
+  static int QT_AddMode(_THIS, int index, unsigned int w, unsigned int h)
+  {
+    SDL_Rect *mode;
+    int i;
+    int next_mode;
+
+    /* Check to see if we already have this mode */
+    if ( SDL_nummodes[index] > 0 ) {
+      for ( i=SDL_nummodes[index]-1; i >= 0; --i ) {
+	mode = SDL_modelist[index][i];
+	if ( (mode->w == w) && (mode->h == h) ) {
+	  return(0);
+	}
+      }
+    }
+
+    /* Set up the new video mode rectangle */
+    mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
+    if ( mode == NULL ) {
+      SDL_OutOfMemory();
+      return(-1);
+    }
+    mode->x = 0;
+    mode->y = 0;
+    mode->w = w;
+    mode->h = h;
+#ifdef EZX_DEBUG
+    fprintf(stderr, "Adding mode %dx%d at %d bytes per pixel\n", w, h, index+1);
+#endif
+
+    /* Allocate the new list of modes, and fill in the new mode */
+    next_mode = SDL_nummodes[index];
+    SDL_modelist[index] = (SDL_Rect **)
+      SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
+    if ( SDL_modelist[index] == NULL ) {
+      SDL_OutOfMemory();
+      SDL_nummodes[index] = 0;
+      SDL_free(mode);
+      return(-1);
+    }
+    SDL_modelist[index][next_mode] = mode;
+    SDL_modelist[index][next_mode+1] = NULL;
+    SDL_nummodes[index]++;
+
+    return(0);
+  }
+
+  extern void SDL_HideSplash();
+  int QT_VideoInit(_THIS, SDL_PixelFormat *vformat)
+  {
+    SDL_HideSplash();
+    /* Initialize the EzX Application  */
+    /* Determine the screen depth */
+    vformat->BitsPerPixel = 16; //QPixmap::defaultDepth();
+
+    // For now we hardcode the current depth because anything else
+    // might as well be emulated by SDL rather than by EzX.
+    
+    QSize desktop_size = qApp->desktop()->size();
+//    QSize desktop_size = QSize(240,320);
+
+    QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1,
+	       desktop_size.width(), desktop_size.height());
+    QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1,
+	       desktop_size.height(), desktop_size.width());
+
+    /* Determine the current screen size */
+    _this->info.current_w = desktop_size.width();
+    _this->info.current_h = desktop_size.height();
+
+    /* Create the window / widget */
+    SDL_Win = new SDL_QWin(QSize(QT_HIDDEN_SIZE, QT_HIDDEN_SIZE));
+    if(!SDL_Win->isOK()){
+      delete SDL_Win;
+      SDL_Win = 0;
+      return -1;
+    }
+    qApp->setMainWidget(SDL_Win);
+    SDL_Win->show();
+    //SDL_Win->hide();
+
+    /* Fill in some window manager capabilities */
+    _this->info.wm_available = 0;
+
+    struct fb_var_screeninfo fbi;
+    Uint32 r = 0, g = 0, b = 0, a = 0;
+        
+    fbi.red.length = 5;
+    fbi.red.offset = 11;
+    fbi.green.length = 6;
+    fbi.green.offset = 5;
+    fbi.blue.length = 5;
+    fbi.blue.offset = 0;
+    fbi.transp.length = 0;
+    fbi.transp.offset = 0;
+
+    int i;
+    for(i = 0; i < fbi.red.length; i++){
+      r <<= 1;
+      r |= 1 << fbi.red.offset;
+    }
+
+    for(i = 0; i < fbi.blue.length; i++){
+      b <<= 1;
+      b |= 1 << fbi.blue.offset;
+    }
+
+    for(i = 0; i < fbi.green.length; i++){
+      g <<= 1;
+      g |= 1 << fbi.green.offset;
+    }
+    
+    for(i = 0; i < fbi.transp.length; i++){
+      a <<= 1;
+      a |= 1 << fbi.transp.offset;
+    }
+
+    vformat->Rmask = r;
+    vformat->Gmask = g;
+    vformat->Bmask = b;
+    vformat->Amask = a;
+    
+    vformat->Rshift = fbi.red.offset;
+    vformat->Gshift = fbi.green.offset;
+    vformat->Bshift = fbi.blue.offset;
+    vformat->Ashift = fbi.transp.offset;
+    
+    vformat->Rloss = 8 - fbi.red.length;
+    vformat->Gloss = 8 - fbi.green.length;
+    vformat->Bloss = 8 - fbi.blue.length;
+    vformat->Aloss = 8 - fbi.transp.length;
+    /* We're done! */
+    return(0);
+  }
+
+  /* We support any dimension at our bit-depth */
+  SDL_Rect **QT_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
+  {
+    SDL_Rect **modes;
+
+    modes = ((SDL_Rect **)0);
+    if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
+      modes = SDL_modelist[((format->BitsPerPixel+7)/8)-1];
+    } else {
+      if ( format->BitsPerPixel ==
+	   _this->screen->format->BitsPerPixel ) {
+	modes = ((SDL_Rect **)-1);
+      }
+    }
+    return(modes);
+  }
+
+  /* Various screen update functions available */
+  static void QT_NormalUpdate(_THIS, int numrects, SDL_Rect *rects);
+
+  static int QT_SetFullScreen(_THIS, SDL_Surface *screen, int fullscreen)
+  {
+    return -1;
+  }
+
+  static int QT_ToggleFullScreen(_THIS, int fullscreen)
+  {
+    return -1;
+  }
+
+  /* FIXME: check return values and cleanup here */
+  SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current,
+			       int width, int height, int bpp, Uint32 flags)
+  {
+    QImage *qimage;
+    QSize desktop_size = qApp->desktop()->size();
+
+    current->flags = 0; //SDL_FULLSCREEN; // We always run fullscreen.
+
+    if (width <= desktop_size.width()
+	      && height <= desktop_size.height()) {
+      current->w = desktop_size.width();
+      current->h = desktop_size.height();
+      printf("portrait mode\n");
+    } else if(width <= desktop_size.height() && height <= desktop_size.width()) {
+      // Landscape mode
+      printf("landscape mode\n");
+      char * envString = SDL_getenv(SDL_QT_ROTATION_ENV_NAME);
+      int envValue = envString ? atoi(envString) : 0;
+      screenRotation = envValue ? SDL_QT_ROTATION_270 : SDL_QT_ROTATION_90;
+      current->h = desktop_size.width();
+      current->w = desktop_size.height();
+    } else {
+      SDL_SetError("Unsupported resolution, %dx%d\n", width, height);
+    }
+    if ( flags & SDL_OPENGL ) {
+      SDL_SetError("OpenGL not supported");
+      return(NULL);
+    } 
+    /* Create the QImage framebuffer */
+    qimage = new QImage(current->w, current->h, bpp);
+    if (qimage->isNull()) {
+      SDL_SetError("Couldn't create screen bitmap");
+      delete qimage;
+      return(NULL);
+    }
+    current->pitch = qimage->bytesPerLine();
+    current->pixels = (void *)qimage->bits();
+    SDL_Win->setImage(qimage);
+    _this->UpdateRects = QT_NormalUpdate;
+    /* We're done */
+    return(current);
+  }
+
+  /* Update the current mouse state and position */
+  void QT_UpdateMouse(_THIS)
+  {
+    QPoint point(-1, -1);
+    if ( SDL_Win->isActiveWindow() ) {
+      point = SDL_Win->mousePos();
+    }
+    
+    if ( (point.x() >= 0) && (point.x() < SDL_VideoSurface->w) &&
+	 (point.y() >= 0) && (point.y() < SDL_VideoSurface->h) ) {
+      SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+      SDL_PrivateMouseMotion(0, 0,
+			     (Sint16)point.x(), (Sint16)point.y());
+    } else {
+      SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
+    }
+  }
+
+  /* We don't actually allow hardware surfaces other than the main one */
+  static int QT_AllocHWSurface(_THIS, SDL_Surface *surface)
+  {
+    return(-1);
+  }
+  static void QT_FreeHWSurface(_THIS, SDL_Surface *surface)
+  {
+    return;
+  }
+  static int QT_LockHWSurface(_THIS, SDL_Surface *surface)
+  {
+    return(0);
+  }
+  static void QT_UnlockHWSurface(_THIS, SDL_Surface *surface)
+  {
+    return;
+  }
+
+  static void QT_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
+  {
+      for(int i=0; i<numrects; ++i ) {
+	QRect rect(rects[i].x, rects[i].y,
+		   rects[i].w, rects[i].h);
+	SDL_Win->repaintRect(rect);
+      }
+  }
+  /* Is the system palette settable? */
+  int QT_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
+  {
+    return -1;
+  }
+
+  void QT_VideoQuit(_THIS)
+  {
+    // This is dumb, but if I free this, the app doesn't exit correctly.
+    // Of course, this will leak memory if init video is done more than once.
+    // Sucks but such is life.
+    
+    //    -- David Hedbor
+    //    delete SDL_Win; 
+    //    SDL_Win = 0;
+    _this->screen->pixels = NULL;
+    if(SDL_Win){
+      QT_GrabInput(_this, SDL_GRAB_OFF);
+      delete SDL_Win;
+      SDL_Win = 0;
+    }
+  }
+
+  static int QT_IconifyWindow(_THIS) {
+    SDL_Win->hide();
+    return true;
+  }
+
+  static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode) {
+    /*if(mode == SDL_GRAB_OFF) {
+      qApp->mainWidget()->grabKeyboard();
+      qApp->processEvents();
+      qApp->mainWidget()->releaseKeyboard();
+    } else {
+      qApp->mainWidget()->grabKeyboard();
+    }
+    qApp->processEvents();*/
+    return mode;
+  }
+  
+}; /* Extern C */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_syswm.cc SDL-1.2.14-motoezx/src/video/motoezx/SDL_syswm.cc
--- SDL-1.2.14/src/video/motoezx/SDL_syswm.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_syswm.cc	2009-12-04 15:14:34.000000000 -0500
@@ -0,0 +1,35 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_QWin.h"
+
+extern "C" {
+
+#include "SDL_syswm_c.h"
+
+void QT_SetWMCaption(_THIS, const char *title, const char *icon)
+{
+	SDL_Win->setCaption(title);
+}
+
+}; /* Extern C */
diff -Nru SDL-1.2.14/src/video/motoezx/SDL_syswm_c.h SDL-1.2.14-motoezx/src/video/motoezx/SDL_syswm_c.h
--- SDL-1.2.14/src/video/motoezx/SDL_syswm_c.h	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/SDL_syswm_c.h	2009-09-12 07:27:52.000000000 -0400
@@ -0,0 +1,28 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_lowvideo.h"
+
+/* Functions to be exported */
+extern void QT_SetWMCaption(_THIS, const char *title, const char *icon);
+
diff -Nru SDL-1.2.14/src/video/motoezx/mocSDL_QWin.cc SDL-1.2.14-motoezx/src/video/motoezx/mocSDL_QWin.cc
--- SDL-1.2.14/src/video/motoezx/mocSDL_QWin.cc	1969-12-31 19:00:00.000000000 -0500
+++ SDL-1.2.14-motoezx/src/video/motoezx/mocSDL_QWin.cc	2009-12-04 15:14:41.000000000 -0500
@@ -0,0 +1,102 @@
+/****************************************************************************
+** SDL_QWin meta object code from reading C++ file 'SDL_QWin.h'
+**
+** Created: Sat May 10 12:49:51 2008
+**      by: The Qt MOC ($Id: qt/src/moc/moc.y   2.3.6   edited 2002-11-27 $)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#define Q_MOC_OUTPUT_REVISION 9
+#elif Q_MOC_OUTPUT_REVISION != 9
+#error "Moc format conflict - please regenerate all moc files"
+#endif
+
+#include "SDL_QWin.h"
+#include <qmetaobject.h>
+#include <qapplication.h>
+#ifdef QWS
+#include <qobjectdict.h>
+#endif
+
+
+
+const char *SDL_QWin::className() const
+{
+    return "SDL_QWin";
+}
+
+QMetaObject *SDL_QWin::metaObj = 0;
+
+#ifdef QWS
+static class SDL_QWin_metaObj_Unloader {
+public:
+    ~SDL_QWin_metaObj_Unloader()
+    {
+         if ( objectDict )
+             objectDict->remove( "SDL_QWin" );
+    }
+} SDL_QWin_metaObj_unloader;
+#endif
+
+void SDL_QWin::initMetaObject()
+{
+    if ( metaObj )
+	return;
+    if ( qstrcmp(QWidget::className(), "QWidget") != 0 )
+	badSuperclassWarning("SDL_QWin","QWidget");
+    (void) staticMetaObject();
+}
+
+#ifndef QT_NO_TRANSLATION
+
+QString SDL_QWin::tr(const char* s)
+{
+    return qApp->translate( "SDL_QWin", s, 0 );
+}
+
+QString SDL_QWin::tr(const char* s, const char * c)
+{
+    return qApp->translate( "SDL_QWin", s, c );
+}
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* SDL_QWin::staticMetaObject()
+{
+    if ( metaObj )
+	return metaObj;
+    (void) QWidget::staticMetaObject();
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+    typedef void (SDL_QWin::*m1_t0)(const QCString&,const QByteArray&);
+    typedef void (QObject::*om1_t0)(const QCString&,const QByteArray&);
+    typedef void (SDL_QWin::*m1_t1)();
+    typedef void (QObject::*om1_t1)();
+    m1_t0 v1_0 = &SDL_QWin::channel;
+    om1_t0 ov1_0 = (om1_t0)v1_0;
+    m1_t1 v1_1 = &SDL_QWin::signalRaise;
+    om1_t1 ov1_1 = (om1_t1)v1_1;
+    QMetaData *slot_tbl = QMetaObject::new_metadata(2);
+    QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(2);
+    slot_tbl[0].name = "channel(const QCString&,const QByteArray&)";
+    slot_tbl[0].ptr = (QMember)ov1_0;
+    slot_tbl_access[0] = QMetaData::Public;
+    slot_tbl[1].name = "signalRaise()";
+    slot_tbl[1].ptr = (QMember)ov1_1;
+    slot_tbl_access[1] = QMetaData::Public;
+    metaObj = QMetaObject::new_metaobject(
+	"SDL_QWin", "QWidget",
+	slot_tbl, 2,
+	0, 0,
+#ifndef QT_NO_PROPERTIES
+	0, 0,
+	0, 0,
+#endif // QT_NO_PROPERTIES
+	0, 0 );
+    metaObj->set_slot_access( slot_tbl_access );
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+    return metaObj;
+}
diff -Nru SDL-1.2.14/test/checkkeys.c SDL-1.2.14-motoezx/test/checkkeys.c
--- SDL-1.2.14/test/checkkeys.c	2009-10-12 19:07:19.000000000 -0400
+++ SDL-1.2.14-motoezx/test/checkkeys.c	2009-12-04 12:06:33.000000000 -0500
@@ -106,8 +106,8 @@
 	}
 
 	/* Set 640x480 video mode */
-	if ( SDL_SetVideoMode(640, 480, 0, videoflags) == NULL ) {
-		fprintf(stderr, "Couldn't set 640x480 video mode: %s\n",
+	if ( SDL_SetVideoMode(320, 240, 0, videoflags) == NULL ) {
+		fprintf(stderr, "Couldn't set 320x240 video mode: %s\n",
 							SDL_GetError());
 		quit(2);
 	}
diff -Nru SDL-1.2.14/test/testsprite.c SDL-1.2.14-motoezx/test/testsprite.c
--- SDL-1.2.14/test/testsprite.c	2009-10-12 19:07:19.000000000 -0400
+++ SDL-1.2.14-motoezx/test/testsprite.c	2009-11-02 05:03:51.000000000 -0500
@@ -168,9 +168,9 @@
 
 	numsprites = NUM_SPRITES;
 	videoflags = SDL_SWSURFACE|SDL_ANYFORMAT;
-	width = 640;
-	height = 480;
-	video_bpp = 8;
+	width = 240;
+	height = 320;
+	video_bpp = 18;
 	debug_flip = 0;
 	while ( argc > 1 ) {
 		--argc;
@@ -296,9 +296,11 @@
 		while ( SDL_PollEvent(&event) ) {
 			switch (event.type) {
 				case SDL_MOUSEBUTTONDOWN:
+          printf("mouse: %d %d\n", event.button.x, event.button.y);
 					SDL_WarpMouse(screen->w/2, screen->h/2);
 					break;
 				case SDL_KEYDOWN:
+          printf("key\n");
 					/* Any keypress quits the app... */
 				case SDL_QUIT:
 					done = 1;
diff -Nru SDL-1.2.14/test/testwin.c SDL-1.2.14-motoezx/test/testwin.c
--- SDL-1.2.14/test/testwin.c	2009-10-12 19:07:19.000000000 -0400
+++ SDL-1.2.14-motoezx/test/testwin.c	2009-11-02 05:09:27.000000000 -0500
@@ -231,7 +231,7 @@
 	return;
 }
 
-int main(int argc, char *argv[])
+int SDL_main(int argc, char *argv[])
 {
 	SDL_Surface *screen;
 	/* Options */
@@ -249,17 +249,17 @@
 	nofade = 0;
 	delay = 1;
 
-#ifdef _WIN32_WCE
+//#ifdef _WIN32_WCE
 	w = 240;
 	h = 320;
-	desired_bpp = 8;
+	desired_bpp = 18;
 	video_flags = SDL_FULLSCREEN;
-#else
-	w = 640;
-	h = 480;
-	desired_bpp = 0;
-	video_flags = 0;
-#endif
+/*#else*/
+/*	w = 640;*/
+/*	h = 480;*/
+/*	desired_bpp = 0;*/
+/*	video_flags = 0;*/
+/*#endif*/
 	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
 		fprintf(stderr,
 			"Couldn't initialize SDL: %s\n", SDL_GetError());
