revision 964:f2f3c7612d06
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 964:f2f3c7612d06 |
parent | 963:1c3a0f67c603 |
child | 965:fc39a6608851 |
author | nkeynes |
date | Thu Jan 15 04:15:11 2009 +0000 (15 years ago) |
Add support for the Intel ICC compiler (C only, icc doesn't support Obj-C)
- Rename Obj-C source to .m
- Separate paths.c into paths_unix.c and paths_osx.m
- Add configuration detection of ICC, along with specific opt flags
- Rename Obj-C source to .m
- Separate paths.c into paths_unix.c and paths_osx.m
- Add configuration detection of ICC, along with specific opt flags
1.1 --- a/Makefile.in Thu Jan 15 03:54:21 2009 +00001.2 +++ b/Makefile.in Thu Jan 15 04:15:11 2009 +00001.3 @@ -173,6 +173,10 @@1.4 MKINSTALLDIRS = @MKINSTALLDIRS@1.5 MSGFMT = @MSGFMT@1.6 MSGFMT_OPTS = @MSGFMT_OPTS@1.7 +OBJC = @OBJC@1.8 +OBJCDEPMODE = @OBJCDEPMODE@1.9 +OBJCFLAGS = @OBJCFLAGS@1.10 +OBJCPP = @OBJCPP@1.11 OBJEXT = @OBJEXT@1.12 PACKAGE = @PACKAGE@1.13 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@1.14 @@ -190,6 +194,7 @@1.15 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@1.16 PULSE_CFLAGS = @PULSE_CFLAGS@1.17 PULSE_LIBS = @PULSE_LIBS@1.18 +SED = @SED@1.19 SET_MAKE = @SET_MAKE@1.20 SHCC = @SHCC@1.21 SHELL = @SHELL@1.22 @@ -206,8 +211,11 @@1.23 VIDEO_OSMESA_TRUE = @VIDEO_OSMESA_TRUE@1.24 XGETTEXT = @XGETTEXT@1.25 ac_ct_CC = @ac_ct_CC@1.26 +ac_ct_OBJC = @ac_ct_OBJC@1.27 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@1.28 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@1.29 +am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@1.30 +am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@1.31 am__include = @am__include@1.32 am__leading_dot = @am__leading_dot@1.33 am__quote = @am__quote@
2.1 --- a/acinclude.m4 Thu Jan 15 03:54:21 2009 +00002.2 +++ b/acinclude.m4 Thu Jan 15 04:15:11 2009 +00002.3 @@ -51,4 +51,41 @@2.4 $2 ])2.5 ])2.7 +# AC_CC_VERSION([if-gcc], [if-icc],[if-other])2.8 +# Check which C compiler we're using and branch accordingly, eg to set2.9 +# different optimization flags. Currently recognizes gcc and icc2.10 +# ---------------2.11 +AC_DEFUN([AC_CC_VERSION], [2.12 +_GCC_VERSION=`$CC --version | $SED -ne '/(GCC)/p'`2.13 +_ICC_VERSION=`$CC --version | $SED -ne '/(ICC)/p'`2.14 +AC_MSG_CHECKING([CC version])2.15 +if test -n "$_GCC_VERSION"; then2.16 + AC_MSG_RESULT([GCC])2.17 + [ $1 ]2.18 +elif test -n "$_ICC_VERSION"; then2.19 + AC_MSG_RESULT([ICC])2.20 + [ $2 ]2.21 +else2.22 + AC_MSG_RESULT([Unknown])2.23 + [ $3 ]2.24 +fi2.25 +]);2.27 +# AC_OBJC_VERSION([if-gcc],[if-other], [if-none])2.28 +# Check which objective C compiler we're using and branch accordingly.2.29 +AC_DEFUN([AC_OBJC_VERSION], [2.30 +AC_MSG_CHECKING([OBJC version])2.31 +if test -n "$OBJC"; then2.32 + _GOBJC_VERSION=`$OBJC --version | $SED -ne '/(GCC)/p'`2.33 + if test -n "$_GOBJC_VERSION"; then2.34 + AC_MSG_RESULT([GCC])2.35 + [ $1 ]2.36 + else2.37 + AC_MSG_RESULT([Unknown])2.38 + [ $2 ]2.39 + fi2.40 +else2.41 + AC_MSG_RESULT([None])2.42 + [ $3 ]2.43 +fi2.44 +]);
3.1 --- a/configure Thu Jan 15 03:54:21 2009 +00003.2 +++ b/configure Thu Jan 15 04:15:11 2009 +00003.3 @@ -712,6 +712,10 @@3.4 CCDEPMODE3.5 am__fastdepCC_TRUE3.6 am__fastdepCC_FALSE3.7 +OBJC3.8 +OBJCFLAGS3.9 +ac_ct_OBJC3.10 +SED3.11 CCAS3.12 CCASFLAGS3.13 CPP3.14 @@ -725,8 +729,12 @@3.15 host_cpu3.16 host_vendor3.17 host_os3.18 +OBJCDEPMODE3.19 +am__fastdepOBJC_TRUE3.20 +am__fastdepOBJC_FALSE3.21 POD2MAN3.22 POD2HTML3.23 +OBJCPP3.24 GUI_COCOA_TRUE3.25 GUI_COCOA_FALSE3.26 PKG_CONFIG3.27 @@ -822,9 +830,12 @@3.28 LDFLAGS3.29 LIBS3.30 CPPFLAGS3.31 +OBJC3.32 +OBJCFLAGS3.33 CCAS3.34 CCASFLAGS3.35 CPP3.36 +OBJCPP3.37 PKG_CONFIG3.38 LIBPNG_CFLAGS3.39 LIBPNG_LIBS3.40 @@ -1498,9 +1509,12 @@3.41 LIBS libraries to pass to the linker, e.g. -l<library>3.42 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if3.43 you have headers in a nonstandard directory <include dir>3.44 + OBJC Objective C compiler command3.45 + OBJCFLAGS Objective C compiler flags3.46 CCAS assembler compiler command (defaults to CC)3.47 CCASFLAGS assembler compiler flags (defaults to CFLAGS)3.48 CPP C preprocessor3.49 + OBJCPP Objective C preprocessor3.50 PKG_CONFIG path to pkg-config utility3.51 LIBPNG_CFLAGS3.52 C compiler flags for LIBPNG, overriding pkg-config3.53 @@ -5233,6 +5247,447 @@3.55 am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc3.57 +ac_ext=m3.58 +ac_cpp='$OBJCPP $CPPFLAGS'3.59 +ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.60 +ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.61 +ac_compiler_gnu=$ac_cv_objc_compiler_gnu3.62 +if test -n "$ac_tool_prefix"; then3.63 + for ac_prog in gcc objcc objc cc CC3.64 + do3.65 + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.3.66 +set dummy $ac_tool_prefix$ac_prog; ac_word=$23.67 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&53.68 +$as_echo_n "checking for $ac_word... " >&6; }3.69 +if test "${ac_cv_prog_OBJC+set}" = set; then3.70 + $as_echo_n "(cached) " >&63.71 +else3.72 + if test -n "$OBJC"; then3.73 + ac_cv_prog_OBJC="$OBJC" # Let the user override the test.3.74 +else3.75 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR3.76 +for as_dir in $PATH3.77 +do3.78 + IFS=$as_save_IFS3.79 + test -z "$as_dir" && as_dir=.3.80 + for ac_exec_ext in '' $ac_executable_extensions; do3.81 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then3.82 + ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog"3.83 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&53.84 + break 23.85 + fi3.86 +done3.87 +done3.88 +IFS=$as_save_IFS3.89 +3.90 +fi3.91 +fi3.92 +OBJC=$ac_cv_prog_OBJC3.93 +if test -n "$OBJC"; then3.94 + { $as_echo "$as_me:$LINENO: result: $OBJC" >&53.95 +$as_echo "$OBJC" >&6; }3.96 +else3.97 + { $as_echo "$as_me:$LINENO: result: no" >&53.98 +$as_echo "no" >&6; }3.99 +fi3.100 +3.101 +3.102 + test -n "$OBJC" && break3.103 + done3.104 +fi3.105 +if test -z "$OBJC"; then3.106 + ac_ct_OBJC=$OBJC3.107 + for ac_prog in gcc objcc objc cc CC3.108 +do3.109 + # Extract the first word of "$ac_prog", so it can be a program name with args.3.110 +set dummy $ac_prog; ac_word=$23.111 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&53.112 +$as_echo_n "checking for $ac_word... " >&6; }3.113 +if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then3.114 + $as_echo_n "(cached) " >&63.115 +else3.116 + if test -n "$ac_ct_OBJC"; then3.117 + ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test.3.118 +else3.119 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR3.120 +for as_dir in $PATH3.121 +do3.122 + IFS=$as_save_IFS3.123 + test -z "$as_dir" && as_dir=.3.124 + for ac_exec_ext in '' $ac_executable_extensions; do3.125 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then3.126 + ac_cv_prog_ac_ct_OBJC="$ac_prog"3.127 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&53.128 + break 23.129 + fi3.130 +done3.131 +done3.132 +IFS=$as_save_IFS3.133 +3.134 +fi3.135 +fi3.136 +ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC3.137 +if test -n "$ac_ct_OBJC"; then3.138 + { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJC" >&53.139 +$as_echo "$ac_ct_OBJC" >&6; }3.140 +else3.141 + { $as_echo "$as_me:$LINENO: result: no" >&53.142 +$as_echo "no" >&6; }3.143 +fi3.144 +3.145 +3.146 + test -n "$ac_ct_OBJC" && break3.147 +done3.148 +3.149 + if test "x$ac_ct_OBJC" = x; then3.150 + OBJC="gcc"3.151 + else3.152 + case $cross_compiling:$ac_tool_warned in3.153 +yes:)3.154 +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools3.155 +whose name does not start with the host triplet. If you think this3.156 +configuration is useful to you, please write to autoconf@gnu.org." >&53.157 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools3.158 +whose name does not start with the host triplet. If you think this3.159 +configuration is useful to you, please write to autoconf@gnu.org." >&2;}3.160 +ac_tool_warned=yes ;;3.161 +esac3.162 + OBJC=$ac_ct_OBJC3.163 + fi3.164 +fi3.165 +3.166 +# Provide some information about the compiler.3.167 +$as_echo "$as_me:$LINENO: checking for Objective C compiler version" >&53.168 +set X $ac_compile3.169 +ac_compiler=$23.170 +{ (ac_try="$ac_compiler --version >&5"3.171 +case "(($ac_try" in3.172 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.173 + *) ac_try_echo=$ac_try;;3.174 +esac3.175 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.176 +$as_echo "$ac_try_echo") >&53.177 + (eval "$ac_compiler --version >&5") 2>&53.178 + ac_status=$?3.179 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.180 + (exit $ac_status); }3.181 +{ (ac_try="$ac_compiler -v >&5"3.182 +case "(($ac_try" in3.183 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.184 + *) ac_try_echo=$ac_try;;3.185 +esac3.186 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.187 +$as_echo "$ac_try_echo") >&53.188 + (eval "$ac_compiler -v >&5") 2>&53.189 + ac_status=$?3.190 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.191 + (exit $ac_status); }3.192 +{ (ac_try="$ac_compiler -V >&5"3.193 +case "(($ac_try" in3.194 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.195 + *) ac_try_echo=$ac_try;;3.196 +esac3.197 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.198 +$as_echo "$ac_try_echo") >&53.199 + (eval "$ac_compiler -V >&5") 2>&53.200 + ac_status=$?3.201 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.202 + (exit $ac_status); }3.203 +3.204 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Objective C compiler" >&53.205 +$as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }3.206 +if test "${ac_cv_objc_compiler_gnu+set}" = set; then3.207 + $as_echo_n "(cached) " >&63.208 +else3.209 + cat >conftest.$ac_ext <<_ACEOF3.210 +/* confdefs.h. */3.211 +_ACEOF3.212 +cat confdefs.h >>conftest.$ac_ext3.213 +cat >>conftest.$ac_ext <<_ACEOF3.214 +/* end confdefs.h. */3.215 +3.216 +int3.217 +main ()3.218 +{3.219 +#ifndef __GNUC__3.220 + choke me3.221 +#endif3.222 +3.223 + ;3.224 + return 0;3.225 +}3.226 +_ACEOF3.227 +rm -f conftest.$ac_objext3.228 +if { (ac_try="$ac_compile"3.229 +case "(($ac_try" in3.230 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.231 + *) ac_try_echo=$ac_try;;3.232 +esac3.233 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.234 +$as_echo "$ac_try_echo") >&53.235 + (eval "$ac_compile") 2>conftest.er13.236 + ac_status=$?3.237 + grep -v '^ *+' conftest.er1 >conftest.err3.238 + rm -f conftest.er13.239 + cat conftest.err >&53.240 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.241 + (exit $ac_status); } && {3.242 + test -z "$ac_objc_werror_flag" ||3.243 + test ! -s conftest.err3.244 + } && test -s conftest.$ac_objext; then3.245 + ac_compiler_gnu=yes3.246 +else3.247 + $as_echo "$as_me: failed program was:" >&53.248 +sed 's/^/| /' conftest.$ac_ext >&53.249 +3.250 + ac_compiler_gnu=no3.251 +fi3.252 +3.253 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.254 +ac_cv_objc_compiler_gnu=$ac_compiler_gnu3.255 +3.256 +fi3.257 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objc_compiler_gnu" >&53.258 +$as_echo "$ac_cv_objc_compiler_gnu" >&6; }3.259 +if test $ac_compiler_gnu = yes; then3.260 + GOBJC=yes3.261 +else3.262 + GOBJC=3.263 +fi3.264 +ac_test_OBJCFLAGS=${OBJCFLAGS+set}3.265 +ac_save_OBJCFLAGS=$OBJCFLAGS3.266 +{ $as_echo "$as_me:$LINENO: checking whether $OBJC accepts -g" >&53.267 +$as_echo_n "checking whether $OBJC accepts -g... " >&6; }3.268 +if test "${ac_cv_prog_objc_g+set}" = set; then3.269 + $as_echo_n "(cached) " >&63.270 +else3.271 + ac_save_objc_werror_flag=$ac_objc_werror_flag3.272 + ac_objc_werror_flag=yes3.273 + ac_cv_prog_objc_g=no3.274 + OBJCFLAGS="-g"3.275 + cat >conftest.$ac_ext <<_ACEOF3.276 +/* confdefs.h. */3.277 +_ACEOF3.278 +cat confdefs.h >>conftest.$ac_ext3.279 +cat >>conftest.$ac_ext <<_ACEOF3.280 +/* end confdefs.h. */3.281 +3.282 +int3.283 +main ()3.284 +{3.285 +3.286 + ;3.287 + return 0;3.288 +}3.289 +_ACEOF3.290 +rm -f conftest.$ac_objext3.291 +if { (ac_try="$ac_compile"3.292 +case "(($ac_try" in3.293 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.294 + *) ac_try_echo=$ac_try;;3.295 +esac3.296 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.297 +$as_echo "$ac_try_echo") >&53.298 + (eval "$ac_compile") 2>conftest.er13.299 + ac_status=$?3.300 + grep -v '^ *+' conftest.er1 >conftest.err3.301 + rm -f conftest.er13.302 + cat conftest.err >&53.303 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.304 + (exit $ac_status); } && {3.305 + test -z "$ac_objc_werror_flag" ||3.306 + test ! -s conftest.err3.307 + } && test -s conftest.$ac_objext; then3.308 + ac_cv_prog_objc_g=yes3.309 +else3.310 + $as_echo "$as_me: failed program was:" >&53.311 +sed 's/^/| /' conftest.$ac_ext >&53.312 +3.313 + OBJCFLAGS=""3.314 + cat >conftest.$ac_ext <<_ACEOF3.315 +/* confdefs.h. */3.316 +_ACEOF3.317 +cat confdefs.h >>conftest.$ac_ext3.318 +cat >>conftest.$ac_ext <<_ACEOF3.319 +/* end confdefs.h. */3.320 +3.321 +int3.322 +main ()3.323 +{3.324 +3.325 + ;3.326 + return 0;3.327 +}3.328 +_ACEOF3.329 +rm -f conftest.$ac_objext3.330 +if { (ac_try="$ac_compile"3.331 +case "(($ac_try" in3.332 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.333 + *) ac_try_echo=$ac_try;;3.334 +esac3.335 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.336 +$as_echo "$ac_try_echo") >&53.337 + (eval "$ac_compile") 2>conftest.er13.338 + ac_status=$?3.339 + grep -v '^ *+' conftest.er1 >conftest.err3.340 + rm -f conftest.er13.341 + cat conftest.err >&53.342 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.343 + (exit $ac_status); } && {3.344 + test -z "$ac_objc_werror_flag" ||3.345 + test ! -s conftest.err3.346 + } && test -s conftest.$ac_objext; then3.347 + :3.348 +else3.349 + $as_echo "$as_me: failed program was:" >&53.350 +sed 's/^/| /' conftest.$ac_ext >&53.351 +3.352 + ac_objc_werror_flag=$ac_save_objc_werror_flag3.353 + OBJCFLAGS="-g"3.354 + cat >conftest.$ac_ext <<_ACEOF3.355 +/* confdefs.h. */3.356 +_ACEOF3.357 +cat confdefs.h >>conftest.$ac_ext3.358 +cat >>conftest.$ac_ext <<_ACEOF3.359 +/* end confdefs.h. */3.360 +3.361 +int3.362 +main ()3.363 +{3.364 +3.365 + ;3.366 + return 0;3.367 +}3.368 +_ACEOF3.369 +rm -f conftest.$ac_objext3.370 +if { (ac_try="$ac_compile"3.371 +case "(($ac_try" in3.372 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.373 + *) ac_try_echo=$ac_try;;3.374 +esac3.375 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.376 +$as_echo "$ac_try_echo") >&53.377 + (eval "$ac_compile") 2>conftest.er13.378 + ac_status=$?3.379 + grep -v '^ *+' conftest.er1 >conftest.err3.380 + rm -f conftest.er13.381 + cat conftest.err >&53.382 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.383 + (exit $ac_status); } && {3.384 + test -z "$ac_objc_werror_flag" ||3.385 + test ! -s conftest.err3.386 + } && test -s conftest.$ac_objext; then3.387 + ac_cv_prog_objc_g=yes3.388 +else3.389 + $as_echo "$as_me: failed program was:" >&53.390 +sed 's/^/| /' conftest.$ac_ext >&53.391 +3.392 +3.393 +fi3.394 +3.395 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.396 +fi3.397 +3.398 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.399 +fi3.400 +3.401 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.402 + ac_objc_werror_flag=$ac_save_objc_werror_flag3.403 +fi3.404 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_objc_g" >&53.405 +$as_echo "$ac_cv_prog_objc_g" >&6; }3.406 +if test "$ac_test_OBJCFLAGS" = set; then3.407 + OBJCFLAGS=$ac_save_OBJCFLAGS3.408 +elif test $ac_cv_prog_objc_g = yes; then3.409 + if test "$GOBJC" = yes; then3.410 + OBJCFLAGS="-g -O2"3.411 + else3.412 + OBJCFLAGS="-g"3.413 + fi3.414 +else3.415 + if test "$GOBJC" = yes; then3.416 + OBJCFLAGS="-O2"3.417 + else3.418 + OBJCFLAGS=3.419 + fi3.420 +fi3.421 +ac_ext=c3.422 +ac_cpp='$CPP $CPPFLAGS'3.423 +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.424 +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.425 +ac_compiler_gnu=$ac_cv_c_compiler_gnu3.426 +3.427 +{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&53.428 +$as_echo_n "checking for a sed that does not truncate output... " >&6; }3.429 +if test "${ac_cv_path_SED+set}" = set; then3.430 + $as_echo_n "(cached) " >&63.431 +else3.432 + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/3.433 + for ac_i in 1 2 3 4 5 6 7; do3.434 + ac_script="$ac_script$as_nl$ac_script"3.435 + done3.436 + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed3.437 + $as_unset ac_script || ac_script=3.438 + if test -z "$SED"; then3.439 + ac_path_SED_found=false3.440 + # Loop through the user's path and test for each of PROGNAME-LIST3.441 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR3.442 +for as_dir in $PATH3.443 +do3.444 + IFS=$as_save_IFS3.445 + test -z "$as_dir" && as_dir=.3.446 + for ac_prog in sed gsed; do3.447 + for ac_exec_ext in '' $ac_executable_extensions; do3.448 + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"3.449 + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue3.450 +# Check for GNU ac_path_SED and select it if it is found.3.451 + # Check for GNU $ac_path_SED3.452 +case `"$ac_path_SED" --version 2>&1` in3.453 +*GNU*)3.454 + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;3.455 +*)3.456 + ac_count=03.457 + $as_echo_n 0123456789 >"conftest.in"3.458 + while :3.459 + do3.460 + cat "conftest.in" "conftest.in" >"conftest.tmp"3.461 + mv "conftest.tmp" "conftest.in"3.462 + cp "conftest.in" "conftest.nl"3.463 + $as_echo '' >> "conftest.nl"3.464 + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break3.465 + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break3.466 + ac_count=`expr $ac_count + 1`3.467 + if test $ac_count -gt ${ac_path_SED_max-0}; then3.468 + # Best one so far, save it but keep looking for a better one3.469 + ac_cv_path_SED="$ac_path_SED"3.470 + ac_path_SED_max=$ac_count3.471 + fi3.472 + # 10*(2^10) chars as input seems more than enough3.473 + test $ac_count -gt 10 && break3.474 + done3.475 + rm -f conftest.in conftest.tmp conftest.nl conftest.out;;3.476 +esac3.477 +3.478 + $ac_path_SED_found && break 33.479 + done3.480 + done3.481 +done3.482 +IFS=$as_save_IFS3.483 + if test -z "$ac_cv_path_SED"; then3.484 + { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&53.485 +$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}3.486 + { (exit 1); exit 1; }; }3.487 + fi3.488 +else3.489 + ac_cv_path_SED=$SED3.490 +fi3.491 +3.492 +fi3.493 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&53.494 +$as_echo "$ac_cv_path_SED" >&6; }3.495 + SED="$ac_cv_path_SED"3.496 + rm -f conftest.sed3.497 +3.498 # By default we simply use the C compiler to build assembly code.3.500 test "${CCAS+set}" = set || CCAS=$CC3.501 @@ -6476,6 +6931,117 @@3.505 +3.506 +depcc="$OBJC" am_compiler_list='gcc3 gcc'3.507 +3.508 +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&53.509 +$as_echo_n "checking dependency style of $depcc... " >&6; }3.510 +if test "${am_cv_OBJC_dependencies_compiler_type+set}" = set; then3.511 + $as_echo_n "(cached) " >&63.512 +else3.513 + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then3.514 + # We make a subdir and do the tests there. Otherwise we can end up3.515 + # making bogus files that we don't know about and never remove. For3.516 + # instance it was reported that on HP-UX the gcc test will end up3.517 + # making a dummy file named `D' -- because `-MD' means `put the output3.518 + # in D'.3.519 + mkdir conftest.dir3.520 + # Copy depcomp to subdir because otherwise we won't find it if we're3.521 + # using a relative directory.3.522 + cp "$am_depcomp" conftest.dir3.523 + cd conftest.dir3.524 + # We will build objects and dependencies in a subdirectory because3.525 + # it helps to detect inapplicable dependency modes. For instance3.526 + # both Tru64's cc and ICC support -MD to output dependencies as a3.527 + # side effect of compilation, but ICC will put the dependencies in3.528 + # the current directory while Tru64 will put them in the object3.529 + # directory.3.530 + mkdir sub3.531 +3.532 + am_cv_OBJC_dependencies_compiler_type=none3.533 + if test "$am_compiler_list" = ""; then3.534 + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`3.535 + fi3.536 + for depmode in $am_compiler_list; do3.537 + # Setup a source with many dependencies, because some compilers3.538 + # like to wrap large dependency lists on column 80 (with \), and3.539 + # we should not choose a depcomp mode which is confused by this.3.540 + #3.541 + # We need to recreate these files for each test, as the compiler may3.542 + # overwrite some of them when testing with obscure command lines.3.543 + # This happens at least with the AIX C compiler.3.544 + : > sub/conftest.c3.545 + for i in 1 2 3 4 5 6; do3.546 + echo '#include "conftst'$i'.h"' >> sub/conftest.c3.547 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with3.548 + # Solaris 8's {/usr,}/bin/sh.3.549 + touch sub/conftst$i.h3.550 + done3.551 + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf3.552 +3.553 + case $depmode in3.554 + nosideeffect)3.555 + # after this tag, mechanisms are not by side-effect, so they'll3.556 + # only be used when explicitly requested3.557 + if test "x$enable_dependency_tracking" = xyes; then3.558 + continue3.559 + else3.560 + break3.561 + fi3.562 + ;;3.563 + none) break ;;3.564 + esac3.565 + # We check with `-c' and `-o' for the sake of the "dashmstdout"3.566 + # mode. It turns out that the SunPro C++ compiler does not properly3.567 + # handle `-M -o', and we need to detect this.3.568 + if depmode=$depmode \3.569 + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \3.570 + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \3.571 + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \3.572 + >/dev/null 2>conftest.err &&3.573 + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&3.574 + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&3.575 + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then3.576 + # icc doesn't choke on unknown options, it will just issue warnings3.577 + # or remarks (even with -Werror). So we grep stderr for any message3.578 + # that says an option was ignored or not supported.3.579 + # When given -MP, icc 7.0 and 7.1 complain thusly:3.580 + # icc: Command line warning: ignoring option '-M'; no argument required3.581 + # The diagnosis changed in icc 8.0:3.582 + # icc: Command line remark: option '-MP' not supported3.583 + if (grep 'ignoring option' conftest.err ||3.584 + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else3.585 + am_cv_OBJC_dependencies_compiler_type=$depmode3.586 + break3.587 + fi3.588 + fi3.589 + done3.590 +3.591 + cd ..3.592 + rm -rf conftest.dir3.593 +else3.594 + am_cv_OBJC_dependencies_compiler_type=none3.595 +fi3.596 +3.597 +fi3.598 +{ $as_echo "$as_me:$LINENO: result: $am_cv_OBJC_dependencies_compiler_type" >&53.599 +$as_echo "$am_cv_OBJC_dependencies_compiler_type" >&6; }3.600 +OBJCDEPMODE=depmode=$am_cv_OBJC_dependencies_compiler_type3.601 +3.602 +3.603 +3.604 +if3.605 + test "x$enable_dependency_tracking" != xno \3.606 + && test "$am_cv_OBJC_dependencies_compiler_type" = gcc3; then3.607 + am__fastdepOBJC_TRUE=3.608 + am__fastdepOBJC_FALSE='#'3.609 +else3.610 + am__fastdepOBJC_TRUE='#'3.611 + am__fastdepOBJC_FALSE=3.612 +fi3.613 +3.614 +3.615 +3.616 # Extract the first word of "pod2man", so it can be a program name with args.3.617 set dummy pod2man; ac_word=$23.618 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&53.619 @@ -6646,28 +7212,71 @@3.620 fi3.623 +CFLAGS="-g -fexceptions"3.624 +OBJCFLAGS="-g -fexceptions"3.625 +3.626 +cat >>confdefs.h <<\_ACEOF3.627 +#define HAVE_EXCEPTIONS 13.628 +_ACEOF3.629 +3.630 +3.631 +3.632 +_GCC_VERSION=`$CC --version | $SED -ne '/(GCC)/p'`3.633 +_ICC_VERSION=`$CC --version | $SED -ne '/(ICC)/p'`3.634 +{ $as_echo "$as_me:$LINENO: checking CC version" >&53.635 +$as_echo_n "checking CC version... " >&6; }3.636 +if test -n "$_GCC_VERSION"; then3.637 + { $as_echo "$as_me:$LINENO: result: GCC" >&53.638 +$as_echo "GCC" >&6; }3.639 + CCOPT="-O2 -msse2 -mfpmath=sse"3.640 + CFLAGS="$CFLAGS -fno-strict-aliasing"3.641 +elif test -n "$_ICC_VERSION"; then3.642 + { $as_echo "$as_me:$LINENO: result: ICC" >&53.643 +$as_echo "ICC" >&6; }3.644 + CCOPT="$CFLAGS -fast"3.645 +else3.646 + { $as_echo "$as_me:$LINENO: result: Unknown" >&53.647 +$as_echo "Unknown" >&6; }3.648 + CCOPT="$CFLAGS -O2"3.649 +fi3.650 +3.651 +3.652 +{ $as_echo "$as_me:$LINENO: checking OBJC version" >&53.653 +$as_echo_n "checking OBJC version... " >&6; }3.654 +if test -n "$OBJC"; then3.655 + _GOBJC_VERSION=`$OBJC --version | $SED -ne '/(GCC)/p'`3.656 + if test -n "$_GOBJC_VERSION"; then3.657 + { $as_echo "$as_me:$LINENO: result: GCC" >&53.658 +$as_echo "GCC" >&6; }3.659 + OBJCOPT="-O2 -msse2 -mfpmath=sse"3.660 + OBJCFLAGS="$OBJCFLAGS -fno-strict-aliasing"3.661 + else3.662 + { $as_echo "$as_me:$LINENO: result: Unknown" >&53.663 +$as_echo "Unknown" >&6; }3.664 + OBJCOPT="-O2"3.665 + fi3.666 +else3.667 + { $as_echo "$as_me:$LINENO: result: None" >&53.668 +$as_echo "None" >&6; }3.669 +3.670 +fi3.671 +3.673 if test "x$enable_optimized" = "xyes"; then3.674 - CFLAGS="-g -O2 -msse2 -mfpmath=sse"3.675 + CFLAGS="$CFLAGS $CCOPT"3.676 + OBJCFLAGS="$OBJCFLAGS $CCOPT"3.677 if test "x$enable_profiled" != "xyes"; then3.678 - CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"3.679 -3.680 -cat >>confdefs.h <<\_ACEOF3.681 -#define HAVE_EXCEPTIONS 13.682 -_ACEOF3.683 -3.684 + CFLAGS="$CFLAGS -fomit-frame-pointer"3.685 fi3.686 else3.687 - CFLAGS="-g3"3.688 + CFLAGS="$CFLAGS -g3"3.689 + OBJCFLAGS="$OBJCFLAGS -g3"3.690 fi3.692 if test "x$enable_profiled" = "xyes"; then3.693 CFLAGS="$CFLAGS -pg"3.694 LDFLAGS="$LDFLAGS -pg";3.695 -fi3.696 -3.697 -if test "x$GCC" = "xyes"; then3.698 - CFLAGS="$CFLAGS -fno-strict-aliasing"3.699 + OBJCFLAGS="$OBJCFLAGS -pg";3.700 fi3.703 @@ -6835,44 +7444,246 @@3.707 -lxdream_save_cppflags="$CPPFLAGS"3.708 -CPPFLAGS="$CPPFLAGS -x objective-c"3.709 -cat >conftest.$ac_ext <<_ACEOF3.710 -/* confdefs.h. */3.711 -_ACEOF3.712 -cat confdefs.h >>conftest.$ac_ext3.713 -cat >>conftest.$ac_ext <<_ACEOF3.714 -/* end confdefs.h. */3.715 -@interface Foo @end3.716 -int3.717 -main ()3.718 -{3.719 -3.720 - ;3.721 - return 0;3.722 -}3.723 -_ACEOF3.724 -rm -f conftest.$ac_objext3.725 -if { (ac_try="$ac_compile"3.726 -case "(($ac_try" in3.727 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.728 - *) ac_try_echo=$ac_try;;3.729 -esac3.730 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.731 -$as_echo "$ac_try_echo") >&53.732 - (eval "$ac_compile") 2>conftest.er13.733 - ac_status=$?3.734 - grep -v '^ *+' conftest.er1 >conftest.err3.735 - rm -f conftest.er13.736 - cat conftest.err >&53.737 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.738 - (exit $ac_status); } && {3.739 - test -z "$ac_c_werror_flag" ||3.740 - test ! -s conftest.err3.741 - } && test -s conftest.$ac_objext; then3.742 -3.743 -3.744 - if test "${ac_cv_header_Cocoa_Cocoa_h+set}" = set; then3.745 +ac_ext=m3.746 +ac_cpp='$OBJCPP $CPPFLAGS'3.747 +ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.748 +ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.749 +ac_compiler_gnu=$ac_cv_objc_compiler_gnu3.750 +3.751 +3.752 +3.753 +ac_ext=m3.754 +ac_cpp='$OBJCPP $CPPFLAGS'3.755 +ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.756 +ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.757 +ac_compiler_gnu=$ac_cv_objc_compiler_gnu3.758 +{ $as_echo "$as_me:$LINENO: checking how to run the Objective C preprocessor" >&53.759 +$as_echo_n "checking how to run the Objective C preprocessor... " >&6; }3.760 +if test -z "$OBJCPP"; then3.761 + if test "${ac_cv_prog_OBJCPP+set}" = set; then3.762 + $as_echo_n "(cached) " >&63.763 +else3.764 + # Double quotes because OBJCPP needs to be expanded3.765 + for OBJCPP in "$OBJC -E" "/lib/cpp"3.766 + do3.767 + ac_preproc_ok=false3.768 +for ac_objc_preproc_warn_flag in '' yes3.769 +do3.770 + # Use a header file that comes with gcc, so configuring glibc3.771 + # with a fresh cross-compiler works.3.772 + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since3.773 + # <limits.h> exists even on freestanding compilers.3.774 + # On the NeXT, cc -E runs the code through the compiler's parser,3.775 + # not just through cpp. "Syntax error" is here to catch this case.3.776 + cat >conftest.$ac_ext <<_ACEOF3.777 +/* confdefs.h. */3.778 +_ACEOF3.779 +cat confdefs.h >>conftest.$ac_ext3.780 +cat >>conftest.$ac_ext <<_ACEOF3.781 +/* end confdefs.h. */3.782 +#ifdef __STDC__3.783 +# include <limits.h>3.784 +#else3.785 +# include <assert.h>3.786 +#endif3.787 + Syntax error3.788 +_ACEOF3.789 +if { (ac_try="$ac_cpp conftest.$ac_ext"3.790 +case "(($ac_try" in3.791 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.792 + *) ac_try_echo=$ac_try;;3.793 +esac3.794 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.795 +$as_echo "$ac_try_echo") >&53.796 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er13.797 + ac_status=$?3.798 + grep -v '^ *+' conftest.er1 >conftest.err3.799 + rm -f conftest.er13.800 + cat conftest.err >&53.801 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.802 + (exit $ac_status); } >/dev/null && {3.803 + test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||3.804 + test ! -s conftest.err3.805 + }; then3.806 + :3.807 +else3.808 + $as_echo "$as_me: failed program was:" >&53.809 +sed 's/^/| /' conftest.$ac_ext >&53.810 +3.811 + # Broken: fails on valid input.3.812 +continue3.813 +fi3.814 +3.815 +rm -f conftest.err conftest.$ac_ext3.816 +3.817 + # OK, works on sane cases. Now check whether nonexistent headers3.818 + # can be detected and how.3.819 + cat >conftest.$ac_ext <<_ACEOF3.820 +/* confdefs.h. */3.821 +_ACEOF3.822 +cat confdefs.h >>conftest.$ac_ext3.823 +cat >>conftest.$ac_ext <<_ACEOF3.824 +/* end confdefs.h. */3.825 +#include <ac_nonexistent.h>3.826 +_ACEOF3.827 +if { (ac_try="$ac_cpp conftest.$ac_ext"3.828 +case "(($ac_try" in3.829 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.830 + *) ac_try_echo=$ac_try;;3.831 +esac3.832 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.833 +$as_echo "$ac_try_echo") >&53.834 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er13.835 + ac_status=$?3.836 + grep -v '^ *+' conftest.er1 >conftest.err3.837 + rm -f conftest.er13.838 + cat conftest.err >&53.839 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.840 + (exit $ac_status); } >/dev/null && {3.841 + test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||3.842 + test ! -s conftest.err3.843 + }; then3.844 + # Broken: success on invalid input.3.845 +continue3.846 +else3.847 + $as_echo "$as_me: failed program was:" >&53.848 +sed 's/^/| /' conftest.$ac_ext >&53.849 +3.850 + # Passes both tests.3.851 +ac_preproc_ok=:3.852 +break3.853 +fi3.854 +3.855 +rm -f conftest.err conftest.$ac_ext3.856 +3.857 +done3.858 +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.3.859 +rm -f conftest.err conftest.$ac_ext3.860 +if $ac_preproc_ok; then3.861 + break3.862 +fi3.863 +3.864 + done3.865 + ac_cv_prog_OBJCPP=$OBJCPP3.866 +3.867 +fi3.868 + OBJCPP=$ac_cv_prog_OBJCPP3.869 +else3.870 + ac_cv_prog_OBJCPP=$OBJCPP3.871 +fi3.872 +{ $as_echo "$as_me:$LINENO: result: $OBJCPP" >&53.873 +$as_echo "$OBJCPP" >&6; }3.874 +ac_preproc_ok=false3.875 +for ac_objc_preproc_warn_flag in '' yes3.876 +do3.877 + # Use a header file that comes with gcc, so configuring glibc3.878 + # with a fresh cross-compiler works.3.879 + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since3.880 + # <limits.h> exists even on freestanding compilers.3.881 + # On the NeXT, cc -E runs the code through the compiler's parser,3.882 + # not just through cpp. "Syntax error" is here to catch this case.3.883 + cat >conftest.$ac_ext <<_ACEOF3.884 +/* confdefs.h. */3.885 +_ACEOF3.886 +cat confdefs.h >>conftest.$ac_ext3.887 +cat >>conftest.$ac_ext <<_ACEOF3.888 +/* end confdefs.h. */3.889 +#ifdef __STDC__3.890 +# include <limits.h>3.891 +#else3.892 +# include <assert.h>3.893 +#endif3.894 + Syntax error3.895 +_ACEOF3.896 +if { (ac_try="$ac_cpp conftest.$ac_ext"3.897 +case "(($ac_try" in3.898 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.899 + *) ac_try_echo=$ac_try;;3.900 +esac3.901 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.902 +$as_echo "$ac_try_echo") >&53.903 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er13.904 + ac_status=$?3.905 + grep -v '^ *+' conftest.er1 >conftest.err3.906 + rm -f conftest.er13.907 + cat conftest.err >&53.908 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.909 + (exit $ac_status); } >/dev/null && {3.910 + test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||3.911 + test ! -s conftest.err3.912 + }; then3.913 + :3.914 +else3.915 + $as_echo "$as_me: failed program was:" >&53.916 +sed 's/^/| /' conftest.$ac_ext >&53.917 +3.918 + # Broken: fails on valid input.3.919 +continue3.920 +fi3.921 +3.922 +rm -f conftest.err conftest.$ac_ext3.923 +3.924 + # OK, works on sane cases. Now check whether nonexistent headers3.925 + # can be detected and how.3.926 + cat >conftest.$ac_ext <<_ACEOF3.927 +/* confdefs.h. */3.928 +_ACEOF3.929 +cat confdefs.h >>conftest.$ac_ext3.930 +cat >>conftest.$ac_ext <<_ACEOF3.931 +/* end confdefs.h. */3.932 +#include <ac_nonexistent.h>3.933 +_ACEOF3.934 +if { (ac_try="$ac_cpp conftest.$ac_ext"3.935 +case "(($ac_try" in3.936 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.937 + *) ac_try_echo=$ac_try;;3.938 +esac3.939 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""3.940 +$as_echo "$ac_try_echo") >&53.941 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er13.942 + ac_status=$?3.943 + grep -v '^ *+' conftest.er1 >conftest.err3.944 + rm -f conftest.er13.945 + cat conftest.err >&53.946 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.947 + (exit $ac_status); } >/dev/null && {3.948 + test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||3.949 + test ! -s conftest.err3.950 + }; then3.951 + # Broken: success on invalid input.3.952 +continue3.953 +else3.954 + $as_echo "$as_me: failed program was:" >&53.955 +sed 's/^/| /' conftest.$ac_ext >&53.956 +3.957 + # Passes both tests.3.958 +ac_preproc_ok=:3.959 +break3.960 +fi3.961 +3.962 +rm -f conftest.err conftest.$ac_ext3.963 +3.964 +done3.965 +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.3.966 +rm -f conftest.err conftest.$ac_ext3.967 +if $ac_preproc_ok; then3.968 + :3.969 +else3.970 + { { $as_echo "$as_me:$LINENO: error: Objective C preprocessor \"$OBJCPP\" fails sanity check3.971 +See \`config.log' for more details." >&53.972 +$as_echo "$as_me: error: Objective C preprocessor \"$OBJCPP\" fails sanity check3.973 +See \`config.log' for more details." >&2;}3.974 + { (exit 1); exit 1; }; }3.975 +fi3.976 +3.977 +ac_ext=m3.978 +ac_cpp='$OBJCPP $CPPFLAGS'3.979 +ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.980 +ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.981 +ac_compiler_gnu=$ac_cv_objc_compiler_gnu3.982 +3.983 +3.984 +if test "${ac_cv_header_Cocoa_Cocoa_h+set}" = set; then3.985 { $as_echo "$as_me:$LINENO: checking for Cocoa/Cocoa.h" >&53.986 $as_echo_n "checking for Cocoa/Cocoa.h... " >&6; }3.987 if test "${ac_cv_header_Cocoa_Cocoa_h+set}" = set; then3.988 @@ -6908,7 +7719,7 @@3.989 cat conftest.err >&53.990 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.991 (exit $ac_status); } && {3.992 - test -z "$ac_c_werror_flag" ||3.993 + test -z "$ac_objc_werror_flag" ||3.994 test ! -s conftest.err3.995 } && test -s conftest.$ac_objext; then3.996 ac_header_compiler=yes3.997 @@ -6948,7 +7759,7 @@3.998 cat conftest.err >&53.999 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.1000 (exit $ac_status); } >/dev/null && {3.1001 - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||3.1002 + test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||3.1003 test ! -s conftest.err3.1004 }; then3.1005 ac_header_preproc=yes3.1006 @@ -6964,7 +7775,7 @@3.1007 $as_echo "$ac_header_preproc" >&6; }3.1009 # So? What about this header?3.1010 -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in3.1011 +case $ac_header_compiler:$ac_header_preproc:$ac_objc_preproc_warn_flag in3.1012 yes:no: )3.1013 { $as_echo "$as_me:$LINENO: WARNING: Cocoa/Cocoa.h: accepted by the compiler, rejected by the preprocessor!" >&53.1014 $as_echo "$as_me: WARNING: Cocoa/Cocoa.h: accepted by the compiler, rejected by the preprocessor!" >&2;}3.1015 @@ -7026,15 +7837,6 @@3.1019 -else3.1020 - $as_echo "$as_me: failed program was:" >&53.1021 -sed 's/^/| /' conftest.$ac_ext >&53.1022 -3.1023 - CPPFLAGS="$lxdream_save_cppflags"3.1024 -fi3.1025 -3.1026 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.1027 -3.1029 if test "$HAVE_COCOA" = 'yes' -a "$with_gtk" = "no"; then3.1030 GUI_COCOA_TRUE=3.1031 @@ -7052,6 +7854,13 @@3.1033 fi3.1035 +ac_ext=c3.1036 +ac_cpp='$CPP $CPPFLAGS'3.1037 +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'3.1038 +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'3.1039 +ac_compiler_gnu=$ac_cv_c_compiler_gnu3.1040 +3.1041 +3.1044 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then3.1045 @@ -11776,6 +12585,13 @@3.1046 Usually this means the macro was only invoked conditionally." >&2;}3.1047 { (exit 1); exit 1; }; }3.1048 fi3.1049 +if test -z "${am__fastdepOBJC_TRUE}" && test -z "${am__fastdepOBJC_FALSE}"; then3.1050 + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepOBJC\" was never defined.3.1051 +Usually this means the macro was only invoked conditionally." >&53.1052 +$as_echo "$as_me: error: conditional \"am__fastdepOBJC\" was never defined.3.1053 +Usually this means the macro was only invoked conditionally." >&2;}3.1054 + { (exit 1); exit 1; }; }3.1055 +fi3.1056 if test -z "${GUI_COCOA_TRUE}" && test -z "${GUI_COCOA_FALSE}"; then3.1057 { { $as_echo "$as_me:$LINENO: error: conditional \"GUI_COCOA\" was never defined.3.1058 Usually this means the macro was only invoked conditionally." >&5
4.1 --- a/configure.in Thu Jan 15 03:54:21 2009 +00004.2 +++ b/configure.in Thu Jan 15 04:15:11 2009 +00004.3 @@ -8,12 +8,16 @@4.4 AC_ISC_POSIX4.5 AC_PROG_CC4.6 AM_PROG_CC_STDC4.7 +AC_PROG_OBJC4.8 +AC_PROG_SED4.9 AM_PROG_AS4.10 AC_CHECK_SIZEOF([void *])4.11 AC_HEADER_STDC4.12 AC_CANONICAL_BUILD4.13 AC_CANONICAL_HOST4.15 +_AM_DEPENDENCIES([OBJC])4.16 +4.17 AC_PATH_PROG(POD2MAN, [pod2man])4.18 AC_PATH_PROG(POD2HTML, [pod2html])4.20 @@ -58,26 +62,35 @@4.21 AC_ARG_WITH( pulse,4.22 AS_HELP_STRING( [--with-pulse], [Build with support for the PulseAudio audio system]) )4.24 -dnl ------------4.25 +dnl ------------------ Compiler flags -----------------------4.26 +CFLAGS="-g -fexceptions"4.27 +OBJCFLAGS="-g -fexceptions"4.28 +AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])4.29 +4.30 +AC_CC_VERSION([ CCOPT="-O2 -msse2 -mfpmath=sse"4.31 + CFLAGS="$CFLAGS -fno-strict-aliasing" ],4.32 + [ CCOPT="$CFLAGS -fast" ],4.33 + [ CCOPT="$CFLAGS -O2" ])4.34 +AC_OBJC_VERSION([ OBJCOPT="-O2 -msse2 -mfpmath=sse"4.35 + OBJCFLAGS="$OBJCFLAGS -fno-strict-aliasing" ],4.36 + [ OBJCOPT="-O2" ], [] )4.38 if test "x$enable_optimized" = "xyes"; then4.39 - CFLAGS="-g -O2 -msse2 -mfpmath=sse"4.40 + CFLAGS="$CFLAGS $CCOPT"4.41 + OBJCFLAGS="$OBJCFLAGS $CCOPT"4.42 if test "x$enable_profiled" != "xyes"; then4.43 dnl -fomit-frame-pointer can't be used with -pg4.44 - CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"4.45 - AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])4.46 + CFLAGS="$CFLAGS -fomit-frame-pointer"4.47 fi4.48 -else4.49 - CFLAGS="-g3"4.50 +else4.51 + CFLAGS="$CFLAGS -g3"4.52 + OBJCFLAGS="$OBJCFLAGS -g3"4.53 fi4.55 if test "x$enable_profiled" = "xyes"; then4.56 CFLAGS="$CFLAGS -pg"4.57 LDFLAGS="$LDFLAGS -pg";4.58 -fi4.59 -4.60 -if test "x$GCC" = "xyes"; then4.61 - CFLAGS="$CFLAGS -fno-strict-aliasing"4.62 + OBJCFLAGS="$OBJCFLAGS -pg";4.63 fi4.65 AC_CHECK_FASTCALL([4.66 @@ -91,11 +104,9 @@4.67 dnl ------------ Check if we're building on Darwin --------------4.69 dnl For starters, do we have a working objective-c compiler?4.70 -lxdream_save_cppflags="$CPPFLAGS"4.71 -CPPFLAGS="$CPPFLAGS -x objective-c"4.72 -AC_TRY_COMPILE([@interface Foo @end],, [4.73 +AC_LANG_OBJC4.75 - AC_CHECK_HEADER([Cocoa/Cocoa.h], [4.76 +AC_CHECK_HEADER([Cocoa/Cocoa.h], [4.77 HAVE_COCOA='yes'4.78 APPLE_BUILD='yes'4.79 LIBS="$LIBS -framework AppKit"4.80 @@ -107,14 +118,15 @@4.81 if test "x$with_gtk" = "xx11"; then4.82 with_gtk=no4.83 fi4.84 - ])4.85 +])4.87 -], [CPPFLAGS="$lxdream_save_cppflags"] )4.88 AM_CONDITIONAL(GUI_COCOA, [test "$HAVE_COCOA" = 'yes' -a "$with_gtk" = "no"])4.89 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then4.90 AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])4.91 fi4.93 +AC_LANG_C4.94 +4.95 dnl ----------- Check for mandatory dependencies --------------4.96 dnl Check for libpng (required)4.97 PKG_CHECK_MODULES(LIBPNG, [libpng] )
5.1 --- a/src/Makefile.am Thu Jan 15 03:54:21 2009 +00005.2 +++ b/src/Makefile.am Thu Jan 15 04:15:11 2009 +00005.3 @@ -31,10 +31,10 @@5.5 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c5.6 genglsl_SOURCES = tools/genglsl.c5.7 -5.8 +lxdream_LINK = $(CCLD)5.9 lxdream_SOURCES = \5.10 main.c version.c config.c config.h lxdream.h dream.h gui.h cpu.h hook.h \5.11 - gettext.h mem.c mem.h sdram.c mmio.h paths.c watch.c \5.12 + gettext.h mem.c mem.h sdram.c mmio.h watch.c \5.13 asic.c asic.h clock.h serial.h \5.14 syscall.c syscall.h bios.c dcload.c \5.15 gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \5.16 @@ -91,10 +91,12 @@5.17 endif5.19 if GUI_COCOA5.20 -lxdream_SOURCES += cocoaui/cocoaui.c cocoaui/cocoaui.h \5.21 - cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \5.22 - cocoaui/cocoa_path.c cocoaui/cocoa_ctrl.c \5.23 - drivers/video_osx.c drivers/mac_keymap.h drivers/mac_keymap.txt5.24 +lxdream_SOURCES += cocoaui/cocoaui.m cocoaui/cocoaui.h \5.25 + cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \5.26 + cocoaui/cocoa_path.m cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m \5.27 + drivers/video_osx.m drivers/mac_keymap.h drivers/mac_keymap.txt5.28 +else5.29 +lxdream_SOURCES += paths_unix.c5.30 endif5.32 if VIDEO_OSMESA5.33 @@ -106,11 +108,11 @@5.34 endif5.36 if VIDEO_NSGL5.37 -lxdream_SOURCES += drivers/video_nsgl.c drivers/video_nsgl.h5.38 +lxdream_SOURCES += drivers/video_nsgl.m drivers/video_nsgl.h5.39 endif5.41 if AUDIO_OSX5.42 -lxdream_SOURCES += drivers/audio_osx.c5.43 +lxdream_SOURCES += drivers/audio_osx.m5.44 endif5.46 if AUDIO_PULSE5.47 @@ -131,7 +133,7 @@5.48 endif5.50 if CDROM_OSX5.51 -lxdream_SOURCES += drivers/cd_osx.c drivers/osx_iokit.c drivers/osx_iokit.h5.52 +lxdream_SOURCES += drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h5.53 endif5.55 if CDROM_NONE
6.1 --- a/src/Makefile.in Thu Jan 15 03:54:21 2009 +00006.2 +++ b/src/Makefile.in Thu Jan 15 04:15:11 2009 +00006.3 @@ -54,22 +54,23 @@6.4 @GUI_GTK_TRUE@ gtkui/gtk_ctrl.c gtkui/gtk_path.c gtkui/gtk_gd.c \6.5 @GUI_GTK_TRUE@ drivers/video_gtk.c6.7 -@GUI_COCOA_TRUE@am__append_4 = cocoaui/cocoaui.c cocoaui/cocoaui.h \6.8 -@GUI_COCOA_TRUE@ cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \6.9 -@GUI_COCOA_TRUE@ cocoaui/cocoa_path.c cocoaui/cocoa_ctrl.c \6.10 -@GUI_COCOA_TRUE@ drivers/video_osx.c drivers/mac_keymap.h drivers/mac_keymap.txt6.11 +@GUI_COCOA_TRUE@am__append_4 = cocoaui/cocoaui.m cocoaui/cocoaui.h \6.12 +@GUI_COCOA_TRUE@ cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \6.13 +@GUI_COCOA_TRUE@ cocoaui/cocoa_path.m cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m \6.14 +@GUI_COCOA_TRUE@ drivers/video_osx.m drivers/mac_keymap.h drivers/mac_keymap.txt6.16 -@VIDEO_OSMESA_TRUE@am__append_5 = drivers/video_gdk.c6.17 -@VIDEO_GLX_TRUE@am__append_6 = drivers/video_glx.c drivers/video_glx.h6.18 -@VIDEO_NSGL_TRUE@am__append_7 = drivers/video_nsgl.c drivers/video_nsgl.h6.19 -@AUDIO_OSX_TRUE@am__append_8 = drivers/audio_osx.c6.20 -@AUDIO_PULSE_TRUE@am__append_9 = drivers/audio_pulse.c6.21 -@AUDIO_ESOUND_TRUE@am__append_10 = drivers/audio_esd.c6.22 -@AUDIO_ALSA_TRUE@am__append_11 = drivers/audio_alsa.c6.23 -@CDROM_LINUX_TRUE@am__append_12 = drivers/cd_linux.c6.24 -@CDROM_OSX_TRUE@am__append_13 = drivers/cd_osx.c drivers/osx_iokit.c drivers/osx_iokit.h6.25 -@CDROM_NONE_TRUE@am__append_14 = drivers/cd_none.c6.26 -@JOY_LINUX_TRUE@am__append_15 = drivers/joy_linux.c drivers/joy_linux.h6.27 +@GUI_COCOA_FALSE@am__append_5 = paths_unix.c6.28 +@VIDEO_OSMESA_TRUE@am__append_6 = drivers/video_gdk.c6.29 +@VIDEO_GLX_TRUE@am__append_7 = drivers/video_glx.c drivers/video_glx.h6.30 +@VIDEO_NSGL_TRUE@am__append_8 = drivers/video_nsgl.m drivers/video_nsgl.h6.31 +@AUDIO_OSX_TRUE@am__append_9 = drivers/audio_osx.m6.32 +@AUDIO_PULSE_TRUE@am__append_10 = drivers/audio_pulse.c6.33 +@AUDIO_ESOUND_TRUE@am__append_11 = drivers/audio_esd.c6.34 +@AUDIO_ALSA_TRUE@am__append_12 = drivers/audio_alsa.c6.35 +@CDROM_LINUX_TRUE@am__append_13 = drivers/cd_linux.c6.36 +@CDROM_OSX_TRUE@am__append_14 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h6.37 +@CDROM_NONE_TRUE@am__append_15 = drivers/cd_none.c6.38 +@JOY_LINUX_TRUE@am__append_16 = drivers/joy_linux.c drivers/joy_linux.h6.39 subdir = src6.40 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in6.41 ACLOCAL_M4 = $(top_srcdir)/aclocal.m46.42 @@ -94,7 +95,7 @@6.43 genglsl_DEPENDENCIES = $(am__DEPENDENCIES_1)6.44 am__lxdream_SOURCES_DIST = main.c version.c config.c config.h \6.45 lxdream.h dream.h gui.h cpu.h hook.h gettext.h mem.c mem.h \6.46 - sdram.c mmio.h paths.c watch.c asic.c asic.h clock.h serial.h \6.47 + sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \6.48 syscall.c syscall.h bios.c dcload.c gdrom/ide.c gdrom/ide.h \6.49 gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \6.50 gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c \6.51 @@ -128,16 +129,16 @@6.52 gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c gtkui/gtkcb.c \6.53 gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \6.54 gtkui/gtk_ctrl.c gtkui/gtk_path.c gtkui/gtk_gd.c \6.55 - drivers/video_gtk.c cocoaui/cocoaui.c cocoaui/cocoaui.h \6.56 - cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \6.57 - cocoaui/cocoa_path.c cocoaui/cocoa_ctrl.c drivers/video_osx.c \6.58 - drivers/mac_keymap.h drivers/mac_keymap.txt \6.59 - drivers/video_gdk.c drivers/video_glx.c drivers/video_glx.h \6.60 - drivers/video_nsgl.c drivers/video_nsgl.h drivers/audio_osx.c \6.61 - drivers/audio_pulse.c drivers/audio_esd.c drivers/audio_alsa.c \6.62 - drivers/cd_linux.c drivers/cd_osx.c drivers/osx_iokit.c \6.63 - drivers/osx_iokit.h drivers/cd_none.c drivers/joy_linux.c \6.64 - drivers/joy_linux.h6.65 + drivers/video_gtk.c cocoaui/cocoaui.m cocoaui/cocoaui.h \6.66 + cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \6.67 + cocoaui/cocoa_path.m cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m \6.68 + drivers/video_osx.m drivers/mac_keymap.h \6.69 + drivers/mac_keymap.txt paths_unix.c drivers/video_gdk.c \6.70 + drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.m \6.71 + drivers/video_nsgl.h drivers/audio_osx.m drivers/audio_pulse.c \6.72 + drivers/audio_esd.c drivers/audio_alsa.c drivers/cd_linux.c \6.73 + drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h \6.74 + drivers/cd_none.c drivers/joy_linux.c drivers/joy_linux.h6.75 @BUILD_SH4X86_TRUE@am__objects_1 = sh4x86.$(OBJEXT) sh4trans.$(OBJEXT) \6.76 @BUILD_SH4X86_TRUE@ mmux86.$(OBJEXT) x86dasm.$(OBJEXT) \6.77 @BUILD_SH4X86_TRUE@ i386-dis.$(OBJEXT) dis-init.$(OBJEXT) \6.78 @@ -150,30 +151,31 @@6.79 @GUI_COCOA_TRUE@am__objects_3 = cocoaui.$(OBJEXT) cocoa_win.$(OBJEXT) \6.80 @GUI_COCOA_TRUE@ cocoa_gd.$(OBJEXT) cocoa_prefs.$(OBJEXT) \6.81 @GUI_COCOA_TRUE@ cocoa_path.$(OBJEXT) cocoa_ctrl.$(OBJEXT) \6.82 -@GUI_COCOA_TRUE@ video_osx.$(OBJEXT)6.83 -@VIDEO_OSMESA_TRUE@am__objects_4 = video_gdk.$(OBJEXT)6.84 -@VIDEO_GLX_TRUE@am__objects_5 = video_glx.$(OBJEXT)6.85 -@VIDEO_NSGL_TRUE@am__objects_6 = video_nsgl.$(OBJEXT)6.86 -@AUDIO_OSX_TRUE@am__objects_7 = audio_osx.$(OBJEXT)6.87 -@AUDIO_PULSE_TRUE@am__objects_8 = audio_pulse.$(OBJEXT)6.88 -@AUDIO_ESOUND_TRUE@am__objects_9 = audio_esd.$(OBJEXT)6.89 -@AUDIO_ALSA_TRUE@am__objects_10 = audio_alsa.$(OBJEXT)6.90 -@CDROM_LINUX_TRUE@am__objects_11 = cd_linux.$(OBJEXT)6.91 -@CDROM_OSX_TRUE@am__objects_12 = cd_osx.$(OBJEXT) osx_iokit.$(OBJEXT)6.92 -@CDROM_NONE_TRUE@am__objects_13 = cd_none.$(OBJEXT)6.93 -@JOY_LINUX_TRUE@am__objects_14 = joy_linux.$(OBJEXT)6.94 +@GUI_COCOA_TRUE@ paths_osx.$(OBJEXT) video_osx.$(OBJEXT)6.95 +@GUI_COCOA_FALSE@am__objects_4 = paths_unix.$(OBJEXT)6.96 +@VIDEO_OSMESA_TRUE@am__objects_5 = video_gdk.$(OBJEXT)6.97 +@VIDEO_GLX_TRUE@am__objects_6 = video_glx.$(OBJEXT)6.98 +@VIDEO_NSGL_TRUE@am__objects_7 = video_nsgl.$(OBJEXT)6.99 +@AUDIO_OSX_TRUE@am__objects_8 = audio_osx.$(OBJEXT)6.100 +@AUDIO_PULSE_TRUE@am__objects_9 = audio_pulse.$(OBJEXT)6.101 +@AUDIO_ESOUND_TRUE@am__objects_10 = audio_esd.$(OBJEXT)6.102 +@AUDIO_ALSA_TRUE@am__objects_11 = audio_alsa.$(OBJEXT)6.103 +@CDROM_LINUX_TRUE@am__objects_12 = cd_linux.$(OBJEXT)6.104 +@CDROM_OSX_TRUE@am__objects_13 = cd_osx.$(OBJEXT) osx_iokit.$(OBJEXT)6.105 +@CDROM_NONE_TRUE@am__objects_14 = cd_none.$(OBJEXT)6.106 +@JOY_LINUX_TRUE@am__objects_15 = joy_linux.$(OBJEXT)6.107 am_lxdream_OBJECTS = main.$(OBJEXT) version.$(OBJEXT) config.$(OBJEXT) \6.108 - mem.$(OBJEXT) sdram.$(OBJEXT) paths.$(OBJEXT) watch.$(OBJEXT) \6.109 - asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \6.110 - dcload.$(OBJEXT) ide.$(OBJEXT) gdimage.$(OBJEXT) \6.111 - gdrom.$(OBJEXT) nrg.$(OBJEXT) cdi.$(OBJEXT) gdi.$(OBJEXT) \6.112 - edc_ecc.$(OBJEXT) mmc.$(OBJEXT) dreamcast.$(OBJEXT) \6.113 - eventq.$(OBJEXT) sh4.$(OBJEXT) intc.$(OBJEXT) sh4mem.$(OBJEXT) \6.114 - timer.$(OBJEXT) dmac.$(OBJEXT) mmu.$(OBJEXT) sh4core.$(OBJEXT) \6.115 - sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) scif.$(OBJEXT) \6.116 - sh4stat.$(OBJEXT) xltcache.$(OBJEXT) pmm.$(OBJEXT) \6.117 - cache.$(OBJEXT) armcore.$(OBJEXT) armdasm.$(OBJEXT) \6.118 - armmem.$(OBJEXT) aica.$(OBJEXT) audio.$(OBJEXT) pvr2.$(OBJEXT) \6.119 + mem.$(OBJEXT) sdram.$(OBJEXT) watch.$(OBJEXT) asic.$(OBJEXT) \6.120 + syscall.$(OBJEXT) bios.$(OBJEXT) dcload.$(OBJEXT) \6.121 + ide.$(OBJEXT) gdimage.$(OBJEXT) gdrom.$(OBJEXT) nrg.$(OBJEXT) \6.122 + cdi.$(OBJEXT) gdi.$(OBJEXT) edc_ecc.$(OBJEXT) mmc.$(OBJEXT) \6.123 + dreamcast.$(OBJEXT) eventq.$(OBJEXT) sh4.$(OBJEXT) \6.124 + intc.$(OBJEXT) sh4mem.$(OBJEXT) timer.$(OBJEXT) dmac.$(OBJEXT) \6.125 + mmu.$(OBJEXT) sh4core.$(OBJEXT) sh4dasm.$(OBJEXT) \6.126 + sh4mmio.$(OBJEXT) scif.$(OBJEXT) sh4stat.$(OBJEXT) \6.127 + xltcache.$(OBJEXT) pmm.$(OBJEXT) cache.$(OBJEXT) \6.128 + armcore.$(OBJEXT) armdasm.$(OBJEXT) armmem.$(OBJEXT) \6.129 + aica.$(OBJEXT) audio.$(OBJEXT) pvr2.$(OBJEXT) \6.130 pvr2mem.$(OBJEXT) tacore.$(OBJEXT) rendsort.$(OBJEXT) \6.131 texcache.$(OBJEXT) yuv.$(OBJEXT) rendsave.$(OBJEXT) \6.132 scene.$(OBJEXT) gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT) \6.133 @@ -186,7 +188,8 @@6.134 $(am__objects_3) $(am__objects_4) $(am__objects_5) \6.135 $(am__objects_6) $(am__objects_7) $(am__objects_8) \6.136 $(am__objects_9) $(am__objects_10) $(am__objects_11) \6.137 - $(am__objects_12) $(am__objects_13) $(am__objects_14)6.138 + $(am__objects_12) $(am__objects_13) $(am__objects_14) \6.139 + $(am__objects_15)6.140 lxdream_OBJECTS = $(am_lxdream_OBJECTS)6.141 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1)6.142 am__test_testsh4x86_SOURCES_DIST = test/testsh4x86.c x86dasm/x86dasm.c \6.143 @@ -212,6 +215,11 @@6.144 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)6.145 CCLD = $(CC)6.146 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@6.147 +OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \6.148 + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)6.149 +OBJCLD = $(OBJC)6.150 +OBJCLINK = $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) \6.151 + $(LDFLAGS) -o $@6.152 SOURCES = $(gendec_SOURCES) $(genglsl_SOURCES) $(lxdream_SOURCES) \6.153 $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)6.154 DIST_SOURCES = $(gendec_SOURCES) $(genglsl_SOURCES) \6.155 @@ -306,6 +314,10 @@6.156 MKINSTALLDIRS = @MKINSTALLDIRS@6.157 MSGFMT = @MSGFMT@6.158 MSGFMT_OPTS = @MSGFMT_OPTS@6.159 +OBJC = @OBJC@6.160 +OBJCDEPMODE = @OBJCDEPMODE@6.161 +OBJCFLAGS = @OBJCFLAGS@6.162 +OBJCPP = @OBJCPP@6.163 OBJEXT = @OBJEXT@6.164 PACKAGE = @PACKAGE@6.165 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@6.166 @@ -323,6 +335,7 @@6.167 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@6.168 PULSE_CFLAGS = @PULSE_CFLAGS@6.169 PULSE_LIBS = @PULSE_LIBS@6.170 +SED = @SED@6.171 SET_MAKE = @SET_MAKE@6.172 SHCC = @SHCC@6.173 SHELL = @SHELL@6.174 @@ -339,8 +352,11 @@6.175 VIDEO_OSMESA_TRUE = @VIDEO_OSMESA_TRUE@6.176 XGETTEXT = @XGETTEXT@6.177 ac_ct_CC = @ac_ct_CC@6.178 +ac_ct_OBJC = @ac_ct_OBJC@6.179 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@6.180 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@6.181 +am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@6.182 +am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@6.183 am__include = @am__include@6.184 am__leading_dot = @am__leading_dot@6.185 am__quote = @am__quote@6.186 @@ -402,38 +418,39 @@6.187 #all-am: checkversion6.188 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c6.189 genglsl_SOURCES = tools/genglsl.c6.190 +lxdream_LINK = $(CCLD)6.191 lxdream_SOURCES = main.c version.c config.c config.h lxdream.h dream.h \6.192 gui.h cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \6.193 - paths.c watch.c asic.c asic.h clock.h serial.h syscall.c \6.194 - syscall.h bios.c dcload.c gdrom/ide.c gdrom/ide.h \6.195 - gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \6.196 - gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c \6.197 - gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \6.198 - gdrom/edc_l2sq.h gdrom/edc_scramble.h gdrom/mmc.c \6.199 - gdrom/gddriver.h dreamcast.c dreamcast.h eventq.c eventq.h \6.200 - sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c \6.201 - sh4/dmac.c sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c \6.202 - sh4/sh4dasm.h sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c \6.203 - sh4/sh4stat.c sh4/sh4stat.h sh4/xltcache.c sh4/xltcache.h \6.204 - sh4/sh4.h sh4/dmac.h sh4/pmm.c sh4/cache.c sh4/mmu.h \6.205 - aica/armcore.c aica/armcore.h aica/armdasm.c aica/armdasm.h \6.206 - aica/armmem.c aica/aica.c aica/aica.h aica/audio.c \6.207 - aica/audio.h pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c \6.208 - pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c pvr2/texcache.c \6.209 - pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \6.210 - pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \6.211 - pvr2/glrender.c pvr2/vertex.glsl pvr2/fragment.glsl \6.212 - maple/maple.c maple/maple.h maple/controller.c maple/kbd.c \6.213 - maple/mouse.c maple/lightgun.c loader.c loader.h elf.h \6.214 - bootstrap.c bootstrap.h util.c gdlist.c gdlist.h display.c \6.215 - display.h dckeysyms.h drivers/audio_null.c \6.216 - drivers/video_null.c drivers/video_gl.c drivers/video_gl.h \6.217 - drivers/gl_fbo.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \6.218 - sh4/sh4dasm.in sh4/sh4stat.in $(am__append_1) $(am__append_3) \6.219 - $(am__append_4) $(am__append_5) $(am__append_6) \6.220 - $(am__append_7) $(am__append_8) $(am__append_9) \6.221 - $(am__append_10) $(am__append_11) $(am__append_12) \6.222 - $(am__append_13) $(am__append_14) $(am__append_15)6.223 + watch.c asic.c asic.h clock.h serial.h syscall.c syscall.h \6.224 + bios.c dcload.c gdrom/ide.c gdrom/ide.h gdrom/packet.h \6.225 + gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c \6.226 + gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c gdrom/ecc.h \6.227 + gdrom/edc_crctable.h gdrom/edc_encoder.h gdrom/edc_l2sq.h \6.228 + gdrom/edc_scramble.h gdrom/mmc.c gdrom/gddriver.h dreamcast.c \6.229 + dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c sh4/intc.h \6.230 + sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c sh4/sh4core.c \6.231 + sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h sh4/sh4mmio.c \6.232 + sh4/sh4mmio.h sh4/scif.c sh4/sh4stat.c sh4/sh4stat.h \6.233 + sh4/xltcache.c sh4/xltcache.h sh4/sh4.h sh4/dmac.h sh4/pmm.c \6.234 + sh4/cache.c sh4/mmu.h aica/armcore.c aica/armcore.h \6.235 + aica/armdasm.c aica/armdasm.h aica/armmem.c aica/aica.c \6.236 + aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \6.237 + pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \6.238 + pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \6.239 + pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c \6.240 + pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \6.241 + pvr2/fragment.glsl maple/maple.c maple/maple.h \6.242 + maple/controller.c maple/kbd.c maple/mouse.c maple/lightgun.c \6.243 + loader.c loader.h elf.h bootstrap.c bootstrap.h util.c \6.244 + gdlist.c gdlist.h display.c display.h dckeysyms.h \6.245 + drivers/audio_null.c drivers/video_null.c drivers/video_gl.c \6.246 + drivers/video_gl.h drivers/gl_fbo.c sh4/sh4.def sh4/sh4core.in \6.247 + sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in $(am__append_1) \6.248 + $(am__append_3) $(am__append_4) $(am__append_5) \6.249 + $(am__append_6) $(am__append_7) $(am__append_8) \6.250 + $(am__append_9) $(am__append_10) $(am__append_11) \6.251 + $(am__append_12) $(am__append_13) $(am__append_14) \6.252 + $(am__append_15) $(am__append_16)6.253 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@6.254 @BUILD_SH4X86_TRUE@test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \6.255 @BUILD_SH4X86_TRUE@ x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \6.256 @@ -449,7 +466,7 @@6.257 $(MAKE) $(AM_MAKEFLAGS) all-am6.259 .SUFFIXES:6.260 -.SUFFIXES: .c .o .obj6.261 +.SUFFIXES: .c .m .o .obj6.262 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)6.263 @for dep in $?; do \6.264 case '$(am__configure_deps)' in \6.265 @@ -516,7 +533,7 @@6.266 $(LINK) $(genglsl_LDFLAGS) $(genglsl_OBJECTS) $(genglsl_LDADD) $(LIBS)6.267 lxdream$(EXEEXT): $(lxdream_OBJECTS) $(lxdream_DEPENDENCIES)6.268 @rm -f lxdream$(EXEEXT)6.269 - $(LINK) $(lxdream_LDFLAGS) $(lxdream_OBJECTS) $(lxdream_LDADD) $(LIBS)6.270 + $(lxdream_LINK) $(lxdream_LDFLAGS) $(lxdream_OBJECTS) $(lxdream_LDADD) $(LIBS)6.271 test/$(am__dirstamp):6.272 @$(mkdir_p) test6.273 @: > test/$(am__dirstamp)6.274 @@ -605,7 +622,8 @@6.275 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@6.276 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrg.Po@am__quote@6.277 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osx_iokit.Po@am__quote@6.278 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paths.Po@am__quote@6.279 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paths_osx.Po@am__quote@6.280 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paths_unix.Po@am__quote@6.281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pmm.Po@am__quote@6.282 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2.Po@am__quote@6.283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2mem.Po@am__quote@6.284 @@ -1622,104 +1640,6 @@6.285 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.286 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gtk.obj `if test -f 'drivers/video_gtk.c'; then $(CYGPATH_W) 'drivers/video_gtk.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gtk.c'; fi`6.288 -cocoaui.o: cocoaui/cocoaui.c6.289 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoaui.o -MD -MP -MF "$(DEPDIR)/cocoaui.Tpo" -c -o cocoaui.o `test -f 'cocoaui/cocoaui.c' || echo '$(srcdir)/'`cocoaui/cocoaui.c; \6.290 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoaui.Tpo" "$(DEPDIR)/cocoaui.Po"; else rm -f "$(DEPDIR)/cocoaui.Tpo"; exit 1; fi6.291 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoaui.c' object='cocoaui.o' libtool=no @AMDEPBACKSLASH@6.292 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.293 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoaui.o `test -f 'cocoaui/cocoaui.c' || echo '$(srcdir)/'`cocoaui/cocoaui.c6.294 -6.295 -cocoaui.obj: cocoaui/cocoaui.c6.296 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoaui.obj -MD -MP -MF "$(DEPDIR)/cocoaui.Tpo" -c -o cocoaui.obj `if test -f 'cocoaui/cocoaui.c'; then $(CYGPATH_W) 'cocoaui/cocoaui.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoaui.c'; fi`; \6.297 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoaui.Tpo" "$(DEPDIR)/cocoaui.Po"; else rm -f "$(DEPDIR)/cocoaui.Tpo"; exit 1; fi6.298 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoaui.c' object='cocoaui.obj' libtool=no @AMDEPBACKSLASH@6.299 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.300 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoaui.obj `if test -f 'cocoaui/cocoaui.c'; then $(CYGPATH_W) 'cocoaui/cocoaui.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoaui.c'; fi`6.301 -6.302 -cocoa_win.o: cocoaui/cocoa_win.c6.303 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_win.o -MD -MP -MF "$(DEPDIR)/cocoa_win.Tpo" -c -o cocoa_win.o `test -f 'cocoaui/cocoa_win.c' || echo '$(srcdir)/'`cocoaui/cocoa_win.c; \6.304 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_win.Tpo" "$(DEPDIR)/cocoa_win.Po"; else rm -f "$(DEPDIR)/cocoa_win.Tpo"; exit 1; fi6.305 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_win.c' object='cocoa_win.o' libtool=no @AMDEPBACKSLASH@6.306 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.307 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_win.o `test -f 'cocoaui/cocoa_win.c' || echo '$(srcdir)/'`cocoaui/cocoa_win.c6.308 -6.309 -cocoa_win.obj: cocoaui/cocoa_win.c6.310 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_win.obj -MD -MP -MF "$(DEPDIR)/cocoa_win.Tpo" -c -o cocoa_win.obj `if test -f 'cocoaui/cocoa_win.c'; then $(CYGPATH_W) 'cocoaui/cocoa_win.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_win.c'; fi`; \6.311 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_win.Tpo" "$(DEPDIR)/cocoa_win.Po"; else rm -f "$(DEPDIR)/cocoa_win.Tpo"; exit 1; fi6.312 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_win.c' object='cocoa_win.obj' libtool=no @AMDEPBACKSLASH@6.313 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.314 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_win.obj `if test -f 'cocoaui/cocoa_win.c'; then $(CYGPATH_W) 'cocoaui/cocoa_win.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_win.c'; fi`6.315 -6.316 -cocoa_gd.o: cocoaui/cocoa_gd.c6.317 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_gd.o -MD -MP -MF "$(DEPDIR)/cocoa_gd.Tpo" -c -o cocoa_gd.o `test -f 'cocoaui/cocoa_gd.c' || echo '$(srcdir)/'`cocoaui/cocoa_gd.c; \6.318 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_gd.Tpo" "$(DEPDIR)/cocoa_gd.Po"; else rm -f "$(DEPDIR)/cocoa_gd.Tpo"; exit 1; fi6.319 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_gd.c' object='cocoa_gd.o' libtool=no @AMDEPBACKSLASH@6.320 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.321 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_gd.o `test -f 'cocoaui/cocoa_gd.c' || echo '$(srcdir)/'`cocoaui/cocoa_gd.c6.322 -6.323 -cocoa_gd.obj: cocoaui/cocoa_gd.c6.324 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_gd.obj -MD -MP -MF "$(DEPDIR)/cocoa_gd.Tpo" -c -o cocoa_gd.obj `if test -f 'cocoaui/cocoa_gd.c'; then $(CYGPATH_W) 'cocoaui/cocoa_gd.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_gd.c'; fi`; \6.325 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_gd.Tpo" "$(DEPDIR)/cocoa_gd.Po"; else rm -f "$(DEPDIR)/cocoa_gd.Tpo"; exit 1; fi6.326 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_gd.c' object='cocoa_gd.obj' libtool=no @AMDEPBACKSLASH@6.327 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.328 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_gd.obj `if test -f 'cocoaui/cocoa_gd.c'; then $(CYGPATH_W) 'cocoaui/cocoa_gd.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_gd.c'; fi`6.329 -6.330 -cocoa_prefs.o: cocoaui/cocoa_prefs.c6.331 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_prefs.o -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.c' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.c; \6.332 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi6.333 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_prefs.c' object='cocoa_prefs.o' libtool=no @AMDEPBACKSLASH@6.334 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.335 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.c' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.c6.336 -6.337 -cocoa_prefs.obj: cocoaui/cocoa_prefs.c6.338 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_prefs.obj -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.c'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.c'; fi`; \6.339 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi6.340 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_prefs.c' object='cocoa_prefs.obj' libtool=no @AMDEPBACKSLASH@6.341 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.342 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.c'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.c'; fi`6.343 -6.344 -cocoa_path.o: cocoaui/cocoa_path.c6.345 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_path.o -MD -MP -MF "$(DEPDIR)/cocoa_path.Tpo" -c -o cocoa_path.o `test -f 'cocoaui/cocoa_path.c' || echo '$(srcdir)/'`cocoaui/cocoa_path.c; \6.346 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_path.Tpo" "$(DEPDIR)/cocoa_path.Po"; else rm -f "$(DEPDIR)/cocoa_path.Tpo"; exit 1; fi6.347 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_path.c' object='cocoa_path.o' libtool=no @AMDEPBACKSLASH@6.348 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.349 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_path.o `test -f 'cocoaui/cocoa_path.c' || echo '$(srcdir)/'`cocoaui/cocoa_path.c6.350 -6.351 -cocoa_path.obj: cocoaui/cocoa_path.c6.352 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_path.obj -MD -MP -MF "$(DEPDIR)/cocoa_path.Tpo" -c -o cocoa_path.obj `if test -f 'cocoaui/cocoa_path.c'; then $(CYGPATH_W) 'cocoaui/cocoa_path.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_path.c'; fi`; \6.353 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_path.Tpo" "$(DEPDIR)/cocoa_path.Po"; else rm -f "$(DEPDIR)/cocoa_path.Tpo"; exit 1; fi6.354 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_path.c' object='cocoa_path.obj' libtool=no @AMDEPBACKSLASH@6.355 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.356 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_path.obj `if test -f 'cocoaui/cocoa_path.c'; then $(CYGPATH_W) 'cocoaui/cocoa_path.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_path.c'; fi`6.357 -6.358 -cocoa_ctrl.o: cocoaui/cocoa_ctrl.c6.359 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_ctrl.o -MD -MP -MF "$(DEPDIR)/cocoa_ctrl.Tpo" -c -o cocoa_ctrl.o `test -f 'cocoaui/cocoa_ctrl.c' || echo '$(srcdir)/'`cocoaui/cocoa_ctrl.c; \6.360 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_ctrl.Tpo" "$(DEPDIR)/cocoa_ctrl.Po"; else rm -f "$(DEPDIR)/cocoa_ctrl.Tpo"; exit 1; fi6.361 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_ctrl.c' object='cocoa_ctrl.o' libtool=no @AMDEPBACKSLASH@6.362 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.363 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_ctrl.o `test -f 'cocoaui/cocoa_ctrl.c' || echo '$(srcdir)/'`cocoaui/cocoa_ctrl.c6.364 -6.365 -cocoa_ctrl.obj: cocoaui/cocoa_ctrl.c6.366 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_ctrl.obj -MD -MP -MF "$(DEPDIR)/cocoa_ctrl.Tpo" -c -o cocoa_ctrl.obj `if test -f 'cocoaui/cocoa_ctrl.c'; then $(CYGPATH_W) 'cocoaui/cocoa_ctrl.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_ctrl.c'; fi`; \6.367 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_ctrl.Tpo" "$(DEPDIR)/cocoa_ctrl.Po"; else rm -f "$(DEPDIR)/cocoa_ctrl.Tpo"; exit 1; fi6.368 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_ctrl.c' object='cocoa_ctrl.obj' libtool=no @AMDEPBACKSLASH@6.369 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.370 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_ctrl.obj `if test -f 'cocoaui/cocoa_ctrl.c'; then $(CYGPATH_W) 'cocoaui/cocoa_ctrl.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_ctrl.c'; fi`6.371 -6.372 -video_osx.o: drivers/video_osx.c6.373 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_osx.o -MD -MP -MF "$(DEPDIR)/video_osx.Tpo" -c -o video_osx.o `test -f 'drivers/video_osx.c' || echo '$(srcdir)/'`drivers/video_osx.c; \6.374 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_osx.Tpo" "$(DEPDIR)/video_osx.Po"; else rm -f "$(DEPDIR)/video_osx.Tpo"; exit 1; fi6.375 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_osx.c' object='video_osx.o' libtool=no @AMDEPBACKSLASH@6.376 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.377 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_osx.o `test -f 'drivers/video_osx.c' || echo '$(srcdir)/'`drivers/video_osx.c6.378 -6.379 -video_osx.obj: drivers/video_osx.c6.380 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_osx.obj -MD -MP -MF "$(DEPDIR)/video_osx.Tpo" -c -o video_osx.obj `if test -f 'drivers/video_osx.c'; then $(CYGPATH_W) 'drivers/video_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_osx.c'; fi`; \6.381 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_osx.Tpo" "$(DEPDIR)/video_osx.Po"; else rm -f "$(DEPDIR)/video_osx.Tpo"; exit 1; fi6.382 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_osx.c' object='video_osx.obj' libtool=no @AMDEPBACKSLASH@6.383 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.384 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_osx.obj `if test -f 'drivers/video_osx.c'; then $(CYGPATH_W) 'drivers/video_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_osx.c'; fi`6.385 -6.386 video_gdk.o: drivers/video_gdk.c6.387 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gdk.o -MD -MP -MF "$(DEPDIR)/video_gdk.Tpo" -c -o video_gdk.o `test -f 'drivers/video_gdk.c' || echo '$(srcdir)/'`drivers/video_gdk.c; \6.388 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_gdk.Tpo" "$(DEPDIR)/video_gdk.Po"; else rm -f "$(DEPDIR)/video_gdk.Tpo"; exit 1; fi6.389 @@ -1748,34 +1668,6 @@6.390 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.391 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_glx.obj `if test -f 'drivers/video_glx.c'; then $(CYGPATH_W) 'drivers/video_glx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_glx.c'; fi`6.393 -video_nsgl.o: drivers/video_nsgl.c6.394 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_nsgl.o -MD -MP -MF "$(DEPDIR)/video_nsgl.Tpo" -c -o video_nsgl.o `test -f 'drivers/video_nsgl.c' || echo '$(srcdir)/'`drivers/video_nsgl.c; \6.395 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_nsgl.Tpo" "$(DEPDIR)/video_nsgl.Po"; else rm -f "$(DEPDIR)/video_nsgl.Tpo"; exit 1; fi6.396 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_nsgl.c' object='video_nsgl.o' libtool=no @AMDEPBACKSLASH@6.397 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.398 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_nsgl.o `test -f 'drivers/video_nsgl.c' || echo '$(srcdir)/'`drivers/video_nsgl.c6.399 -6.400 -video_nsgl.obj: drivers/video_nsgl.c6.401 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_nsgl.obj -MD -MP -MF "$(DEPDIR)/video_nsgl.Tpo" -c -o video_nsgl.obj `if test -f 'drivers/video_nsgl.c'; then $(CYGPATH_W) 'drivers/video_nsgl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_nsgl.c'; fi`; \6.402 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_nsgl.Tpo" "$(DEPDIR)/video_nsgl.Po"; else rm -f "$(DEPDIR)/video_nsgl.Tpo"; exit 1; fi6.403 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_nsgl.c' object='video_nsgl.obj' libtool=no @AMDEPBACKSLASH@6.404 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.405 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_nsgl.obj `if test -f 'drivers/video_nsgl.c'; then $(CYGPATH_W) 'drivers/video_nsgl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_nsgl.c'; fi`6.406 -6.407 -audio_osx.o: drivers/audio_osx.c6.408 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_osx.o -MD -MP -MF "$(DEPDIR)/audio_osx.Tpo" -c -o audio_osx.o `test -f 'drivers/audio_osx.c' || echo '$(srcdir)/'`drivers/audio_osx.c; \6.409 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_osx.Tpo" "$(DEPDIR)/audio_osx.Po"; else rm -f "$(DEPDIR)/audio_osx.Tpo"; exit 1; fi6.410 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/audio_osx.c' object='audio_osx.o' libtool=no @AMDEPBACKSLASH@6.411 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.412 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_osx.o `test -f 'drivers/audio_osx.c' || echo '$(srcdir)/'`drivers/audio_osx.c6.413 -6.414 -audio_osx.obj: drivers/audio_osx.c6.415 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_osx.obj -MD -MP -MF "$(DEPDIR)/audio_osx.Tpo" -c -o audio_osx.obj `if test -f 'drivers/audio_osx.c'; then $(CYGPATH_W) 'drivers/audio_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_osx.c'; fi`; \6.416 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_osx.Tpo" "$(DEPDIR)/audio_osx.Po"; else rm -f "$(DEPDIR)/audio_osx.Tpo"; exit 1; fi6.417 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/audio_osx.c' object='audio_osx.obj' libtool=no @AMDEPBACKSLASH@6.418 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.419 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_osx.obj `if test -f 'drivers/audio_osx.c'; then $(CYGPATH_W) 'drivers/audio_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_osx.c'; fi`6.420 -6.421 audio_pulse.o: drivers/audio_pulse.c6.422 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_pulse.o -MD -MP -MF "$(DEPDIR)/audio_pulse.Tpo" -c -o audio_pulse.o `test -f 'drivers/audio_pulse.c' || echo '$(srcdir)/'`drivers/audio_pulse.c; \6.423 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_pulse.Tpo" "$(DEPDIR)/audio_pulse.Po"; else rm -f "$(DEPDIR)/audio_pulse.Tpo"; exit 1; fi6.424 @@ -1846,20 +1738,6 @@6.425 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.426 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_osx.obj `if test -f 'drivers/cd_osx.c'; then $(CYGPATH_W) 'drivers/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_osx.c'; fi`6.428 -osx_iokit.o: drivers/osx_iokit.c6.429 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT osx_iokit.o -MD -MP -MF "$(DEPDIR)/osx_iokit.Tpo" -c -o osx_iokit.o `test -f 'drivers/osx_iokit.c' || echo '$(srcdir)/'`drivers/osx_iokit.c; \6.430 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/osx_iokit.Tpo" "$(DEPDIR)/osx_iokit.Po"; else rm -f "$(DEPDIR)/osx_iokit.Tpo"; exit 1; fi6.431 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/osx_iokit.c' object='osx_iokit.o' libtool=no @AMDEPBACKSLASH@6.432 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.433 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o osx_iokit.o `test -f 'drivers/osx_iokit.c' || echo '$(srcdir)/'`drivers/osx_iokit.c6.434 -6.435 -osx_iokit.obj: drivers/osx_iokit.c6.436 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT osx_iokit.obj -MD -MP -MF "$(DEPDIR)/osx_iokit.Tpo" -c -o osx_iokit.obj `if test -f 'drivers/osx_iokit.c'; then $(CYGPATH_W) 'drivers/osx_iokit.c'; else $(CYGPATH_W) '$(srcdir)/drivers/osx_iokit.c'; fi`; \6.437 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/osx_iokit.Tpo" "$(DEPDIR)/osx_iokit.Po"; else rm -f "$(DEPDIR)/osx_iokit.Tpo"; exit 1; fi6.438 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/osx_iokit.c' object='osx_iokit.obj' libtool=no @AMDEPBACKSLASH@6.439 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.440 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o osx_iokit.obj `if test -f 'drivers/osx_iokit.c'; then $(CYGPATH_W) 'drivers/osx_iokit.c'; else $(CYGPATH_W) '$(srcdir)/drivers/osx_iokit.c'; fi`6.441 -6.442 cd_none.o: drivers/cd_none.c6.443 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_none.o -MD -MP -MF "$(DEPDIR)/cd_none.Tpo" -c -o cd_none.o `test -f 'drivers/cd_none.c' || echo '$(srcdir)/'`drivers/cd_none.c; \6.444 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_none.Tpo" "$(DEPDIR)/cd_none.Po"; else rm -f "$(DEPDIR)/cd_none.Tpo"; exit 1; fi6.445 @@ -1915,6 +1793,174 @@6.446 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test/testxlt.c' object='testxlt.obj' libtool=no @AMDEPBACKSLASH@6.447 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.448 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testxlt.obj `if test -f 'test/testxlt.c'; then $(CYGPATH_W) 'test/testxlt.c'; else $(CYGPATH_W) '$(srcdir)/test/testxlt.c'; fi`6.449 +6.450 +.m.o:6.451 +@am__fastdepOBJC_TRUE@ if $(OBJCCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \6.452 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi6.453 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@6.454 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.455 +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $<6.456 +6.457 +.m.obj:6.458 +@am__fastdepOBJC_TRUE@ if $(OBJCCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \6.459 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi6.460 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@6.461 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.462 +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`6.463 +6.464 +cocoaui.o: cocoaui/cocoaui.m6.465 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoaui.o -MD -MP -MF "$(DEPDIR)/cocoaui.Tpo" -c -o cocoaui.o `test -f 'cocoaui/cocoaui.m' || echo '$(srcdir)/'`cocoaui/cocoaui.m; \6.466 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoaui.Tpo" "$(DEPDIR)/cocoaui.Po"; else rm -f "$(DEPDIR)/cocoaui.Tpo"; exit 1; fi6.467 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoaui.m' object='cocoaui.o' libtool=no @AMDEPBACKSLASH@6.468 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.469 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoaui.o `test -f 'cocoaui/cocoaui.m' || echo '$(srcdir)/'`cocoaui/cocoaui.m6.470 +6.471 +cocoaui.obj: cocoaui/cocoaui.m6.472 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoaui.obj -MD -MP -MF "$(DEPDIR)/cocoaui.Tpo" -c -o cocoaui.obj `if test -f 'cocoaui/cocoaui.m'; then $(CYGPATH_W) 'cocoaui/cocoaui.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoaui.m'; fi`; \6.473 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoaui.Tpo" "$(DEPDIR)/cocoaui.Po"; else rm -f "$(DEPDIR)/cocoaui.Tpo"; exit 1; fi6.474 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoaui.m' object='cocoaui.obj' libtool=no @AMDEPBACKSLASH@6.475 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.476 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoaui.obj `if test -f 'cocoaui/cocoaui.m'; then $(CYGPATH_W) 'cocoaui/cocoaui.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoaui.m'; fi`6.477 +6.478 +cocoa_win.o: cocoaui/cocoa_win.m6.479 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_win.o -MD -MP -MF "$(DEPDIR)/cocoa_win.Tpo" -c -o cocoa_win.o `test -f 'cocoaui/cocoa_win.m' || echo '$(srcdir)/'`cocoaui/cocoa_win.m; \6.480 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_win.Tpo" "$(DEPDIR)/cocoa_win.Po"; else rm -f "$(DEPDIR)/cocoa_win.Tpo"; exit 1; fi6.481 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_win.m' object='cocoa_win.o' libtool=no @AMDEPBACKSLASH@6.482 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.483 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_win.o `test -f 'cocoaui/cocoa_win.m' || echo '$(srcdir)/'`cocoaui/cocoa_win.m6.484 +6.485 +cocoa_win.obj: cocoaui/cocoa_win.m6.486 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_win.obj -MD -MP -MF "$(DEPDIR)/cocoa_win.Tpo" -c -o cocoa_win.obj `if test -f 'cocoaui/cocoa_win.m'; then $(CYGPATH_W) 'cocoaui/cocoa_win.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_win.m'; fi`; \6.487 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_win.Tpo" "$(DEPDIR)/cocoa_win.Po"; else rm -f "$(DEPDIR)/cocoa_win.Tpo"; exit 1; fi6.488 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_win.m' object='cocoa_win.obj' libtool=no @AMDEPBACKSLASH@6.489 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.490 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_win.obj `if test -f 'cocoaui/cocoa_win.m'; then $(CYGPATH_W) 'cocoaui/cocoa_win.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_win.m'; fi`6.491 +6.492 +cocoa_gd.o: cocoaui/cocoa_gd.m6.493 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_gd.o -MD -MP -MF "$(DEPDIR)/cocoa_gd.Tpo" -c -o cocoa_gd.o `test -f 'cocoaui/cocoa_gd.m' || echo '$(srcdir)/'`cocoaui/cocoa_gd.m; \6.494 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_gd.Tpo" "$(DEPDIR)/cocoa_gd.Po"; else rm -f "$(DEPDIR)/cocoa_gd.Tpo"; exit 1; fi6.495 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_gd.m' object='cocoa_gd.o' libtool=no @AMDEPBACKSLASH@6.496 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.497 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_gd.o `test -f 'cocoaui/cocoa_gd.m' || echo '$(srcdir)/'`cocoaui/cocoa_gd.m6.498 +6.499 +cocoa_gd.obj: cocoaui/cocoa_gd.m6.500 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_gd.obj -MD -MP -MF "$(DEPDIR)/cocoa_gd.Tpo" -c -o cocoa_gd.obj `if test -f 'cocoaui/cocoa_gd.m'; then $(CYGPATH_W) 'cocoaui/cocoa_gd.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_gd.m'; fi`; \6.501 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_gd.Tpo" "$(DEPDIR)/cocoa_gd.Po"; else rm -f "$(DEPDIR)/cocoa_gd.Tpo"; exit 1; fi6.502 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_gd.m' object='cocoa_gd.obj' libtool=no @AMDEPBACKSLASH@6.503 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.504 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_gd.obj `if test -f 'cocoaui/cocoa_gd.m'; then $(CYGPATH_W) 'cocoaui/cocoa_gd.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_gd.m'; fi`6.505 +6.506 +cocoa_prefs.o: cocoaui/cocoa_prefs.m6.507 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_prefs.o -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.m' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.m; \6.508 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi6.509 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_prefs.m' object='cocoa_prefs.o' libtool=no @AMDEPBACKSLASH@6.510 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.511 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.m' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.m6.512 +6.513 +cocoa_prefs.obj: cocoaui/cocoa_prefs.m6.514 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_prefs.obj -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.m'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.m'; fi`; \6.515 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi6.516 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_prefs.m' object='cocoa_prefs.obj' libtool=no @AMDEPBACKSLASH@6.517 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.518 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.m'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.m'; fi`6.519 +6.520 +cocoa_path.o: cocoaui/cocoa_path.m6.521 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_path.o -MD -MP -MF "$(DEPDIR)/cocoa_path.Tpo" -c -o cocoa_path.o `test -f 'cocoaui/cocoa_path.m' || echo '$(srcdir)/'`cocoaui/cocoa_path.m; \6.522 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_path.Tpo" "$(DEPDIR)/cocoa_path.Po"; else rm -f "$(DEPDIR)/cocoa_path.Tpo"; exit 1; fi6.523 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_path.m' object='cocoa_path.o' libtool=no @AMDEPBACKSLASH@6.524 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.525 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_path.o `test -f 'cocoaui/cocoa_path.m' || echo '$(srcdir)/'`cocoaui/cocoa_path.m6.526 +6.527 +cocoa_path.obj: cocoaui/cocoa_path.m6.528 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_path.obj -MD -MP -MF "$(DEPDIR)/cocoa_path.Tpo" -c -o cocoa_path.obj `if test -f 'cocoaui/cocoa_path.m'; then $(CYGPATH_W) 'cocoaui/cocoa_path.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_path.m'; fi`; \6.529 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_path.Tpo" "$(DEPDIR)/cocoa_path.Po"; else rm -f "$(DEPDIR)/cocoa_path.Tpo"; exit 1; fi6.530 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_path.m' object='cocoa_path.obj' libtool=no @AMDEPBACKSLASH@6.531 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.532 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_path.obj `if test -f 'cocoaui/cocoa_path.m'; then $(CYGPATH_W) 'cocoaui/cocoa_path.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_path.m'; fi`6.533 +6.534 +cocoa_ctrl.o: cocoaui/cocoa_ctrl.m6.535 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_ctrl.o -MD -MP -MF "$(DEPDIR)/cocoa_ctrl.Tpo" -c -o cocoa_ctrl.o `test -f 'cocoaui/cocoa_ctrl.m' || echo '$(srcdir)/'`cocoaui/cocoa_ctrl.m; \6.536 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_ctrl.Tpo" "$(DEPDIR)/cocoa_ctrl.Po"; else rm -f "$(DEPDIR)/cocoa_ctrl.Tpo"; exit 1; fi6.537 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_ctrl.m' object='cocoa_ctrl.o' libtool=no @AMDEPBACKSLASH@6.538 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.539 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_ctrl.o `test -f 'cocoaui/cocoa_ctrl.m' || echo '$(srcdir)/'`cocoaui/cocoa_ctrl.m6.540 +6.541 +cocoa_ctrl.obj: cocoaui/cocoa_ctrl.m6.542 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT cocoa_ctrl.obj -MD -MP -MF "$(DEPDIR)/cocoa_ctrl.Tpo" -c -o cocoa_ctrl.obj `if test -f 'cocoaui/cocoa_ctrl.m'; then $(CYGPATH_W) 'cocoaui/cocoa_ctrl.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_ctrl.m'; fi`; \6.543 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/cocoa_ctrl.Tpo" "$(DEPDIR)/cocoa_ctrl.Po"; else rm -f "$(DEPDIR)/cocoa_ctrl.Tpo"; exit 1; fi6.544 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/cocoa_ctrl.m' object='cocoa_ctrl.obj' libtool=no @AMDEPBACKSLASH@6.545 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.546 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o cocoa_ctrl.obj `if test -f 'cocoaui/cocoa_ctrl.m'; then $(CYGPATH_W) 'cocoaui/cocoa_ctrl.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_ctrl.m'; fi`6.547 +6.548 +paths_osx.o: cocoaui/paths_osx.m6.549 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT paths_osx.o -MD -MP -MF "$(DEPDIR)/paths_osx.Tpo" -c -o paths_osx.o `test -f 'cocoaui/paths_osx.m' || echo '$(srcdir)/'`cocoaui/paths_osx.m; \6.550 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/paths_osx.Tpo" "$(DEPDIR)/paths_osx.Po"; else rm -f "$(DEPDIR)/paths_osx.Tpo"; exit 1; fi6.551 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/paths_osx.m' object='paths_osx.o' libtool=no @AMDEPBACKSLASH@6.552 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.553 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o paths_osx.o `test -f 'cocoaui/paths_osx.m' || echo '$(srcdir)/'`cocoaui/paths_osx.m6.554 +6.555 +paths_osx.obj: cocoaui/paths_osx.m6.556 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT paths_osx.obj -MD -MP -MF "$(DEPDIR)/paths_osx.Tpo" -c -o paths_osx.obj `if test -f 'cocoaui/paths_osx.m'; then $(CYGPATH_W) 'cocoaui/paths_osx.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/paths_osx.m'; fi`; \6.557 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/paths_osx.Tpo" "$(DEPDIR)/paths_osx.Po"; else rm -f "$(DEPDIR)/paths_osx.Tpo"; exit 1; fi6.558 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='cocoaui/paths_osx.m' object='paths_osx.obj' libtool=no @AMDEPBACKSLASH@6.559 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.560 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o paths_osx.obj `if test -f 'cocoaui/paths_osx.m'; then $(CYGPATH_W) 'cocoaui/paths_osx.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/paths_osx.m'; fi`6.561 +6.562 +video_osx.o: drivers/video_osx.m6.563 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT video_osx.o -MD -MP -MF "$(DEPDIR)/video_osx.Tpo" -c -o video_osx.o `test -f 'drivers/video_osx.m' || echo '$(srcdir)/'`drivers/video_osx.m; \6.564 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/video_osx.Tpo" "$(DEPDIR)/video_osx.Po"; else rm -f "$(DEPDIR)/video_osx.Tpo"; exit 1; fi6.565 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/video_osx.m' object='video_osx.o' libtool=no @AMDEPBACKSLASH@6.566 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.567 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o video_osx.o `test -f 'drivers/video_osx.m' || echo '$(srcdir)/'`drivers/video_osx.m6.568 +6.569 +video_osx.obj: drivers/video_osx.m6.570 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT video_osx.obj -MD -MP -MF "$(DEPDIR)/video_osx.Tpo" -c -o video_osx.obj `if test -f 'drivers/video_osx.m'; then $(CYGPATH_W) 'drivers/video_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/video_osx.m'; fi`; \6.571 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/video_osx.Tpo" "$(DEPDIR)/video_osx.Po"; else rm -f "$(DEPDIR)/video_osx.Tpo"; exit 1; fi6.572 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/video_osx.m' object='video_osx.obj' libtool=no @AMDEPBACKSLASH@6.573 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.574 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o video_osx.obj `if test -f 'drivers/video_osx.m'; then $(CYGPATH_W) 'drivers/video_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/video_osx.m'; fi`6.575 +6.576 +video_nsgl.o: drivers/video_nsgl.m6.577 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT video_nsgl.o -MD -MP -MF "$(DEPDIR)/video_nsgl.Tpo" -c -o video_nsgl.o `test -f 'drivers/video_nsgl.m' || echo '$(srcdir)/'`drivers/video_nsgl.m; \6.578 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/video_nsgl.Tpo" "$(DEPDIR)/video_nsgl.Po"; else rm -f "$(DEPDIR)/video_nsgl.Tpo"; exit 1; fi6.579 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/video_nsgl.m' object='video_nsgl.o' libtool=no @AMDEPBACKSLASH@6.580 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.581 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o video_nsgl.o `test -f 'drivers/video_nsgl.m' || echo '$(srcdir)/'`drivers/video_nsgl.m6.582 +6.583 +video_nsgl.obj: drivers/video_nsgl.m6.584 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT video_nsgl.obj -MD -MP -MF "$(DEPDIR)/video_nsgl.Tpo" -c -o video_nsgl.obj `if test -f 'drivers/video_nsgl.m'; then $(CYGPATH_W) 'drivers/video_nsgl.m'; else $(CYGPATH_W) '$(srcdir)/drivers/video_nsgl.m'; fi`; \6.585 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/video_nsgl.Tpo" "$(DEPDIR)/video_nsgl.Po"; else rm -f "$(DEPDIR)/video_nsgl.Tpo"; exit 1; fi6.586 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/video_nsgl.m' object='video_nsgl.obj' libtool=no @AMDEPBACKSLASH@6.587 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.588 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o video_nsgl.obj `if test -f 'drivers/video_nsgl.m'; then $(CYGPATH_W) 'drivers/video_nsgl.m'; else $(CYGPATH_W) '$(srcdir)/drivers/video_nsgl.m'; fi`6.589 +6.590 +audio_osx.o: drivers/audio_osx.m6.591 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT audio_osx.o -MD -MP -MF "$(DEPDIR)/audio_osx.Tpo" -c -o audio_osx.o `test -f 'drivers/audio_osx.m' || echo '$(srcdir)/'`drivers/audio_osx.m; \6.592 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/audio_osx.Tpo" "$(DEPDIR)/audio_osx.Po"; else rm -f "$(DEPDIR)/audio_osx.Tpo"; exit 1; fi6.593 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/audio_osx.m' object='audio_osx.o' libtool=no @AMDEPBACKSLASH@6.594 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.595 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o audio_osx.o `test -f 'drivers/audio_osx.m' || echo '$(srcdir)/'`drivers/audio_osx.m6.596 +6.597 +audio_osx.obj: drivers/audio_osx.m6.598 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT audio_osx.obj -MD -MP -MF "$(DEPDIR)/audio_osx.Tpo" -c -o audio_osx.obj `if test -f 'drivers/audio_osx.m'; then $(CYGPATH_W) 'drivers/audio_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_osx.m'; fi`; \6.599 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/audio_osx.Tpo" "$(DEPDIR)/audio_osx.Po"; else rm -f "$(DEPDIR)/audio_osx.Tpo"; exit 1; fi6.600 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/audio_osx.m' object='audio_osx.obj' libtool=no @AMDEPBACKSLASH@6.601 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.602 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o audio_osx.obj `if test -f 'drivers/audio_osx.m'; then $(CYGPATH_W) 'drivers/audio_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_osx.m'; fi`6.603 +6.604 +osx_iokit.o: drivers/osx_iokit.m6.605 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT osx_iokit.o -MD -MP -MF "$(DEPDIR)/osx_iokit.Tpo" -c -o osx_iokit.o `test -f 'drivers/osx_iokit.m' || echo '$(srcdir)/'`drivers/osx_iokit.m; \6.606 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/osx_iokit.Tpo" "$(DEPDIR)/osx_iokit.Po"; else rm -f "$(DEPDIR)/osx_iokit.Tpo"; exit 1; fi6.607 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/osx_iokit.m' object='osx_iokit.o' libtool=no @AMDEPBACKSLASH@6.608 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.609 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o osx_iokit.o `test -f 'drivers/osx_iokit.m' || echo '$(srcdir)/'`drivers/osx_iokit.m6.610 +6.611 +osx_iokit.obj: drivers/osx_iokit.m6.612 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT osx_iokit.obj -MD -MP -MF "$(DEPDIR)/osx_iokit.Tpo" -c -o osx_iokit.obj `if test -f 'drivers/osx_iokit.m'; then $(CYGPATH_W) 'drivers/osx_iokit.m'; else $(CYGPATH_W) '$(srcdir)/drivers/osx_iokit.m'; fi`; \6.613 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/osx_iokit.Tpo" "$(DEPDIR)/osx_iokit.Po"; else rm -f "$(DEPDIR)/osx_iokit.Tpo"; exit 1; fi6.614 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/osx_iokit.m' object='osx_iokit.obj' libtool=no @AMDEPBACKSLASH@6.615 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.616 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o osx_iokit.obj `if test -f 'drivers/osx_iokit.m'; then $(CYGPATH_W) 'drivers/osx_iokit.m'; else $(CYGPATH_W) '$(srcdir)/drivers/osx_iokit.m'; fi`6.617 uninstall-info-am:6.619 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
7.1 --- a/src/cocoaui/cocoa_ctrl.c Thu Jan 15 03:54:21 2009 +00007.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00007.3 @@ -1,434 +0,0 @@7.4 -/**7.5 - * $Id$7.6 - *7.7 - * Construct and manage the controller configuration pane7.8 - *7.9 - * Copyright (c) 2008 Nathan Keynes.7.10 - *7.11 - * This program is free software; you can redistribute it and/or modify7.12 - * it under the terms of the GNU General Public License as published by7.13 - * the Free Software Foundation; either version 2 of the License, or7.14 - * (at your option) any later version.7.15 - *7.16 - * This program is distributed in the hope that it will be useful,7.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of7.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7.19 - * GNU General Public License for more details.7.20 - */7.21 -7.22 -#include "cocoaui.h"7.23 -#include "config.h"7.24 -#include "display.h"7.25 -#include "maple/maple.h"7.26 -7.27 -#include <glib/gstrfuncs.h>7.28 -7.29 -#define MAX_DEVICES 47.30 -7.31 -#define KEYBINDING_SIZE 1107.32 -7.33 -static void cocoa_config_keysym_hook(void *data, const gchar *keysym);7.34 -7.35 -@interface KeyBindingEditor (Private)7.36 -- (void)updateKeysym: (const gchar *)sym;7.37 -@end7.38 -7.39 -@implementation KeyBindingEditor7.40 -- (id)init7.41 -{7.42 - self = [super init];7.43 - isPrimed = NO;7.44 - lastValue = nil;7.45 - [self setFieldEditor: YES];7.46 - [self setEditable: FALSE];7.47 - return self;7.48 -}7.49 -- (void)dealloc7.50 -{7.51 - if( lastValue != nil ) {7.52 - [lastValue release];7.53 - lastValue = nil;7.54 - }7.55 - [super dealloc];7.56 -}7.57 -- (void)setPrimed: (BOOL)primed7.58 -{7.59 - if( primed != isPrimed ) {7.60 - isPrimed = primed;7.61 - if( primed ) {7.62 - lastValue = [[NSString stringWithString: [self string]] retain];7.63 - [self setString: @"<press key>"];7.64 - input_set_keysym_hook(cocoa_config_keysym_hook, self);7.65 - } else {7.66 - [lastValue release];7.67 - lastValue = nil;7.68 - input_set_keysym_hook(NULL,NULL);7.69 - }7.70 - }7.71 -}7.72 -- (void)resignFirstResponder7.73 -{7.74 - if( isPrimed ) {7.75 - [self setString: lastValue];7.76 - [self setPrimed: NO];7.77 - }7.78 - [super resignFirstResponder];7.79 -}7.80 -- (void)fireBindingChanged7.81 -{7.82 - id delegate = [self delegate];7.83 - if( delegate != nil && [delegate respondsToSelector:@selector(textDidChange:)] ) {7.84 - [delegate textDidChange: [NSNotification notificationWithName: NSTextDidChangeNotification object: self]];7.85 - }7.86 -}7.87 -7.88 -- (void)updateKeysym: (const gchar *)sym7.89 -{7.90 - if( sym != NULL ) {7.91 - [self setString: [NSString stringWithCString: sym]];7.92 - [self setPrimed: NO];7.93 - [self fireBindingChanged];7.94 - }7.95 -}7.96 -- (void)updateMousesym: (int)button7.97 -{7.98 - gchar *keysym = input_keycode_to_keysym( &system_mouse_driver, (button+1) );7.99 - if( keysym != NULL ) {7.100 - [self updateKeysym: keysym ];7.101 - g_free(keysym);7.102 - }7.103 -}7.104 -- (void)keyPressed: (int)keycode7.105 -{7.106 - gchar *keysym = input_keycode_to_keysym(NULL, keycode);7.107 - if( keysym != NULL ) {7.108 - [self updateKeysym: keysym];7.109 - g_free(keysym);7.110 - }7.111 -}7.112 -- (void)insertText:(id)string7.113 -{7.114 - // Do nothing7.115 -}7.116 -- (void)mouseDown: (NSEvent *)event7.117 -{7.118 - if( isPrimed ) {7.119 - [self updateMousesym: 0];7.120 - } else {7.121 - [self setPrimed: YES];7.122 - [super mouseDown: event];7.123 - }7.124 -}7.125 -- (void)rightMouseDown: (NSEvent *)event7.126 -{7.127 - if( isPrimed ) {7.128 - [self updateMousesym: 1];7.129 - }7.130 -}7.131 -- (void)otherMouseDown: (NSEvent *)event7.132 -{7.133 - if( isPrimed ) {7.134 - [self updateMousesym: [event buttonNumber]];7.135 - }7.136 -}7.137 -- (void)keyDown: (NSEvent *) event7.138 -{7.139 - NSString *chars = [event characters];7.140 - if( isPrimed ) {7.141 - if( chars != NULL && [chars length] == 1 && [chars characterAtIndex: 0] == 27 ) {7.142 - // Escape char = abort change7.143 - [self setString: lastValue];7.144 - [self setPrimed: NO];7.145 - } else {7.146 - [self keyPressed: ([event keyCode]+1)];7.147 - }7.148 - } else {7.149 - if( chars != NULL && [chars length] == 1 ) {7.150 - int ch = [chars characterAtIndex: 0];7.151 - switch( ch ) {7.152 - case 0x7F:7.153 - [self setString: @""];7.154 - [self fireBindingChanged];7.155 - break;7.156 - case '\r':7.157 - [self setPrimed: YES];7.158 - break;7.159 - default:7.160 - [super keyDown: event];7.161 - break;7.162 - }7.163 - } else {7.164 - [super keyDown: event];7.165 - }7.166 - }7.167 -}7.168 -- (void)flagsChanged: (NSEvent *) event7.169 -{7.170 - if( isPrimed ) {7.171 - [self keyPressed: ([event keyCode]+1)];7.172 - }7.173 - [super flagsChanged: event];7.174 -}7.175 -@end7.176 -7.177 -static void cocoa_config_keysym_hook(void *data, const gchar *keysym)7.178 -{7.179 - KeyBindingEditor *editor = (KeyBindingEditor *)data;7.180 - [editor updateKeysym: keysym];7.181 -}7.182 -7.183 -7.184 -@implementation KeyBindingField7.185 -@end7.186 -7.187 -/*************************** Key-binding sub-view ***********************/7.188 -7.189 -#define MAX_KEY_BINDINGS 327.190 -7.191 -@interface ControllerKeyBindingView : NSView7.192 -{7.193 - maple_device_t device;7.194 - KeyBindingField *field[MAX_KEY_BINDINGS][2];7.195 -}7.196 -- (id)initWithFrame: (NSRect)frameRect;7.197 -- (void)setDevice: (maple_device_t)device;7.198 -@end7.199 -7.200 -@implementation ControllerKeyBindingView7.201 -- (id)initWithFrame: (NSRect)frameRect7.202 -{7.203 - if( [super initWithFrame: frameRect] == nil ) {7.204 - return nil;7.205 - } else {7.206 - device = NULL;7.207 - return self;7.208 - }7.209 -}7.210 -- (BOOL)isFlipped7.211 -{7.212 - return YES;7.213 -}7.214 -- (void)removeSubviews7.215 -{7.216 - [[self subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)];7.217 -}7.218 -- (void)controlTextDidChange: (NSNotification *)notify7.219 -{7.220 - int binding = [[notify object] tag];7.221 - NSString *val1 = [field[binding][0] stringValue];7.222 - NSString *val2 = [field[binding][1] stringValue];7.223 - char buf[ [val1 length] + [val2 length] + 2 ];7.224 - const gchar *p = NULL;7.225 -7.226 - if( [val1 length] == 0 ) {7.227 - if( [val2 length] != 0 ) {7.228 - p = [val2 UTF8String];7.229 - }7.230 - } else if( [val2 length] == 0 ) {7.231 - p = [val1 UTF8String];7.232 - } else {7.233 - sprintf( buf, "%s,%s", [val1 UTF8String], [val2 UTF8String] );7.234 - p = buf;7.235 - }7.236 - maple_set_device_config_value( device, binding, p );7.237 - lxdream_save_config();7.238 -}7.239 -- (void)setDevice: (maple_device_t)newDevice7.240 -{7.241 - device = newDevice;7.242 - [self removeSubviews];7.243 - if( device != NULL ) {7.244 - lxdream_config_entry_t config = maple_get_device_config(device);7.245 - if( config != NULL ) {7.246 - int count, i, y, x;7.247 -7.248 - for( count=0; config[count].key != NULL; count++ );7.249 - x = TEXT_GAP;7.250 - NSSize size = NSMakeSize(85+KEYBINDING_SIZE*2+TEXT_GAP*4, count*(TEXT_HEIGHT+TEXT_GAP)+TEXT_GAP);7.251 - [self setFrameSize: size];7.252 - [self scrollRectToVisible: NSMakeRect(0,0,1,1)];7.253 - y = TEXT_GAP;7.254 - for( i=0; config[i].key != NULL; i++ ) {7.255 - NSRect frame = NSMakeRect(x, y + 2, 85, LABEL_HEIGHT);7.256 - NSTextField *label = cocoa_gui_add_label(self, NS_(config[i].label), frame);7.257 - [label setAlignment: NSRightTextAlignment];7.258 -7.259 - frame = NSMakeRect( x + 85 + TEXT_GAP, y, KEYBINDING_SIZE, TEXT_HEIGHT);7.260 - field[i][0] = [[KeyBindingField alloc] initWithFrame: frame];7.261 - [field[i][0] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];7.262 - [field[i][0] setTag: i];7.263 - [field[i][0] setDelegate: self];7.264 - [self addSubview: field[i][0]];7.265 -7.266 - frame = NSMakeRect( x + 85 + KEYBINDING_SIZE + (TEXT_GAP*2), y, KEYBINDING_SIZE, TEXT_HEIGHT);7.267 - field[i][1] = [[KeyBindingField alloc] initWithFrame: frame];7.268 - [field[i][1] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];7.269 - [field[i][1] setTag: i];7.270 - [field[i][1] setDelegate: self];7.271 - [self addSubview: field[i][1]];7.272 -7.273 - if( config[i].value != NULL ) {7.274 - gchar **parts = g_strsplit(config[i].value,",",3);7.275 - if( parts[0] != NULL ) {7.276 - [field[i][0] setStringValue: [NSString stringWithCString: parts[0]]];7.277 - if( parts[1] != NULL ) {7.278 - [field[i][1] setStringValue: [NSString stringWithCString: parts[1]]];7.279 - }7.280 - }7.281 - g_strfreev(parts);7.282 - }7.283 -7.284 - y += (TEXT_HEIGHT + TEXT_GAP);7.285 - }7.286 - } else {7.287 - [self setFrameSize: NSMakeSize(100,TEXT_HEIGHT+TEXT_GAP) ];7.288 - }7.289 - } else {7.290 - [self setFrameSize: NSMakeSize(100,TEXT_HEIGHT+TEXT_GAP) ];7.291 - }7.292 -}7.293 -@end7.294 -7.295 -/*************************** Top-level controller pane ***********************/7.296 -7.297 -@interface LxdreamPrefsControllerPane: LxdreamPrefsPane7.298 -{7.299 - struct maple_device *save_controller[4];7.300 - NSButton *radio[4];7.301 - ControllerKeyBindingView *key_bindings;7.302 -}7.303 -+ (LxdreamPrefsControllerPane *)new;7.304 -@end7.305 -7.306 -@implementation LxdreamPrefsControllerPane7.307 -+ (LxdreamPrefsControllerPane *)new7.308 -{7.309 - return [[LxdreamPrefsControllerPane alloc] initWithFrame: NSMakeRect(0,0,600,400)];7.310 -}7.311 -- (id)initWithFrame: (NSRect)frameRect7.312 -{7.313 - if( [super initWithFrame: frameRect title: NS_("Controllers")] == nil ) {7.314 - return nil;7.315 - } else {7.316 - const struct maple_device_class **devices = maple_get_device_classes();7.317 - char buf[16];7.318 - int i,j;7.319 - int y = [self contentHeight] - TEXT_HEIGHT - TEXT_GAP;7.320 -7.321 - NSBox *rule = [[NSBox alloc] initWithFrame:7.322 - NSMakeRect(210+(TEXT_GAP*3), 1, 1, [self contentHeight] + TEXT_GAP - 2)];7.323 - [rule setAutoresizingMask: (NSViewMaxXMargin|NSViewHeightSizable)];7.324 - [rule setBoxType: NSBoxSeparator];7.325 - [self addSubview: rule];7.326 -7.327 - NSRect bindingFrame = NSMakeRect(210+(TEXT_GAP*4), 0,7.328 - frameRect.size.width - (210+(TEXT_GAP*4)), [self contentHeight] + TEXT_GAP );7.329 - NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame: bindingFrame];7.330 - key_bindings = [[ControllerKeyBindingView alloc] initWithFrame: bindingFrame ];7.331 - [scrollView setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];7.332 - [scrollView setDocumentView: key_bindings];7.333 - [scrollView setDrawsBackground: NO];7.334 - [scrollView setHasVerticalScroller: YES];7.335 - [scrollView setAutohidesScrollers: YES];7.336 -7.337 - [self addSubview: scrollView];7.338 - [key_bindings setDevice: maple_get_device(0,0)];7.339 -7.340 - for( i=0; i<MAX_DEVICES; i++ ) {7.341 - int x = TEXT_GAP;7.342 - save_controller[i] = NULL;7.343 - maple_device_t device = maple_get_device(i,0);7.344 -7.345 - snprintf( buf, sizeof(buf), _("Slot %d."), i );7.346 - radio[i] = [[NSButton alloc] initWithFrame: NSMakeRect( x, y, 60, TEXT_HEIGHT )];7.347 - [radio[i] setTitle: [NSString stringWithUTF8String: buf]];7.348 - [radio[i] setTag: i];7.349 - [radio[i] setButtonType: NSRadioButton];7.350 - [radio[i] setAlignment: NSRightTextAlignment];7.351 - [radio[i] setTarget: self];7.352 - [radio[i] setAction: @selector(radioChanged:)];7.353 - [radio[i] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];7.354 - [self addSubview: radio[i]];7.355 - x += 60 + TEXT_GAP;7.356 -7.357 - NSPopUpButton *popup = [[NSPopUpButton alloc] initWithFrame: NSMakeRect(x,y,150,TEXT_HEIGHT)7.358 - pullsDown: NO];7.359 - [popup addItemWithTitle: NS_("<empty>")];7.360 - [popup setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];7.361 - [[popup itemAtIndex: 0] setTag: 0];7.362 - for( j=0; devices[j] != NULL; j++ ) {7.363 - [popup addItemWithTitle: [NSString stringWithUTF8String: devices[j]->name]];7.364 - if( device != NULL && device->device_class == devices[j] ) {7.365 - [popup selectItemAtIndex: (j+1)];7.366 - }7.367 - [[popup itemAtIndex: (j+1)] setTag: (j+1)];7.368 - }7.369 - [popup setTarget: self];7.370 - [popup setAction: @selector(deviceChanged:)];7.371 - [popup setTag: i];7.372 - [self addSubview: popup];7.373 - y -= (TEXT_HEIGHT+TEXT_GAP);7.374 - }7.375 -7.376 - [radio[0] setState: NSOnState];7.377 - return self;7.378 - }7.379 -}7.380 -- (void)radioChanged: (id)sender7.381 -{7.382 - int slot = [sender tag];7.383 - int i;7.384 - for( i=0; i<MAX_DEVICES; i++ ) {7.385 - if( i != slot ) {7.386 - [radio[i] setState: NSOffState];7.387 - }7.388 - }7.389 - [key_bindings setDevice: maple_get_device(slot,0)];7.390 -}7.391 -- (void)deviceChanged: (id)sender7.392 -{7.393 - int slot = [sender tag];7.394 - int new_device_idx = [sender indexOfSelectedItem] - 1, i;7.395 - maple_device_class_t new_device_class = NULL;7.396 -7.397 - for( i=0; i<MAX_DEVICES; i++ ) {7.398 - if( i == slot ) {7.399 - [radio[i] setState: NSOnState];7.400 - } else {7.401 - [radio[i] setState: NSOffState];7.402 - }7.403 - }7.404 -7.405 - maple_device_t current = maple_get_device(slot,0);7.406 - maple_device_t new_device = NULL;7.407 - if( new_device_idx != -1 ) {7.408 - new_device_class = maple_get_device_classes()[new_device_idx];7.409 - }7.410 - if( current == NULL ? new_device_class == NULL : current->device_class == new_device_class ) {7.411 - // No change7.412 - [key_bindings setDevice: current];7.413 - return;7.414 - }7.415 - if( current != NULL && current->device_class == &controller_class ) {7.416 - save_controller[slot] = current->clone(current);7.417 - }7.418 - if( new_device_class == NULL ) {7.419 - maple_detach_device(slot,0);7.420 - } else {7.421 - if( new_device_class == &controller_class && save_controller[slot] != NULL ) {7.422 - new_device = save_controller[slot];7.423 - save_controller[slot] = NULL;7.424 - } else {7.425 - new_device = maple_new_device( new_device_class->name );7.426 - }7.427 - maple_attach_device(new_device,slot,0);7.428 - }7.429 - [key_bindings setDevice: maple_get_device(slot,0)];7.430 - lxdream_save_config();7.431 -}7.432 -@end7.433 -7.434 -NSView *cocoa_gui_create_prefs_controller_pane()7.435 -{7.436 - return [LxdreamPrefsControllerPane new];7.437 -}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00008.2 +++ b/src/cocoaui/cocoa_ctrl.m Thu Jan 15 04:15:11 2009 +00008.3 @@ -0,0 +1,434 @@8.4 +/**8.5 + * $Id$8.6 + *8.7 + * Construct and manage the controller configuration pane8.8 + *8.9 + * Copyright (c) 2008 Nathan Keynes.8.10 + *8.11 + * This program is free software; you can redistribute it and/or modify8.12 + * it under the terms of the GNU General Public License as published by8.13 + * the Free Software Foundation; either version 2 of the License, or8.14 + * (at your option) any later version.8.15 + *8.16 + * This program is distributed in the hope that it will be useful,8.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of8.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8.19 + * GNU General Public License for more details.8.20 + */8.21 +8.22 +#include "cocoaui.h"8.23 +#include "config.h"8.24 +#include "display.h"8.25 +#include "maple/maple.h"8.26 +8.27 +#include <glib/gstrfuncs.h>8.28 +8.29 +#define MAX_DEVICES 48.30 +8.31 +#define KEYBINDING_SIZE 1108.32 +8.33 +static void cocoa_config_keysym_hook(void *data, const gchar *keysym);8.34 +8.35 +@interface KeyBindingEditor (Private)8.36 +- (void)updateKeysym: (const gchar *)sym;8.37 +@end8.38 +8.39 +@implementation KeyBindingEditor8.40 +- (id)init8.41 +{8.42 + self = [super init];8.43 + isPrimed = NO;8.44 + lastValue = nil;8.45 + [self setFieldEditor: YES];8.46 + [self setEditable: FALSE];8.47 + return self;8.48 +}8.49 +- (void)dealloc8.50 +{8.51 + if( lastValue != nil ) {8.52 + [lastValue release];8.53 + lastValue = nil;8.54 + }8.55 + [super dealloc];8.56 +}8.57 +- (void)setPrimed: (BOOL)primed8.58 +{8.59 + if( primed != isPrimed ) {8.60 + isPrimed = primed;8.61 + if( primed ) {8.62 + lastValue = [[NSString stringWithString: [self string]] retain];8.63 + [self setString: @"<press key>"];8.64 + input_set_keysym_hook(cocoa_config_keysym_hook, self);8.65 + } else {8.66 + [lastValue release];8.67 + lastValue = nil;8.68 + input_set_keysym_hook(NULL,NULL);8.69 + }8.70 + }8.71 +}8.72 +- (void)resignFirstResponder8.73 +{8.74 + if( isPrimed ) {8.75 + [self setString: lastValue];8.76 + [self setPrimed: NO];8.77 + }8.78 + [super resignFirstResponder];8.79 +}8.80 +- (void)fireBindingChanged8.81 +{8.82 + id delegate = [self delegate];8.83 + if( delegate != nil && [delegate respondsToSelector:@selector(textDidChange:)] ) {8.84 + [delegate textDidChange: [NSNotification notificationWithName: NSTextDidChangeNotification object: self]];8.85 + }8.86 +}8.87 +8.88 +- (void)updateKeysym: (const gchar *)sym8.89 +{8.90 + if( sym != NULL ) {8.91 + [self setString: [NSString stringWithCString: sym]];8.92 + [self setPrimed: NO];8.93 + [self fireBindingChanged];8.94 + }8.95 +}8.96 +- (void)updateMousesym: (int)button8.97 +{8.98 + gchar *keysym = input_keycode_to_keysym( &system_mouse_driver, (button+1) );8.99 + if( keysym != NULL ) {8.100 + [self updateKeysym: keysym ];8.101 + g_free(keysym);8.102 + }8.103 +}8.104 +- (void)keyPressed: (int)keycode8.105 +{8.106 + gchar *keysym = input_keycode_to_keysym(NULL, keycode);8.107 + if( keysym != NULL ) {8.108 + [self updateKeysym: keysym];8.109 + g_free(keysym);8.110 + }8.111 +}8.112 +- (void)insertText:(id)string8.113 +{8.114 + // Do nothing8.115 +}8.116 +- (void)mouseDown: (NSEvent *)event8.117 +{8.118 + if( isPrimed ) {8.119 + [self updateMousesym: 0];8.120 + } else {8.121 + [self setPrimed: YES];8.122 + [super mouseDown: event];8.123 + }8.124 +}8.125 +- (void)rightMouseDown: (NSEvent *)event8.126 +{8.127 + if( isPrimed ) {8.128 + [self updateMousesym: 1];8.129 + }8.130 +}8.131 +- (void)otherMouseDown: (NSEvent *)event8.132 +{8.133 + if( isPrimed ) {8.134 + [self updateMousesym: [event buttonNumber]];8.135 + }8.136 +}8.137 +- (void)keyDown: (NSEvent *) event8.138 +{8.139 + NSString *chars = [event characters];8.140 + if( isPrimed ) {8.141 + if( chars != NULL && [chars length] == 1 && [chars characterAtIndex: 0] == 27 ) {8.142 + // Escape char = abort change8.143 + [self setString: lastValue];8.144 + [self setPrimed: NO];8.145 + } else {8.146 + [self keyPressed: ([event keyCode]+1)];8.147 + }8.148 + } else {8.149 + if( chars != NULL && [chars length] == 1 ) {8.150 + int ch = [chars characterAtIndex: 0];8.151 + switch( ch ) {8.152 + case 0x7F:8.153 + [self setString: @""];8.154 + [self fireBindingChanged];8.155 + break;8.156 + case '\r':8.157 + [self setPrimed: YES];8.158 + break;8.159 + default:8.160 + [super keyDown: event];8.161 + break;8.162 + }8.163 + } else {8.164 + [super keyDown: event];8.165 + }8.166 + }8.167 +}8.168 +- (void)flagsChanged: (NSEvent *) event8.169 +{8.170 + if( isPrimed ) {8.171 + [self keyPressed: ([event keyCode]+1)];8.172 + }8.173 + [super flagsChanged: event];8.174 +}8.175 +@end8.176 +8.177 +static void cocoa_config_keysym_hook(void *data, const gchar *keysym)8.178 +{8.179 + KeyBindingEditor *editor = (KeyBindingEditor *)data;8.180 + [editor updateKeysym: keysym];8.181 +}8.182 +8.183 +8.184 +@implementation KeyBindingField8.185 +@end8.186 +8.187 +/*************************** Key-binding sub-view ***********************/8.188 +8.189 +#define MAX_KEY_BINDINGS 328.190 +8.191 +@interface ControllerKeyBindingView : NSView8.192 +{8.193 + maple_device_t device;8.194 + KeyBindingField *field[MAX_KEY_BINDINGS][2];8.195 +}8.196 +- (id)initWithFrame: (NSRect)frameRect;8.197 +- (void)setDevice: (maple_device_t)device;8.198 +@end8.199 +8.200 +@implementation ControllerKeyBindingView8.201 +- (id)initWithFrame: (NSRect)frameRect8.202 +{8.203 + if( [super initWithFrame: frameRect] == nil ) {8.204 + return nil;8.205 + } else {8.206 + device = NULL;8.207 + return self;8.208 + }8.209 +}8.210 +- (BOOL)isFlipped8.211 +{8.212 + return YES;8.213 +}8.214 +- (void)removeSubviews8.215 +{8.216 + [[self subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)];8.217 +}8.218 +- (void)controlTextDidChange: (NSNotification *)notify8.219 +{8.220 + int binding = [[notify object] tag];8.221 + NSString *val1 = [field[binding][0] stringValue];8.222 + NSString *val2 = [field[binding][1] stringValue];8.223 + char buf[ [val1 length] + [val2 length] + 2 ];8.224 + const gchar *p = NULL;8.225 +8.226 + if( [val1 length] == 0 ) {8.227 + if( [val2 length] != 0 ) {8.228 + p = [val2 UTF8String];8.229 + }8.230 + } else if( [val2 length] == 0 ) {8.231 + p = [val1 UTF8String];8.232 + } else {8.233 + sprintf( buf, "%s,%s", [val1 UTF8String], [val2 UTF8String] );8.234 + p = buf;8.235 + }8.236 + maple_set_device_config_value( device, binding, p );8.237 + lxdream_save_config();8.238 +}8.239 +- (void)setDevice: (maple_device_t)newDevice8.240 +{8.241 + device = newDevice;8.242 + [self removeSubviews];8.243 + if( device != NULL ) {8.244 + lxdream_config_entry_t config = maple_get_device_config(device);8.245 + if( config != NULL ) {8.246 + int count, i, y, x;8.247 +8.248 + for( count=0; config[count].key != NULL; count++ );8.249 + x = TEXT_GAP;8.250 + NSSize size = NSMakeSize(85+KEYBINDING_SIZE*2+TEXT_GAP*4, count*(TEXT_HEIGHT+TEXT_GAP)+TEXT_GAP);8.251 + [self setFrameSize: size];8.252 + [self scrollRectToVisible: NSMakeRect(0,0,1,1)];8.253 + y = TEXT_GAP;8.254 + for( i=0; config[i].key != NULL; i++ ) {8.255 + NSRect frame = NSMakeRect(x, y + 2, 85, LABEL_HEIGHT);8.256 + NSTextField *label = cocoa_gui_add_label(self, NS_(config[i].label), frame);8.257 + [label setAlignment: NSRightTextAlignment];8.258 +8.259 + frame = NSMakeRect( x + 85 + TEXT_GAP, y, KEYBINDING_SIZE, TEXT_HEIGHT);8.260 + field[i][0] = [[KeyBindingField alloc] initWithFrame: frame];8.261 + [field[i][0] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];8.262 + [field[i][0] setTag: i];8.263 + [field[i][0] setDelegate: self];8.264 + [self addSubview: field[i][0]];8.265 +8.266 + frame = NSMakeRect( x + 85 + KEYBINDING_SIZE + (TEXT_GAP*2), y, KEYBINDING_SIZE, TEXT_HEIGHT);8.267 + field[i][1] = [[KeyBindingField alloc] initWithFrame: frame];8.268 + [field[i][1] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];8.269 + [field[i][1] setTag: i];8.270 + [field[i][1] setDelegate: self];8.271 + [self addSubview: field[i][1]];8.272 +8.273 + if( config[i].value != NULL ) {8.274 + gchar **parts = g_strsplit(config[i].value,",",3);8.275 + if( parts[0] != NULL ) {8.276 + [field[i][0] setStringValue: [NSString stringWithCString: parts[0]]];8.277 + if( parts[1] != NULL ) {8.278 + [field[i][1] setStringValue: [NSString stringWithCString: parts[1]]];8.279 + }8.280 + }8.281 + g_strfreev(parts);8.282 + }8.283 +8.284 + y += (TEXT_HEIGHT + TEXT_GAP);8.285 + }8.286 + } else {8.287 + [self setFrameSize: NSMakeSize(100,TEXT_HEIGHT+TEXT_GAP) ];8.288 + }8.289 + } else {8.290 + [self setFrameSize: NSMakeSize(100,TEXT_HEIGHT+TEXT_GAP) ];8.291 + }8.292 +}8.293 +@end8.294 +8.295 +/*************************** Top-level controller pane ***********************/8.296 +8.297 +@interface LxdreamPrefsControllerPane: LxdreamPrefsPane8.298 +{8.299 + struct maple_device *save_controller[4];8.300 + NSButton *radio[4];8.301 + ControllerKeyBindingView *key_bindings;8.302 +}8.303 ++ (LxdreamPrefsControllerPane *)new;8.304 +@end8.305 +8.306 +@implementation LxdreamPrefsControllerPane8.307 ++ (LxdreamPrefsControllerPane *)new8.308 +{8.309 + return [[LxdreamPrefsControllerPane alloc] initWithFrame: NSMakeRect(0,0,600,400)];8.310 +}8.311 +- (id)initWithFrame: (NSRect)frameRect8.312 +{8.313 + if( [super initWithFrame: frameRect title: NS_("Controllers")] == nil ) {8.314 + return nil;8.315 + } else {8.316 + const struct maple_device_class **devices = maple_get_device_classes();8.317 + char buf[16];8.318 + int i,j;8.319 + int y = [self contentHeight] - TEXT_HEIGHT - TEXT_GAP;8.320 +8.321 + NSBox *rule = [[NSBox alloc] initWithFrame:8.322 + NSMakeRect(210+(TEXT_GAP*3), 1, 1, [self contentHeight] + TEXT_GAP - 2)];8.323 + [rule setAutoresizingMask: (NSViewMaxXMargin|NSViewHeightSizable)];8.324 + [rule setBoxType: NSBoxSeparator];8.325 + [self addSubview: rule];8.326 +8.327 + NSRect bindingFrame = NSMakeRect(210+(TEXT_GAP*4), 0,8.328 + frameRect.size.width - (210+(TEXT_GAP*4)), [self contentHeight] + TEXT_GAP );8.329 + NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame: bindingFrame];8.330 + key_bindings = [[ControllerKeyBindingView alloc] initWithFrame: bindingFrame ];8.331 + [scrollView setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];8.332 + [scrollView setDocumentView: key_bindings];8.333 + [scrollView setDrawsBackground: NO];8.334 + [scrollView setHasVerticalScroller: YES];8.335 + [scrollView setAutohidesScrollers: YES];8.336 +8.337 + [self addSubview: scrollView];8.338 + [key_bindings setDevice: maple_get_device(0,0)];8.339 +8.340 + for( i=0; i<MAX_DEVICES; i++ ) {8.341 + int x = TEXT_GAP;8.342 + save_controller[i] = NULL;8.343 + maple_device_t device = maple_get_device(i,0);8.344 +8.345 + snprintf( buf, sizeof(buf), _("Slot %d."), i );8.346 + radio[i] = [[NSButton alloc] initWithFrame: NSMakeRect( x, y, 60, TEXT_HEIGHT )];8.347 + [radio[i] setTitle: [NSString stringWithUTF8String: buf]];8.348 + [radio[i] setTag: i];8.349 + [radio[i] setButtonType: NSRadioButton];8.350 + [radio[i] setAlignment: NSRightTextAlignment];8.351 + [radio[i] setTarget: self];8.352 + [radio[i] setAction: @selector(radioChanged:)];8.353 + [radio[i] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];8.354 + [self addSubview: radio[i]];8.355 + x += 60 + TEXT_GAP;8.356 +8.357 + NSPopUpButton *popup = [[NSPopUpButton alloc] initWithFrame: NSMakeRect(x,y,150,TEXT_HEIGHT)8.358 + pullsDown: NO];8.359 + [popup addItemWithTitle: NS_("<empty>")];8.360 + [popup setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];8.361 + [[popup itemAtIndex: 0] setTag: 0];8.362 + for( j=0; devices[j] != NULL; j++ ) {8.363 + [popup addItemWithTitle: [NSString stringWithUTF8String: devices[j]->name]];8.364 + if( device != NULL && device->device_class == devices[j] ) {8.365 + [popup selectItemAtIndex: (j+1)];8.366 + }8.367 + [[popup itemAtIndex: (j+1)] setTag: (j+1)];8.368 + }8.369 + [popup setTarget: self];8.370 + [popup setAction: @selector(deviceChanged:)];8.371 + [popup setTag: i];8.372 + [self addSubview: popup];8.373 + y -= (TEXT_HEIGHT+TEXT_GAP);8.374 + }8.375 +8.376 + [radio[0] setState: NSOnState];8.377 + return self;8.378 + }8.379 +}8.380 +- (void)radioChanged: (id)sender8.381 +{8.382 + int slot = [sender tag];8.383 + int i;8.384 + for( i=0; i<MAX_DEVICES; i++ ) {8.385 + if( i != slot ) {8.386 + [radio[i] setState: NSOffState];8.387 + }8.388 + }8.389 + [key_bindings setDevice: maple_get_device(slot,0)];8.390 +}8.391 +- (void)deviceChanged: (id)sender8.392 +{8.393 + int slot = [sender tag];8.394 + int new_device_idx = [sender indexOfSelectedItem] - 1, i;8.395 + maple_device_class_t new_device_class = NULL;8.396 +8.397 + for( i=0; i<MAX_DEVICES; i++ ) {8.398 + if( i == slot ) {8.399 + [radio[i] setState: NSOnState];8.400 + } else {8.401 + [radio[i] setState: NSOffState];8.402 + }8.403 + }8.404 +8.405 + maple_device_t current = maple_get_device(slot,0);8.406 + maple_device_t new_device = NULL;8.407 + if( new_device_idx != -1 ) {8.408 + new_device_class = maple_get_device_classes()[new_device_idx];8.409 + }8.410 + if( current == NULL ? new_device_class == NULL : current->device_class == new_device_class ) {8.411 + // No change8.412 + [key_bindings setDevice: current];8.413 + return;8.414 + }8.415 + if( current != NULL && current->device_class == &controller_class ) {8.416 + save_controller[slot] = current->clone(current);8.417 + }8.418 + if( new_device_class == NULL ) {8.419 + maple_detach_device(slot,0);8.420 + } else {8.421 + if( new_device_class == &controller_class && save_controller[slot] != NULL ) {8.422 + new_device = save_controller[slot];8.423 + save_controller[slot] = NULL;8.424 + } else {8.425 + new_device = maple_new_device( new_device_class->name );8.426 + }8.427 + maple_attach_device(new_device,slot,0);8.428 + }8.429 + [key_bindings setDevice: maple_get_device(slot,0)];8.430 + lxdream_save_config();8.431 +}8.432 +@end8.433 +8.434 +NSView *cocoa_gui_create_prefs_controller_pane()8.435 +{8.436 + return [LxdreamPrefsControllerPane new];8.437 +}
9.1 --- a/src/cocoaui/cocoa_gd.c Thu Jan 15 03:54:21 2009 +00009.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00009.3 @@ -1,88 +0,0 @@9.4 -/**9.5 - * $Id$9.6 - *9.7 - * Management of the GDRom menu under cocoa9.8 - *9.9 - * Copyright (c) 2005 Nathan Keynes.9.10 - *9.11 - * This program is free software; you can redistribute it and/or modify9.12 - * it under the terms of the GNU General Public License as published by9.13 - * the Free Software Foundation; either version 2 of the License, or9.14 - * (at your option) any later version.9.15 - *9.16 - * This program is distributed in the hope that it will be useful,9.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of9.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9.19 - * GNU General Public License for more details.9.20 - */9.21 -9.22 -9.23 -#include <AppKit/AppKit.h>9.24 -#include <stdio.h>9.25 -#include <stdlib.h>9.26 -#include <string.h>9.27 -#include <sys/time.h>9.28 -#include "lxdream.h"9.29 -#include "dreamcast.h"9.30 -#include "dream.h"9.31 -#include "gdlist.h"9.32 -#include "cocoaui/cocoaui.h"9.33 -9.34 -void cocoa_gdrom_menu_build( NSMenu *menu )9.35 -{9.36 - int i,len = gdrom_list_size();9.37 - for( i=0; i<len; i++ ) {9.38 - const gchar *entry = gdrom_list_get_display_name(i);9.39 - if( entry[0] == '\0' ) {9.40 - [menu addItem: [NSMenuItem separatorItem]];9.41 - } else {9.42 - [[menu addItemWithTitle: [NSString stringWithCString: entry]9.43 - action: @selector(gdrom_list_action:) keyEquivalent: @""]9.44 - setTag: i];9.45 - }9.46 - }9.47 - [menu addItem: [NSMenuItem separatorItem]];9.48 - [menu addItemWithTitle: NS_("Open image file...") action: @selector(mount_action:)9.49 - keyEquivalent: @"i"];9.50 -}9.51 -9.52 -void cocoa_gdrom_menu_rebuild( NSMenu *menu )9.53 -{9.54 - while( [menu numberOfItems] > 0 ) {9.55 - [ menu removeItemAtIndex: 0 ];9.56 - }9.57 -9.58 - cocoa_gdrom_menu_build( menu );9.59 -}9.60 -9.61 -gboolean cocoa_gdrom_menu_update( gboolean list_changed, int selection, void *user_data )9.62 -{9.63 - // Create an auto-release pool - we may be called outside of the GUI main loop9.64 - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];9.65 - NSMenu *menu = (NSMenu *)user_data;9.66 - int i;9.67 -9.68 - if( list_changed ) {9.69 - cocoa_gdrom_menu_rebuild(menu);9.70 - }9.71 -9.72 - for( i=0; i< [menu numberOfItems]; i++ ) {9.73 - if( i == selection ) {9.74 - [[menu itemAtIndex: i] setState: NSOnState];9.75 - } else {9.76 - [[menu itemAtIndex: i] setState: NSOffState];9.77 - }9.78 - }9.79 - [pool release];9.80 - return TRUE;9.81 -}9.82 -9.83 -NSMenu *cocoa_gdrom_menu_new()9.84 -{9.85 - NSMenu *menu = [[NSMenu alloc] initWithTitle: @"GD-Rom Settings"];9.86 - cocoa_gdrom_menu_build(menu);9.87 -9.88 - register_gdrom_list_change_hook(cocoa_gdrom_menu_update, menu);9.89 - cocoa_gdrom_menu_update( FALSE, gdrom_list_get_selection(), menu );9.90 - return menu;9.91 -}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000010.2 +++ b/src/cocoaui/cocoa_gd.m Thu Jan 15 04:15:11 2009 +000010.3 @@ -0,0 +1,88 @@10.4 +/**10.5 + * $Id$10.6 + *10.7 + * Management of the GDRom menu under cocoa10.8 + *10.9 + * Copyright (c) 2005 Nathan Keynes.10.10 + *10.11 + * This program is free software; you can redistribute it and/or modify10.12 + * it under the terms of the GNU General Public License as published by10.13 + * the Free Software Foundation; either version 2 of the License, or10.14 + * (at your option) any later version.10.15 + *10.16 + * This program is distributed in the hope that it will be useful,10.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of10.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10.19 + * GNU General Public License for more details.10.20 + */10.21 +10.22 +10.23 +#include <AppKit/AppKit.h>10.24 +#include <stdio.h>10.25 +#include <stdlib.h>10.26 +#include <string.h>10.27 +#include <sys/time.h>10.28 +#include "lxdream.h"10.29 +#include "dreamcast.h"10.30 +#include "dream.h"10.31 +#include "gdlist.h"10.32 +#include "cocoaui/cocoaui.h"10.33 +10.34 +void cocoa_gdrom_menu_build( NSMenu *menu )10.35 +{10.36 + int i,len = gdrom_list_size();10.37 + for( i=0; i<len; i++ ) {10.38 + const gchar *entry = gdrom_list_get_display_name(i);10.39 + if( entry[0] == '\0' ) {10.40 + [menu addItem: [NSMenuItem separatorItem]];10.41 + } else {10.42 + [[menu addItemWithTitle: [NSString stringWithCString: entry]10.43 + action: @selector(gdrom_list_action:) keyEquivalent: @""]10.44 + setTag: i];10.45 + }10.46 + }10.47 + [menu addItem: [NSMenuItem separatorItem]];10.48 + [menu addItemWithTitle: NS_("Open image file...") action: @selector(mount_action:)10.49 + keyEquivalent: @"i"];10.50 +}10.51 +10.52 +void cocoa_gdrom_menu_rebuild( NSMenu *menu )10.53 +{10.54 + while( [menu numberOfItems] > 0 ) {10.55 + [ menu removeItemAtIndex: 0 ];10.56 + }10.57 +10.58 + cocoa_gdrom_menu_build( menu );10.59 +}10.60 +10.61 +gboolean cocoa_gdrom_menu_update( gboolean list_changed, int selection, void *user_data )10.62 +{10.63 + // Create an auto-release pool - we may be called outside of the GUI main loop10.64 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];10.65 + NSMenu *menu = (NSMenu *)user_data;10.66 + int i;10.67 +10.68 + if( list_changed ) {10.69 + cocoa_gdrom_menu_rebuild(menu);10.70 + }10.71 +10.72 + for( i=0; i< [menu numberOfItems]; i++ ) {10.73 + if( i == selection ) {10.74 + [[menu itemAtIndex: i] setState: NSOnState];10.75 + } else {10.76 + [[menu itemAtIndex: i] setState: NSOffState];10.77 + }10.78 + }10.79 + [pool release];10.80 + return TRUE;10.81 +}10.82 +10.83 +NSMenu *cocoa_gdrom_menu_new()10.84 +{10.85 + NSMenu *menu = [[NSMenu alloc] initWithTitle: @"GD-Rom Settings"];10.86 + cocoa_gdrom_menu_build(menu);10.87 +10.88 + register_gdrom_list_change_hook(cocoa_gdrom_menu_update, menu);10.89 + cocoa_gdrom_menu_update( FALSE, gdrom_list_get_selection(), menu );10.90 + return menu;10.91 +}
11.1 --- a/src/cocoaui/cocoa_path.c Thu Jan 15 03:54:21 2009 +000011.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000011.3 @@ -1,84 +0,0 @@11.4 -/**11.5 - * $Id$11.6 - *11.7 - * Construct and manage the paths configuration pane11.8 - *11.9 - * Copyright (c) 2008 Nathan Keynes.11.10 - *11.11 - * This program is free software; you can redistribute it and/or modify11.12 - * it under the terms of the GNU General Public License as published by11.13 - * the Free Software Foundation; either version 2 of the License, or11.14 - * (at your option) any later version.11.15 - *11.16 - * This program is distributed in the hope that it will be useful,11.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of11.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11.19 - * GNU General Public License for more details.11.20 - */11.21 -11.22 -#include "cocoaui.h"11.23 -#include "config.h"11.24 -#include "dreamcast.h"11.25 -11.26 -@interface LxdreamPrefsPathPane: LxdreamPrefsPane11.27 -{11.28 -}11.29 -+ (LxdreamPrefsPathPane *)new;11.30 -@end11.31 -11.32 -@implementation LxdreamPrefsPathPane11.33 -+ (LxdreamPrefsPathPane *)new11.34 -{11.35 - return [[LxdreamPrefsPathPane alloc] initWithFrame: NSMakeRect(0,0,600,400)];11.36 -}11.37 -- (id)initWithFrame: (NSRect)frameRect11.38 -{11.39 - if( [super initWithFrame: frameRect title: NS_("Paths")] == nil ) {11.40 - return nil;11.41 - } else {11.42 - int i;11.43 - int height = [self contentHeight] - TEXT_HEIGHT - TEXT_GAP;11.44 -11.45 - for( i=0; i<=CONFIG_KEY_MAX; i++ ) {11.46 - const struct lxdream_config_entry *entry = lxdream_get_config_entry(i);11.47 - if( entry->label != NULL ) {11.48 - NSRect frame = NSMakeRect( TEXT_GAP, height -((TEXT_HEIGHT+TEXT_GAP)*i - 2),11.49 - 150, LABEL_HEIGHT );11.50 - NSTextField *label = cocoa_gui_add_label(self, NS_(entry->label), frame);11.51 - [label setAlignment: NSRightTextAlignment];11.52 -11.53 - frame = NSMakeRect( 150 + (TEXT_GAP*2),11.54 - height -((TEXT_HEIGHT+TEXT_GAP)*i),11.55 - 360, TEXT_HEIGHT );11.56 - NSTextField *field = [[NSTextField alloc] initWithFrame: frame];11.57 - [field setTag: i];11.58 - [field setStringValue: [NSString stringWithCString: entry->value]];11.59 - [field setDelegate: self];11.60 - [field setAutoresizingMask: (NSViewMinYMargin|NSViewWidthSizable)];11.61 - [self addSubview: label];11.62 - [self addSubview: field];11.63 - }11.64 - }11.65 - }11.66 - return self;11.67 -}11.68 -- (void)controlTextDidEndEditing:(NSNotification *)notify11.69 -{11.70 - int tag = [[notify object] tag];11.71 - const char *str = [[[notify object] stringValue] UTF8String];11.72 - const char *oldval = lxdream_get_config_value(tag);11.73 - if( str[0] == '\0' )11.74 - str = NULL;11.75 - if( oldval == NULL ? str != NULL : (str == NULL || strcmp(oldval,str) != 0 ) ) {11.76 - lxdream_set_global_config_value(tag, str);11.77 - lxdream_save_config();11.78 - dreamcast_config_changed();11.79 - }11.80 -}11.81 -@end11.82 -11.83 -11.84 -NSView *cocoa_gui_create_prefs_path_pane()11.85 -{11.86 - return [LxdreamPrefsPathPane new];11.87 -}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000012.2 +++ b/src/cocoaui/cocoa_path.m Thu Jan 15 04:15:11 2009 +000012.3 @@ -0,0 +1,84 @@12.4 +/**12.5 + * $Id$12.6 + *12.7 + * Construct and manage the paths configuration pane12.8 + *12.9 + * Copyright (c) 2008 Nathan Keynes.12.10 + *12.11 + * This program is free software; you can redistribute it and/or modify12.12 + * it under the terms of the GNU General Public License as published by12.13 + * the Free Software Foundation; either version 2 of the License, or12.14 + * (at your option) any later version.12.15 + *12.16 + * This program is distributed in the hope that it will be useful,12.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of12.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12.19 + * GNU General Public License for more details.12.20 + */12.21 +12.22 +#include "cocoaui.h"12.23 +#include "config.h"12.24 +#include "dreamcast.h"12.25 +12.26 +@interface LxdreamPrefsPathPane: LxdreamPrefsPane12.27 +{12.28 +}12.29 ++ (LxdreamPrefsPathPane *)new;12.30 +@end12.31 +12.32 +@implementation LxdreamPrefsPathPane12.33 ++ (LxdreamPrefsPathPane *)new12.34 +{12.35 + return [[LxdreamPrefsPathPane alloc] initWithFrame: NSMakeRect(0,0,600,400)];12.36 +}12.37 +- (id)initWithFrame: (NSRect)frameRect12.38 +{12.39 + if( [super initWithFrame: frameRect title: NS_("Paths")] == nil ) {12.40 + return nil;12.41 + } else {12.42 + int i;12.43 + int height = [self contentHeight] - TEXT_HEIGHT - TEXT_GAP;12.44 +12.45 + for( i=0; i<=CONFIG_KEY_MAX; i++ ) {12.46 + const struct lxdream_config_entry *entry = lxdream_get_config_entry(i);12.47 + if( entry->label != NULL ) {12.48 + NSRect frame = NSMakeRect( TEXT_GAP, height -((TEXT_HEIGHT+TEXT_GAP)*i - 2),12.49 + 150, LABEL_HEIGHT );12.50 + NSTextField *label = cocoa_gui_add_label(self, NS_(entry->label), frame);12.51 + [label setAlignment: NSRightTextAlignment];12.52 +12.53 + frame = NSMakeRect( 150 + (TEXT_GAP*2),12.54 + height -((TEXT_HEIGHT+TEXT_GAP)*i),12.55 + 360, TEXT_HEIGHT );12.56 + NSTextField *field = [[NSTextField alloc] initWithFrame: frame];12.57 + [field setTag: i];12.58 + [field setStringValue: [NSString stringWithCString: entry->value]];12.59 + [field setDelegate: self];12.60 + [field setAutoresizingMask: (NSViewMinYMargin|NSViewWidthSizable)];12.61 + [self addSubview: label];12.62 + [self addSubview: field];12.63 + }12.64 + }12.65 + }12.66 + return self;12.67 +}12.68 +- (void)controlTextDidEndEditing:(NSNotification *)notify12.69 +{12.70 + int tag = [[notify object] tag];12.71 + const char *str = [[[notify object] stringValue] UTF8String];12.72 + const char *oldval = lxdream_get_config_value(tag);12.73 + if( str[0] == '\0' )12.74 + str = NULL;12.75 + if( oldval == NULL ? str != NULL : (str == NULL || strcmp(oldval,str) != 0 ) ) {12.76 + lxdream_set_global_config_value(tag, str);12.77 + lxdream_save_config();12.78 + dreamcast_config_changed();12.79 + }12.80 +}12.81 +@end12.82 +12.83 +12.84 +NSView *cocoa_gui_create_prefs_path_pane()12.85 +{12.86 + return [LxdreamPrefsPathPane new];12.87 +}
13.1 --- a/src/cocoaui/cocoa_prefs.c Thu Jan 15 03:54:21 2009 +000013.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000013.3 @@ -1,190 +0,0 @@13.4 -/**13.5 - * $Id$13.6 - *13.7 - * Construct and manage the preferences panel under cocoa.13.8 - *13.9 - * Copyright (c) 2008 Nathan Keynes.13.10 - *13.11 - * This program is free software; you can redistribute it and/or modify13.12 - * it under the terms of the GNU General Public License as published by13.13 - * the Free Software Foundation; either version 2 of the License, or13.14 - * (at your option) any later version.13.15 - *13.16 - * This program is distributed in the hope that it will be useful,13.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of13.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13.19 - * GNU General Public License for more details.13.20 - */13.21 -13.22 -#include "cocoaui/cocoaui.h"13.23 -#include "lxdream.h"13.24 -#include "config.h"13.25 -13.26 -static LxdreamPrefsPanel *prefs_panel = NULL;13.27 -13.28 -@implementation LxdreamPrefsPane13.29 -- (int)contentHeight13.30 -{13.31 - return [self frame].size.height - headerHeight;13.32 -}13.33 -13.34 -- (id)initWithFrame: (NSRect)frameRect title:(NSString *)title13.35 -{13.36 - if( [super initWithFrame: frameRect ] == nil ) {13.37 - return nil;13.38 - } else {13.39 - int height = frameRect.size.height - TEXT_GAP;13.40 -13.41 - NSFont *titleFont = [NSFont fontWithName: @"Helvetica-Bold" size: 16.0];13.42 - NSRect fontRect = [titleFont boundingRectForFont];13.43 - int titleHeight = fontRect.size.height + [titleFont descender];13.44 - NSTextField *label = cocoa_gui_add_label(self, title,13.45 - NSMakeRect( TEXT_GAP, height-titleHeight,13.46 - frameRect.size.width - (TEXT_GAP*2), titleHeight ));13.47 - [label setFont: titleFont];13.48 - height -= (titleHeight + TEXT_GAP);13.49 -13.50 - NSBox *rule = [[NSBox alloc] initWithFrame: NSMakeRect(1, height, frameRect.size.width-2, 1)];13.51 - [rule setAutoresizingMask: (NSViewMinYMargin|NSViewWidthSizable)];13.52 - [rule setBoxType: NSBoxSeparator];13.53 - [self addSubview: rule];13.54 - height -= TEXT_GAP;13.55 -13.56 - headerHeight = frameRect.size.height - height;13.57 - return self;13.58 - }13.59 -}13.60 -@end13.61 -13.62 -/**************************** Main preferences window ************************/13.63 -13.64 -@interface LxdreamPrefsPanel (Private)13.65 -- (void) initToolbar;13.66 -- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label13.67 -tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action;13.68 -@end13.69 -13.70 -@implementation LxdreamPrefsPanel13.71 -13.72 -- (NSView *)createControlsPane13.73 -{13.74 - NSView *pane = [[NSView alloc] initWithFrame: NSMakeRect(0,0,640,400)];13.75 - return pane;13.76 -}13.77 -13.78 -- (id)initWithContentRect:(NSRect)contentRect13.79 -{13.80 - if( [super initWithContentRect: contentRect13.81 - styleMask: ( NSTitledWindowMask | NSClosableWindowMask |13.82 - NSMiniaturizableWindowMask | NSResizableWindowMask |13.83 - NSUnifiedTitleAndToolbarWindowMask )13.84 - backing: NSBackingStoreBuffered defer: NO ] == nil ) {13.85 - return nil;13.86 - } else {13.87 - [self setTitle: NS_("Preferences")];13.88 - [self setDelegate: self];13.89 - [self setMinSize: NSMakeSize(400,300)];13.90 - [self initToolbar];13.91 - path_pane = cocoa_gui_create_prefs_path_pane();13.92 - ctrl_pane = cocoa_gui_create_prefs_controller_pane();13.93 - binding_editor = nil;13.94 - [self setContentView: path_pane];13.95 - return self;13.96 - }13.97 -}13.98 -- (void)dealloc13.99 -{13.100 - if( binding_editor != nil ) {13.101 - [binding_editor release];13.102 - binding_editor = nil;13.103 - }13.104 - [super dealloc];13.105 -}13.106 -- (void)windowWillClose: (NSNotification *)notice13.107 -{13.108 - prefs_panel = NULL;13.109 -}13.110 -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)view13.111 -{13.112 - if( [view isKindOfClass: [KeyBindingField class]] ) {13.113 - if( binding_editor == nil ) {13.114 - binding_editor = [[[KeyBindingEditor alloc] init] retain];13.115 - }13.116 - return binding_editor;13.117 - }13.118 - return nil;13.119 -}13.120 -- (void) initToolbar13.121 -{13.122 - NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamPrefsToolbar"];13.123 -13.124 - NSToolbarItem *paths = [self createToolbarItem: @"Paths" label: @"Paths"13.125 - tooltip: @"Configure system paths" icon: @"tb-paths"13.126 - action: @selector(paths_action:)];13.127 - NSToolbarItem *ctrls = [self createToolbarItem: @"Controllers" label: @"Controllers"13.128 - tooltip: @"Configure controllers" icon: @"tb-ctrls"13.129 - action: @selector(controllers_action:)];13.130 - toolbar_ids = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];13.131 - toolbar_defaults = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];13.132 - NSArray *values = [NSArray arrayWithObjects: paths, ctrls, nil ];13.133 - toolbar_items = [NSDictionary dictionaryWithObjects: values forKeys: toolbar_ids];13.134 -13.135 - [toolbar setDelegate: self];13.136 - [toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];13.137 - [toolbar setSizeMode: NSToolbarSizeModeSmall];13.138 - [toolbar setSelectedItemIdentifier: @"Paths"];13.139 - [self setToolbar: toolbar];13.140 -}13.141 -13.142 -- (void)paths_action: (id)sender13.143 -{13.144 - [self setContentView: path_pane];13.145 -}13.146 -- (void)controllers_action: (id)sender13.147 -{13.148 - [self setContentView: ctrl_pane];13.149 -}13.150 -13.151 -/***************************** Toolbar methods ***************************/13.152 -- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label13.153 -tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action13.154 -{13.155 - NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier: id];13.156 - [item setLabel: label];13.157 - [item setToolTip: tooltip];13.158 - [item setTarget: self];13.159 - NSString *iconFile = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];13.160 - NSImage *image = [[NSImage alloc] initWithContentsOfFile: iconFile];13.161 - [item setImage: image];13.162 - [item setAction: action];13.163 - return item;13.164 -}13.165 -- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar13.166 -{13.167 - return toolbar_ids;13.168 -}13.169 -13.170 -- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar13.171 -{13.172 - return toolbar_defaults;13.173 -}13.174 -13.175 -- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar13.176 -{13.177 - return [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];13.178 -}13.179 -13.180 -- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier13.181 -willBeInsertedIntoToolbar:(BOOL)flag13.182 -{13.183 - return [toolbar_items objectForKey: itemIdentifier];13.184 -}13.185 -@end13.186 -13.187 -void cocoa_gui_show_preferences()13.188 -{13.189 - if( prefs_panel == NULL ) {13.190 - prefs_panel = [[LxdreamPrefsPanel alloc] initWithContentRect: NSMakeRect(0,0,640,400)];13.191 - }13.192 - [prefs_panel makeKeyAndOrderFront: prefs_panel];13.193 -}13.194 \ No newline at end of file
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000014.2 +++ b/src/cocoaui/cocoa_prefs.m Thu Jan 15 04:15:11 2009 +000014.3 @@ -0,0 +1,190 @@14.4 +/**14.5 + * $Id$14.6 + *14.7 + * Construct and manage the preferences panel under cocoa.14.8 + *14.9 + * Copyright (c) 2008 Nathan Keynes.14.10 + *14.11 + * This program is free software; you can redistribute it and/or modify14.12 + * it under the terms of the GNU General Public License as published by14.13 + * the Free Software Foundation; either version 2 of the License, or14.14 + * (at your option) any later version.14.15 + *14.16 + * This program is distributed in the hope that it will be useful,14.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of14.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14.19 + * GNU General Public License for more details.14.20 + */14.21 +14.22 +#include "cocoaui/cocoaui.h"14.23 +#include "lxdream.h"14.24 +#include "config.h"14.25 +14.26 +static LxdreamPrefsPanel *prefs_panel = NULL;14.27 +14.28 +@implementation LxdreamPrefsPane14.29 +- (int)contentHeight14.30 +{14.31 + return [self frame].size.height - headerHeight;14.32 +}14.33 +14.34 +- (id)initWithFrame: (NSRect)frameRect title:(NSString *)title14.35 +{14.36 + if( [super initWithFrame: frameRect ] == nil ) {14.37 + return nil;14.38 + } else {14.39 + int height = frameRect.size.height - TEXT_GAP;14.40 +14.41 + NSFont *titleFont = [NSFont fontWithName: @"Helvetica-Bold" size: 16.0];14.42 + NSRect fontRect = [titleFont boundingRectForFont];14.43 + int titleHeight = fontRect.size.height + [titleFont descender];14.44 + NSTextField *label = cocoa_gui_add_label(self, title,14.45 + NSMakeRect( TEXT_GAP, height-titleHeight,14.46 + frameRect.size.width - (TEXT_GAP*2), titleHeight ));14.47 + [label setFont: titleFont];14.48 + height -= (titleHeight + TEXT_GAP);14.49 +14.50 + NSBox *rule = [[NSBox alloc] initWithFrame: NSMakeRect(1, height, frameRect.size.width-2, 1)];14.51 + [rule setAutoresizingMask: (NSViewMinYMargin|NSViewWidthSizable)];14.52 + [rule setBoxType: NSBoxSeparator];14.53 + [self addSubview: rule];14.54 + height -= TEXT_GAP;14.55 +14.56 + headerHeight = frameRect.size.height - height;14.57 + return self;14.58 + }14.59 +}14.60 +@end14.61 +14.62 +/**************************** Main preferences window ************************/14.63 +14.64 +@interface LxdreamPrefsPanel (Private)14.65 +- (void) initToolbar;14.66 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label14.67 +tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action;14.68 +@end14.69 +14.70 +@implementation LxdreamPrefsPanel14.71 +14.72 +- (NSView *)createControlsPane14.73 +{14.74 + NSView *pane = [[NSView alloc] initWithFrame: NSMakeRect(0,0,640,400)];14.75 + return pane;14.76 +}14.77 +14.78 +- (id)initWithContentRect:(NSRect)contentRect14.79 +{14.80 + if( [super initWithContentRect: contentRect14.81 + styleMask: ( NSTitledWindowMask | NSClosableWindowMask |14.82 + NSMiniaturizableWindowMask | NSResizableWindowMask |14.83 + NSUnifiedTitleAndToolbarWindowMask )14.84 + backing: NSBackingStoreBuffered defer: NO ] == nil ) {14.85 + return nil;14.86 + } else {14.87 + [self setTitle: NS_("Preferences")];14.88 + [self setDelegate: self];14.89 + [self setMinSize: NSMakeSize(400,300)];14.90 + [self initToolbar];14.91 + path_pane = cocoa_gui_create_prefs_path_pane();14.92 + ctrl_pane = cocoa_gui_create_prefs_controller_pane();14.93 + binding_editor = nil;14.94 + [self setContentView: path_pane];14.95 + return self;14.96 + }14.97 +}14.98 +- (void)dealloc14.99 +{14.100 + if( binding_editor != nil ) {14.101 + [binding_editor release];14.102 + binding_editor = nil;14.103 + }14.104 + [super dealloc];14.105 +}14.106 +- (void)windowWillClose: (NSNotification *)notice14.107 +{14.108 + prefs_panel = NULL;14.109 +}14.110 +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)view14.111 +{14.112 + if( [view isKindOfClass: [KeyBindingField class]] ) {14.113 + if( binding_editor == nil ) {14.114 + binding_editor = [[[KeyBindingEditor alloc] init] retain];14.115 + }14.116 + return binding_editor;14.117 + }14.118 + return nil;14.119 +}14.120 +- (void) initToolbar14.121 +{14.122 + NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamPrefsToolbar"];14.123 +14.124 + NSToolbarItem *paths = [self createToolbarItem: @"Paths" label: @"Paths"14.125 + tooltip: @"Configure system paths" icon: @"tb-paths"14.126 + action: @selector(paths_action:)];14.127 + NSToolbarItem *ctrls = [self createToolbarItem: @"Controllers" label: @"Controllers"14.128 + tooltip: @"Configure controllers" icon: @"tb-ctrls"14.129 + action: @selector(controllers_action:)];14.130 + toolbar_ids = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];14.131 + toolbar_defaults = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];14.132 + NSArray *values = [NSArray arrayWithObjects: paths, ctrls, nil ];14.133 + toolbar_items = [NSDictionary dictionaryWithObjects: values forKeys: toolbar_ids];14.134 +14.135 + [toolbar setDelegate: self];14.136 + [toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];14.137 + [toolbar setSizeMode: NSToolbarSizeModeSmall];14.138 + [toolbar setSelectedItemIdentifier: @"Paths"];14.139 + [self setToolbar: toolbar];14.140 +}14.141 +14.142 +- (void)paths_action: (id)sender14.143 +{14.144 + [self setContentView: path_pane];14.145 +}14.146 +- (void)controllers_action: (id)sender14.147 +{14.148 + [self setContentView: ctrl_pane];14.149 +}14.150 +14.151 +/***************************** Toolbar methods ***************************/14.152 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label14.153 +tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action14.154 +{14.155 + NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier: id];14.156 + [item setLabel: label];14.157 + [item setToolTip: tooltip];14.158 + [item setTarget: self];14.159 + NSString *iconFile = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];14.160 + NSImage *image = [[NSImage alloc] initWithContentsOfFile: iconFile];14.161 + [item setImage: image];14.162 + [item setAction: action];14.163 + return item;14.164 +}14.165 +- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar14.166 +{14.167 + return toolbar_ids;14.168 +}14.169 +14.170 +- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar14.171 +{14.172 + return toolbar_defaults;14.173 +}14.174 +14.175 +- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar14.176 +{14.177 + return [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];14.178 +}14.179 +14.180 +- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier14.181 +willBeInsertedIntoToolbar:(BOOL)flag14.182 +{14.183 + return [toolbar_items objectForKey: itemIdentifier];14.184 +}14.185 +@end14.186 +14.187 +void cocoa_gui_show_preferences()14.188 +{14.189 + if( prefs_panel == NULL ) {14.190 + prefs_panel = [[LxdreamPrefsPanel alloc] initWithContentRect: NSMakeRect(0,0,640,400)];14.191 + }14.192 + [prefs_panel makeKeyAndOrderFront: prefs_panel];14.193 +}14.194 \ No newline at end of file
15.1 --- a/src/cocoaui/cocoa_win.c Thu Jan 15 03:54:21 2009 +000015.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000015.3 @@ -1,258 +0,0 @@15.4 -/**15.5 - * $Id$15.6 - *15.7 - * Construct and maintain the main window under cocoa.15.8 - *15.9 - * Copyright (c) 2008 Nathan Keynes.15.10 - *15.11 - * This program is free software; you can redistribute it and/or modify15.12 - * it under the terms of the GNU General Public License as published by15.13 - * the Free Software Foundation; either version 2 of the License, or15.14 - * (at your option) any later version.15.15 - *15.16 - * This program is distributed in the hope that it will be useful,15.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of15.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15.19 - * GNU General Public License for more details.15.20 - */15.21 -15.22 -#include "cocoaui/cocoaui.h"15.23 -#include "lxdream.h"15.24 -#include "dreamcast.h"15.25 -#include "gdrom/gdrom.h"15.26 -#include <ApplicationServices/ApplicationServices.h>15.27 -15.28 -@interface NSWindow (OSX10_5_and_later)15.29 -#ifndef CGFLOAT_DEFINED15.30 -# ifdef __LP64__15.31 - typedef double CGFloat;15.32 -# else15.33 - typedef float CGFloat;15.34 -# endif15.35 -#endif15.36 -- (void)setAutorecalculatesContentBorderThickness:(BOOL)b forEdge:(NSRectEdge)e;15.37 -- (void)setContentBorderThickness:(CGFloat)b forEdge:(NSRectEdge)e;15.38 -@end15.39 -15.40 -15.41 -#if NSAppKitVersionNumber > NSAppKitVersionNumber10_415.42 -15.43 -#endif15.44 -15.45 -#define STATUSBAR_HEIGHT 2515.46 -#define STATUS_TEXT_HEIGHT 2215.47 -15.48 -@interface LxdreamToolbarDelegate : NSObject {15.49 - NSArray *identifiers;15.50 - NSArray *defaults;15.51 - NSDictionary *items;15.52 -}15.53 -- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label15.54 - tooltip: (NSString *)tooltip15.55 - icon: (NSString *)icon action: (SEL) action;15.56 -@end15.57 -15.58 -@implementation LxdreamToolbarDelegate15.59 -- (id) init15.60 -{15.61 - NSToolbarItem *mount = [self createToolbarItem: @"GdromMount" label: @"Open Image"15.62 - tooltip: @"Mount a cdrom disc" icon: @"tb-cdrom"15.63 - action: @selector(mount_action:)];15.64 - NSToolbarItem *reset = [self createToolbarItem: @"Reset" label: @"Reset"15.65 - tooltip: @"Reset dreamcast" icon: @"tb-reset"15.66 - action: @selector(reset_action:)];15.67 - NSToolbarItem *pause = [self createToolbarItem: @"Pause" label: @"Pause"15.68 - tooltip: @"Pause dreamcast" icon: @"tb-pause"15.69 - action: @selector(pause_action:)];15.70 - NSToolbarItem *run = [self createToolbarItem: @"Run" label: @"Resume"15.71 - tooltip: @"Resume" icon: @"tb-run"15.72 - action: @selector(run_action:)];15.73 - NSToolbarItem *load = [self createToolbarItem: @"LoadState" label: @"Load State..."15.74 - tooltip: @"Load an lxdream save state" icon: @"tb-load"15.75 - action: @selector(load_action:)];15.76 - NSToolbarItem *save = [self createToolbarItem: @"SaveState" label: @"Save State..."15.77 - tooltip: @"Create an lxdream save state" icon: @"tb-save"15.78 - action: @selector(save_action:)];15.79 - NSToolbarItem *prefs = [self createToolbarItem: @"Preferences" label: @"Preferences..."15.80 - tooltip: @"Edit preferences" icon: @"tb-preferences"15.81 - action: @selector(preferences_action:)];15.82 - [pause setEnabled: NO];15.83 - identifiers =15.84 - [NSArray arrayWithObjects: @"GdromMount", @"Reset", @"Pause", @"Run", @"LoadState", @"SaveState", @"Preferences", nil ];15.85 - defaults =15.86 - [NSArray arrayWithObjects: @"GdromMount", @"Reset", @"Pause", @"Run",15.87 - NSToolbarSeparatorItemIdentifier, @"LoadState", @"SaveState",15.88 - NSToolbarFlexibleSpaceItemIdentifier, @"Preferences", nil ];15.89 - NSArray *values = [NSArray arrayWithObjects: mount, reset, pause, run, load, save, prefs, nil ];15.90 - items = [NSDictionary dictionaryWithObjects: values forKeys: identifiers];15.91 - return self;15.92 -}15.93 -15.94 -- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label15.95 -tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action15.96 -{15.97 - NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier: id];15.98 - [item setLabel: label];15.99 - [item setToolTip: tooltip];15.100 - [item setTarget: [NSApp delegate]];15.101 - NSString *iconFile = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];15.102 - NSImage *image = [[NSImage alloc] initWithContentsOfFile: iconFile];15.103 - [item setImage: image];15.104 - [item setAction: action];15.105 - return item;15.106 -}15.107 -15.108 -- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar15.109 -{15.110 - return identifiers;15.111 -}15.112 -15.113 -- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar15.114 -{15.115 - return defaults;15.116 -}15.117 -15.118 -- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar15.119 -{15.120 - return [NSArray arrayWithObjects: @"Pause", @"Run", nil];15.121 -}15.122 -15.123 -- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier15.124 -willBeInsertedIntoToolbar:(BOOL)flag15.125 -{15.126 - return [items objectForKey: itemIdentifier];15.127 -}15.128 -@end15.129 -15.130 -@implementation LxdreamMainWindow15.131 -- (id)initWithContentRect:(NSRect)videoRect15.132 -{15.133 - NSRect contentRect = NSMakeRect(videoRect.origin.x,videoRect.origin.y,15.134 - videoRect.size.width,videoRect.size.height+STATUSBAR_HEIGHT);15.135 - if( [super initWithContentRect: contentRect15.136 - styleMask: ( NSTitledWindowMask | NSClosableWindowMask |15.137 - NSMiniaturizableWindowMask | NSResizableWindowMask |15.138 - NSUnifiedTitleAndToolbarWindowMask )15.139 - backing: NSBackingStoreBuffered defer: NO ] == nil ) {15.140 - return nil;15.141 - } else {15.142 - useGrab = NO;15.143 - isGrabbed = NO;15.144 - video = (LxdreamVideoView *)video_osx_create_drawable();15.145 - [video setFrameOrigin: NSMakePoint(0.0,STATUSBAR_HEIGHT)];15.146 - [video setDelegate: self];15.147 -15.148 - status =15.149 - [[NSTextField alloc] initWithFrame: NSMakeRect(0.0,0.0,videoRect.size.width,STATUS_TEXT_HEIGHT)];15.150 - [status setStringValue: @"Idle"];15.151 - [status setEditable: NO];15.152 - [status setDrawsBackground: NO];15.153 - [status setBordered: NO];15.154 - [[self contentView] addSubview: video];15.155 - [[self contentView] addSubview: status];15.156 - [self makeFirstResponder: video];15.157 -15.158 - if( [self respondsToSelector:@selector(setAutorecalculatesContentBorderThickness:forEdge:)] )15.159 - [self setAutorecalculatesContentBorderThickness: NO forEdge: NSMinYEdge ];15.160 - if( [self respondsToSelector:@selector(setContentBorderThickness:forEdge:)] )15.161 - [self setContentBorderThickness: STATUSBAR_HEIGHT forEdge: NSMinYEdge];15.162 -15.163 - // Share the app delegate for the purposes of keeping it in one place15.164 - [self setDelegate: [NSApp delegate]];15.165 - [self setContentMinSize: contentRect.size];15.166 - [self setAcceptsMouseMovedEvents: YES];15.167 - [self updateTitle];15.168 -15.169 - NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamToolbar"];15.170 - [toolbar setDelegate: [[LxdreamToolbarDelegate alloc] init]];15.171 - [toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];15.172 - [toolbar setSizeMode: NSToolbarSizeModeSmall];15.173 - [toolbar setSelectedItemIdentifier: @"Pause"];15.174 - [self setToolbar: toolbar];15.175 - return self;15.176 - }15.177 -}15.178 -15.179 -- (void)updateTitle15.180 -{15.181 - NSString *title;15.182 - const char *disc_title = gdrom_get_current_disc_title();15.183 - if( disc_title == NULL ) {15.184 - title = [NSString stringWithCString: lxdream_package_name];15.185 - } else {15.186 - title = [NSString stringWithFormat: @"%s - %s", lxdream_package_name, disc_title];15.187 - }15.188 - [self setTitle: title];15.189 -}15.190 -15.191 -- (void)setStatusText: (const gchar *)text15.192 -{15.193 - if( isGrabbed ) {15.194 - gchar buf[128];15.195 - snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <ctrl><alt> to release grab)") );15.196 - NSString *s = [NSString stringWithUTF8String: buf];15.197 - [status setStringValue: s];15.198 - } else {15.199 - NSString *s = [NSString stringWithUTF8String: text];15.200 - [status setStringValue: s];15.201 - }15.202 -}15.203 -- (void)setRunning:(BOOL)isRunning15.204 -{15.205 - if( isRunning ) {15.206 - [[self toolbar] setSelectedItemIdentifier: @"Run"];15.207 - [self setStatusText: _("Running")];15.208 - } else {15.209 - [[self toolbar] setSelectedItemIdentifier: @"Pause"];15.210 - [self setStatusText: _("Stopped")];15.211 - }15.212 -}15.213 -- (BOOL)isGrabbed15.214 -{15.215 - return isGrabbed;15.216 -}15.217 -- (void)setIsGrabbed:(BOOL)grab15.218 -{15.219 - if( grab != isGrabbed ) {15.220 - isGrabbed = grab;15.221 - [self setRunning: dreamcast_is_running() ? YES : NO];15.222 -15.223 - if( isGrabbed ) {15.224 - [NSCursor hide];15.225 - CGAssociateMouseAndMouseCursorPosition(NO);15.226 - } else {15.227 - [NSCursor unhide];15.228 - CGAssociateMouseAndMouseCursorPosition(YES);15.229 - }15.230 - [video setIsGrabbed: isGrabbed];15.231 - }15.232 -}15.233 -- (void)setUseGrab:(BOOL)grab15.234 -{15.235 - if( grab != useGrab ) {15.236 - if( !grab && isGrabbed ) {15.237 - [self setIsGrabbed: NO];15.238 - }15.239 - useGrab = grab;15.240 - }15.241 -}15.242 -15.243 -- (id)viewRequestedGrab: (id)sender15.244 -{15.245 - if( useGrab ) {15.246 - [self setIsGrabbed: YES];15.247 - }15.248 - return useGrab ? self : nil;15.249 -}15.250 -- (id)viewRequestedUngrab: (id)sender15.251 -{15.252 - [self setIsGrabbed: NO];15.253 - return useGrab ? self : nil;15.254 -}15.255 -@end15.256 -15.257 -LxdreamMainWindow *cocoa_gui_create_main_window()15.258 -{15.259 - NSRect contentRect = {{0,0},{640,480}};15.260 - return [[LxdreamMainWindow alloc] initWithContentRect: contentRect];15.261 -}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000016.2 +++ b/src/cocoaui/cocoa_win.m Thu Jan 15 04:15:11 2009 +000016.3 @@ -0,0 +1,258 @@16.4 +/**16.5 + * $Id$16.6 + *16.7 + * Construct and maintain the main window under cocoa.16.8 + *16.9 + * Copyright (c) 2008 Nathan Keynes.16.10 + *16.11 + * This program is free software; you can redistribute it and/or modify16.12 + * it under the terms of the GNU General Public License as published by16.13 + * the Free Software Foundation; either version 2 of the License, or16.14 + * (at your option) any later version.16.15 + *16.16 + * This program is distributed in the hope that it will be useful,16.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of16.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16.19 + * GNU General Public License for more details.16.20 + */16.21 +16.22 +#include "cocoaui/cocoaui.h"16.23 +#include "lxdream.h"16.24 +#include "dreamcast.h"16.25 +#include "gdrom/gdrom.h"16.26 +#include <ApplicationServices/ApplicationServices.h>16.27 +16.28 +@interface NSWindow (OSX10_5_and_later)16.29 +#ifndef CGFLOAT_DEFINED16.30 +# ifdef __LP64__16.31 + typedef double CGFloat;16.32 +# else16.33 + typedef float CGFloat;16.34 +# endif16.35 +#endif16.36 +- (void)setAutorecalculatesContentBorderThickness:(BOOL)b forEdge:(NSRectEdge)e;16.37 +- (void)setContentBorderThickness:(CGFloat)b forEdge:(NSRectEdge)e;16.38 +@end16.39 +16.40 +16.41 +#if NSAppKitVersionNumber > NSAppKitVersionNumber10_416.42 +16.43 +#endif16.44 +16.45 +#define STATUSBAR_HEIGHT 2516.46 +#define STATUS_TEXT_HEIGHT 2216.47 +16.48 +@interface LxdreamToolbarDelegate : NSObject {16.49 + NSArray *identifiers;16.50 + NSArray *defaults;16.51 + NSDictionary *items;16.52 +}16.53 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label16.54 + tooltip: (NSString *)tooltip16.55 + icon: (NSString *)icon action: (SEL) action;16.56 +@end16.57 +16.58 +@implementation LxdreamToolbarDelegate16.59 +- (id) init16.60 +{16.61 + NSToolbarItem *mount = [self createToolbarItem: @"GdromMount" label: @"Open Image"16.62 + tooltip: @"Mount a cdrom disc" icon: @"tb-cdrom"16.63 + action: @selector(mount_action:)];16.64 + NSToolbarItem *reset = [self createToolbarItem: @"Reset" label: @"Reset"16.65 + tooltip: @"Reset dreamcast" icon: @"tb-reset"16.66 + action: @selector(reset_action:)];16.67 + NSToolbarItem *pause = [self createToolbarItem: @"Pause" label: @"Pause"16.68 + tooltip: @"Pause dreamcast" icon: @"tb-pause"16.69 + action: @selector(pause_action:)];16.70 + NSToolbarItem *run = [self createToolbarItem: @"Run" label: @"Resume"16.71 + tooltip: @"Resume" icon: @"tb-run"16.72 + action: @selector(run_action:)];16.73 + NSToolbarItem *load = [self createToolbarItem: @"LoadState" label: @"Load State..."16.74 + tooltip: @"Load an lxdream save state" icon: @"tb-load"16.75 + action: @selector(load_action:)];16.76 + NSToolbarItem *save = [self createToolbarItem: @"SaveState" label: @"Save State..."16.77 + tooltip: @"Create an lxdream save state" icon: @"tb-save"16.78 + action: @selector(save_action:)];16.79 + NSToolbarItem *prefs = [self createToolbarItem: @"Preferences" label: @"Preferences..."16.80 + tooltip: @"Edit preferences" icon: @"tb-preferences"16.81 + action: @selector(preferences_action:)];16.82 + [pause setEnabled: NO];16.83 + identifiers =16.84 + [NSArray arrayWithObjects: @"GdromMount", @"Reset", @"Pause", @"Run", @"LoadState", @"SaveState", @"Preferences", nil ];16.85 + defaults =16.86 + [NSArray arrayWithObjects: @"GdromMount", @"Reset", @"Pause", @"Run",16.87 + NSToolbarSeparatorItemIdentifier, @"LoadState", @"SaveState",16.88 + NSToolbarFlexibleSpaceItemIdentifier, @"Preferences", nil ];16.89 + NSArray *values = [NSArray arrayWithObjects: mount, reset, pause, run, load, save, prefs, nil ];16.90 + items = [NSDictionary dictionaryWithObjects: values forKeys: identifiers];16.91 + return self;16.92 +}16.93 +16.94 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label16.95 +tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action16.96 +{16.97 + NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier: id];16.98 + [item setLabel: label];16.99 + [item setToolTip: tooltip];16.100 + [item setTarget: [NSApp delegate]];16.101 + NSString *iconFile = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];16.102 + NSImage *image = [[NSImage alloc] initWithContentsOfFile: iconFile];16.103 + [item setImage: image];16.104 + [item setAction: action];16.105 + return item;16.106 +}16.107 +16.108 +- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar16.109 +{16.110 + return identifiers;16.111 +}16.112 +16.113 +- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar16.114 +{16.115 + return defaults;16.116 +}16.117 +16.118 +- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar16.119 +{16.120 + return [NSArray arrayWithObjects: @"Pause", @"Run", nil];16.121 +}16.122 +16.123 +- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier16.124 +willBeInsertedIntoToolbar:(BOOL)flag16.125 +{16.126 + return [items objectForKey: itemIdentifier];16.127 +}16.128 +@end16.129 +16.130 +@implementation LxdreamMainWindow16.131 +- (id)initWithContentRect:(NSRect)videoRect16.132 +{16.133 + NSRect contentRect = NSMakeRect(videoRect.origin.x,videoRect.origin.y,16.134 + videoRect.size.width,videoRect.size.height+STATUSBAR_HEIGHT);16.135 + if( [super initWithContentRect: contentRect16.136 + styleMask: ( NSTitledWindowMask | NSClosableWindowMask |16.137 + NSMiniaturizableWindowMask | NSResizableWindowMask |16.138 + NSUnifiedTitleAndToolbarWindowMask )16.139 + backing: NSBackingStoreBuffered defer: NO ] == nil ) {16.140 + return nil;16.141 + } else {16.142 + useGrab = NO;16.143 + isGrabbed = NO;16.144 + video = (LxdreamVideoView *)video_osx_create_drawable();16.145 + [video setFrameOrigin: NSMakePoint(0.0,STATUSBAR_HEIGHT)];16.146 + [video setDelegate: self];16.147 +16.148 + status =16.149 + [[NSTextField alloc] initWithFrame: NSMakeRect(0.0,0.0,videoRect.size.width,STATUS_TEXT_HEIGHT)];16.150 + [status setStringValue: @"Idle"];16.151 + [status setEditable: NO];16.152 + [status setDrawsBackground: NO];16.153 + [status setBordered: NO];16.154 + [[self contentView] addSubview: video];16.155 + [[self contentView] addSubview: status];16.156 + [self makeFirstResponder: video];16.157 +16.158 + if( [self respondsToSelector:@selector(setAutorecalculatesContentBorderThickness:forEdge:)] )16.159 + [self setAutorecalculatesContentBorderThickness: NO forEdge: NSMinYEdge ];16.160 + if( [self respondsToSelector:@selector(setContentBorderThickness:forEdge:)] )16.161 + [self setContentBorderThickness: STATUSBAR_HEIGHT forEdge: NSMinYEdge];16.162 +16.163 + // Share the app delegate for the purposes of keeping it in one place16.164 + [self setDelegate: [NSApp delegate]];16.165 + [self setContentMinSize: contentRect.size];16.166 + [self setAcceptsMouseMovedEvents: YES];16.167 + [self updateTitle];16.168 +16.169 + NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamToolbar"];16.170 + [toolbar setDelegate: [[LxdreamToolbarDelegate alloc] init]];16.171 + [toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];16.172 + [toolbar setSizeMode: NSToolbarSizeModeSmall];16.173 + [toolbar setSelectedItemIdentifier: @"Pause"];16.174 + [self setToolbar: toolbar];16.175 + return self;16.176 + }16.177 +}16.178 +16.179 +- (void)updateTitle16.180 +{16.181 + NSString *title;16.182 + const char *disc_title = gdrom_get_current_disc_title();16.183 + if( disc_title == NULL ) {16.184 + title = [NSString stringWithCString: lxdream_package_name];16.185 + } else {16.186 + title = [NSString stringWithFormat: @"%s - %s", lxdream_package_name, disc_title];16.187 + }16.188 + [self setTitle: title];16.189 +}16.190 +16.191 +- (void)setStatusText: (const gchar *)text16.192 +{16.193 + if( isGrabbed ) {16.194 + gchar buf[128];16.195 + snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <ctrl><alt> to release grab)") );16.196 + NSString *s = [NSString stringWithUTF8String: buf];16.197 + [status setStringValue: s];16.198 + } else {16.199 + NSString *s = [NSString stringWithUTF8String: text];16.200 + [status setStringValue: s];16.201 + }16.202 +}16.203 +- (void)setRunning:(BOOL)isRunning16.204 +{16.205 + if( isRunning ) {16.206 + [[self toolbar] setSelectedItemIdentifier: @"Run"];16.207 + [self setStatusText: _("Running")];16.208 + } else {16.209 + [[self toolbar] setSelectedItemIdentifier: @"Pause"];16.210 + [self setStatusText: _("Stopped")];16.211 + }16.212 +}16.213 +- (BOOL)isGrabbed16.214 +{16.215 + return isGrabbed;16.216 +}16.217 +- (void)setIsGrabbed:(BOOL)grab16.218 +{16.219 + if( grab != isGrabbed ) {16.220 + isGrabbed = grab;16.221 + [self setRunning: dreamcast_is_running() ? YES : NO];16.222 +16.223 + if( isGrabbed ) {16.224 + [NSCursor hide];16.225 + CGAssociateMouseAndMouseCursorPosition(NO);16.226 + } else {16.227 + [NSCursor unhide];16.228 + CGAssociateMouseAndMouseCursorPosition(YES);16.229 + }16.230 + [video setIsGrabbed: isGrabbed];16.231 + }16.232 +}16.233 +- (void)setUseGrab:(BOOL)grab16.234 +{16.235 + if( grab != useGrab ) {16.236 + if( !grab && isGrabbed ) {16.237 + [self setIsGrabbed: NO];16.238 + }16.239 + useGrab = grab;16.240 + }16.241 +}16.242 +16.243 +- (id)viewRequestedGrab: (id)sender16.244 +{16.245 + if( useGrab ) {16.246 + [self setIsGrabbed: YES];16.247 + }16.248 + return useGrab ? self : nil;16.249 +}16.250 +- (id)viewRequestedUngrab: (id)sender16.251 +{16.252 + [self setIsGrabbed: NO];16.253 + return useGrab ? self : nil;16.254 +}16.255 +@end16.256 +16.257 +LxdreamMainWindow *cocoa_gui_create_main_window()16.258 +{16.259 + NSRect contentRect = {{0,0},{640,480}};16.260 + return [[LxdreamMainWindow alloc] initWithContentRect: contentRect];16.261 +}
17.1 --- a/src/cocoaui/cocoaui.c Thu Jan 15 03:54:21 2009 +000017.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000017.3 @@ -1,475 +0,0 @@17.4 -/**17.5 - * $Id$17.6 - *17.7 - * Core Cocoa-based user interface17.8 - *17.9 - * Copyright (c) 2008 Nathan Keynes.17.10 - *17.11 - * This program is free software; you can redistribute it and/or modify17.12 - * it under the terms of the GNU General Public License as published by17.13 - * the Free Software Foundation; either version 2 of the License, or17.14 - * (at your option) any later version.17.15 - *17.16 - * This program is distributed in the hope that it will be useful,17.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of17.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17.19 - * GNU General Public License for more details.17.20 - */17.21 -17.22 -#include <AppKit/AppKit.h>17.23 -#include <stdio.h>17.24 -#include <stdlib.h>17.25 -#include <string.h>17.26 -#include <sys/time.h>17.27 -#include "lxdream.h"17.28 -#include "dream.h"17.29 -#include "dreamcast.h"17.30 -#include "config.h"17.31 -#include "display.h"17.32 -#include "gui.h"17.33 -#include "gdrom/gdrom.h"17.34 -#include "gdlist.h"17.35 -#include "loader.h"17.36 -#include "cocoaui/cocoaui.h"17.37 -17.38 -void cocoa_gui_update( void );17.39 -void cocoa_gui_start( void );17.40 -void cocoa_gui_stop( void );17.41 -void cocoa_gui_run_later( void );17.42 -uint32_t cocoa_gui_run_slice( uint32_t nanosecs );17.43 -17.44 -struct dreamcast_module cocoa_gui_module = { "gui", NULL,17.45 - cocoa_gui_update,17.46 - cocoa_gui_start,17.47 - cocoa_gui_run_slice,17.48 - cocoa_gui_stop,17.49 - NULL, NULL };17.50 -17.51 -/**17.52 - * Count of running nanoseconds - used to cut back on the GUI runtime17.53 - */17.54 -static uint32_t cocoa_gui_nanos = 0;17.55 -static uint32_t cocoa_gui_ticks = 0;17.56 -static struct timeval cocoa_gui_lasttv;17.57 -static BOOL cocoa_gui_autorun = NO;17.58 -static BOOL cocoa_gui_is_running = NO;17.59 -static LxdreamMainWindow *mainWindow = NULL;17.60 -17.61 -@interface NSApplication (PrivateAdditions)17.62 -- (void) setAppleMenu:(NSMenu *)aMenu;17.63 -@end17.64 -17.65 -gboolean cocoa_gui_disc_changed( gdrom_disc_t disc, const gchar *disc_name, void *user_data )17.66 -{17.67 - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];17.68 - LxdreamMainWindow *window = (LxdreamMainWindow *)user_data;17.69 - [window updateTitle];17.70 - [pool release];17.71 - return TRUE;17.72 -}17.73 -17.74 -/**17.75 - * Produces the menu title by looking the text up in gettext, removing any17.76 - * underscores, and returning the result as an NSString.17.77 - */17.78 -static NSString *NSMENU_( const char *text )17.79 -{17.80 - const char *s = gettext(text);17.81 - char buf[strlen(s)+1];17.82 - char *d = buf;17.83 -17.84 - while( *s != '\0' ) {17.85 - if( *s != '_' ) {17.86 - *d++ = *s;17.87 - }17.88 - s++;17.89 - }17.90 - *d = '\0';17.91 -17.92 - return [NSString stringWithUTF8String: buf];17.93 -}17.94 -17.95 -static void cocoa_gui_create_menu(void)17.96 -{17.97 - NSMenu *appleMenu, *services;17.98 - NSMenuItem *menuItem;17.99 - NSString *title;17.100 - NSString *appName;17.101 -17.102 - appName = @"Lxdream";17.103 - appleMenu = [[NSMenu alloc] initWithTitle:@""];17.104 -17.105 - /* Add menu items */17.106 - title = [@"About " stringByAppendingString:appName];17.107 - [appleMenu addItemWithTitle:title action:@selector(about_action:) keyEquivalent:@""];17.108 -17.109 - [appleMenu addItem:[NSMenuItem separatorItem]];17.110 - [appleMenu addItemWithTitle: NSMENU_("_Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];17.111 -17.112 - // Services Menu17.113 - [appleMenu addItem:[NSMenuItem separatorItem]];17.114 - services = [[[NSMenu alloc] init] autorelease];17.115 - [appleMenu addItemWithTitle: NS_("Services") action:nil keyEquivalent:@""];17.116 - [appleMenu setSubmenu: services forItem: [appleMenu itemWithTitle: @"Services"]];17.117 -17.118 - // Hide AppName17.119 - title = [@"Hide " stringByAppendingString:appName];17.120 - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];17.121 -17.122 - // Hide Others17.123 - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others"17.124 - action:@selector(hideOtherApplications:)17.125 - keyEquivalent:@"h"];17.126 - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];17.127 -17.128 - // Show All17.129 - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];17.130 - [appleMenu addItem:[NSMenuItem separatorItem]];17.131 -17.132 - // Quit AppName17.133 - title = [@"Quit " stringByAppendingString:appName];17.134 - [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];17.135 -17.136 - /* Put menu into the menubar */17.137 - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];17.138 - [menuItem setSubmenu: appleMenu];17.139 - NSMenu *menu = [NSMenu new];17.140 - [menu addItem: menuItem];17.141 -17.142 - NSMenu *gdromMenu = cocoa_gdrom_menu_new();17.143 -17.144 - NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NSMENU_("_File")];17.145 - [fileMenu addItemWithTitle: NSMENU_("Load _Binary...") action: @selector(load_binary_action:) keyEquivalent: @"b"];17.146 - [[fileMenu addItemWithTitle: NSMENU_("_GD-Rom") action: nil keyEquivalent: @""]17.147 - setSubmenu: gdromMenu];17.148 - [fileMenu addItem: [NSMenuItem separatorItem]];17.149 - [[fileMenu addItemWithTitle: NSMENU_("_Reset") action: @selector(reset_action:) keyEquivalent: @"r"]17.150 - setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];17.151 - [fileMenu addItemWithTitle: NSMENU_("_Pause") action: @selector(pause_action:) keyEquivalent: @"p"];17.152 - [fileMenu addItemWithTitle: NS_("Resume") action: @selector(run_action:) keyEquivalent: @"r"];17.153 - [fileMenu addItem: [NSMenuItem separatorItem]];17.154 - [fileMenu addItemWithTitle: NSMENU_("_Load State...") action: @selector(load_action:) keyEquivalent: @"o"];17.155 - [fileMenu addItemWithTitle: NSMENU_("_Save State...") action: @selector(save_action:) keyEquivalent: @"s"];17.156 -17.157 - menuItem = [[NSMenuItem alloc] initWithTitle:NSMENU_("_File") action: nil keyEquivalent: @""];17.158 - [menuItem setSubmenu: fileMenu];17.159 - [menu addItem: menuItem];17.160 -17.161 - /* Tell the application object that this is now the application menu */17.162 - [NSApp setMainMenu: menu];17.163 - [NSApp setAppleMenu: appleMenu];17.164 - [NSApp setServicesMenu: services];17.165 -17.166 - /* Finally give up our references to the objects */17.167 - [appleMenu release];17.168 - [menuItem release];17.169 - [menu release];17.170 -}17.171 -17.172 -@interface LxdreamDelegate : NSObject17.173 -@end17.174 -17.175 -@implementation LxdreamDelegate17.176 -- (void)windowWillClose: (NSNotification *)notice17.177 -{17.178 - dreamcast_shutdown();17.179 - exit(0);17.180 -}17.181 -- (void)windowDidBecomeMain: (NSNotification *)notice17.182 -{17.183 - if( cocoa_gui_autorun ) {17.184 - cocoa_gui_autorun = NO;17.185 - cocoa_gui_run_later();17.186 - }17.187 -}17.188 -- (void)windowDidBecomeKey: (NSNotification *)notice17.189 -{17.190 - display_set_focused( TRUE );17.191 -}17.192 -- (void)windowDidResignKey: (NSNotification *)notice17.193 -{17.194 - display_set_focused( FALSE );17.195 - [mainWindow setIsGrabbed: NO];17.196 -}17.197 -- (BOOL)application: (NSApplication *)app openFile: (NSString *)filename17.198 -{17.199 - const gchar *cname = [filename UTF8String];17.200 - if( file_load_magic(cname) ) {17.201 - // Queue up a run event17.202 - cocoa_gui_run_later();17.203 - return YES;17.204 - } else {17.205 - return NO;17.206 - }17.207 -17.208 -}17.209 -- (void) about_action: (id)sender17.210 -{17.211 - NSArray *keys = [NSArray arrayWithObjects: @"Version", @"Copyright", nil];17.212 - NSArray *values = [NSArray arrayWithObjects: NS_(lxdream_full_version), NS_(lxdream_copyright), nil];17.213 -17.214 - NSDictionary *options= [NSDictionary dictionaryWithObjects: values forKeys: keys];17.215 -17.216 - [NSApp orderFrontStandardAboutPanelWithOptions: options];17.217 -}17.218 -- (void) preferences_action: (id)sender17.219 -{17.220 - cocoa_gui_show_preferences();17.221 -}17.222 -- (void) load_action: (id)sender17.223 -{17.224 - NSOpenPanel *panel = [NSOpenPanel openPanel];17.225 - const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);17.226 - NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);17.227 - NSArray *fileTypes = [NSArray arrayWithObject: @"dst"];17.228 - int result = [panel runModalForDirectory: path file: nil types: fileTypes];17.229 - if( result == NSOKButton && [[panel filenames] count] > 0 ) {17.230 - NSString *filename = [[panel filenames] objectAtIndex: 0];17.231 - dreamcast_load_state( [filename UTF8String] );17.232 - }17.233 -}17.234 -- (void) save_action: (id)sender17.235 -{17.236 - NSSavePanel *panel = [NSSavePanel savePanel];17.237 - const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);17.238 - NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);17.239 - [panel setRequiredFileType: @"dst"];17.240 - int result = [panel runModalForDirectory: path file:@""];17.241 - if( result == NSOKButton ) {17.242 - NSString *filename = [panel filename];17.243 - dreamcast_save_state( [filename UTF8String] );17.244 - }17.245 -}17.246 -- (void) load_binary_action: (id)sender17.247 -{17.248 - NSOpenPanel *panel = [NSOpenPanel openPanel];17.249 - const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);17.250 - NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);17.251 - int result = [panel runModalForDirectory: path file: nil types: nil];17.252 - if( result == NSOKButton && [[panel filenames] count] > 0 ) {17.253 - NSString *filename = [[panel filenames] objectAtIndex: 0];17.254 - file_load_magic( [filename UTF8String] );17.255 - }17.256 -}17.257 -- (void) mount_action: (id)sender17.258 -{17.259 - NSOpenPanel *panel = [NSOpenPanel openPanel];17.260 - const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);17.261 - NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);17.262 - int result = [panel runModalForDirectory: path file: nil types: nil];17.263 - if( result == NSOKButton && [[panel filenames] count] > 0 ) {17.264 - NSString *filename = [[panel filenames] objectAtIndex: 0];17.265 - gdrom_mount_image( [filename UTF8String] );17.266 - }17.267 -}17.268 -- (void) pause_action: (id)sender17.269 -{17.270 - dreamcast_stop();17.271 -}17.272 -17.273 -- (void) reset_action: (id)sender17.274 -{17.275 - dreamcast_reset();17.276 -}17.277 -- (void) run_action: (id)sender17.278 -{17.279 - if( !dreamcast_is_running() ) {17.280 - cocoa_gui_run_later();17.281 - }17.282 -}17.283 -- (void) run_immediate17.284 -{17.285 - dreamcast_run();17.286 - [mainWindow setRunning: NO];17.287 -}17.288 -- (void) gdrom_list_action: (id)sender17.289 -{17.290 - gdrom_list_set_selection( [sender tag] );17.291 -}17.292 -@end17.293 -17.294 -17.295 -gboolean gui_parse_cmdline( int *argc, char **argv[] )17.296 -{17.297 - /* If started from the finder, the first (and only) arg will look something like17.298 - * -psn_0_... - we want to remove this so that lxdream doesn't try to process it17.299 - * normally17.300 - */17.301 - if( *argc == 2 && strncmp((*argv)[1], "-psn_", 5) == 0 ) {17.302 - *argc = 1;17.303 - }17.304 - return TRUE;17.305 -}17.306 -17.307 -gboolean gui_init( gboolean withDebug )17.308 -{17.309 - dreamcast_register_module( &cocoa_gui_module );17.310 -17.311 - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];17.312 - [NSApplication sharedApplication];17.313 -17.314 - LxdreamDelegate *delegate = [[LxdreamDelegate alloc] init];17.315 - [NSApp setDelegate: delegate];17.316 - NSString *iconFile = [[NSBundle mainBundle] pathForResource:@"dcemu" ofType:@"gif"];17.317 - NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile: iconFile];17.318 - [iconImage setName: @"NSApplicationIcon"];17.319 - [NSApp setApplicationIconImage: iconImage];17.320 - cocoa_gui_create_menu();17.321 - mainWindow = cocoa_gui_create_main_window();17.322 - [mainWindow makeKeyAndOrderFront: nil];17.323 - [NSApp activateIgnoringOtherApps: YES];17.324 -17.325 - register_gdrom_disc_change_hook( cocoa_gui_disc_changed, mainWindow );17.326 -17.327 - [pool release];17.328 - return TRUE;17.329 -}17.330 -17.331 -void gui_main_loop( gboolean run )17.332 -{17.333 - if( run ) {17.334 - cocoa_gui_autorun = YES;17.335 - }17.336 - cocoa_gui_is_running = YES;17.337 - [NSApp run];17.338 - cocoa_gui_is_running = NO;17.339 -}17.340 -17.341 -void gui_update_state(void)17.342 -{17.343 - cocoa_gui_update();17.344 -}17.345 -17.346 -void gui_set_use_grab( gboolean grab )17.347 -{17.348 - [mainWindow setUseGrab: (grab ? YES : NO)];17.349 -}17.350 -17.351 -gboolean gui_error_dialog( const char *msg, ... )17.352 -{17.353 - if( cocoa_gui_is_running ) {17.354 - NSString *error_string;17.355 -17.356 - va_list args;17.357 - va_start(args, msg);17.358 - error_string = [[NSString alloc] initWithFormat: [NSString stringWithCString: msg] arguments: args];17.359 - NSRunAlertPanel(NS_("Error in Lxdream"), error_string, nil, nil, nil);17.360 - va_end(args);17.361 - return TRUE;17.362 - } else {17.363 - return FALSE;17.364 - }17.365 -}17.366 -17.367 -void gui_update_io_activity( io_activity_type io, gboolean active )17.368 -{17.369 -17.370 -}17.371 -17.372 -17.373 -uint32_t cocoa_gui_run_slice( uint32_t nanosecs )17.374 -{17.375 - NSEvent *event;17.376 - NSAutoreleasePool *pool;17.377 -17.378 - cocoa_gui_nanos += nanosecs;17.379 - if( cocoa_gui_nanos > GUI_TICK_PERIOD ) { /* 10 ms */17.380 - cocoa_gui_nanos -= GUI_TICK_PERIOD;17.381 - cocoa_gui_ticks ++;17.382 - uint32_t current_period = cocoa_gui_ticks * GUI_TICK_PERIOD;17.383 -17.384 - // Run the event loop17.385 - pool = [NSAutoreleasePool new];17.386 - while( (event = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil17.387 - inMode: NSDefaultRunLoopMode dequeue: YES]) != nil ) {17.388 - [NSApp sendEvent: event];17.389 - }17.390 - [pool release];17.391 -17.392 - struct timeval tv;17.393 - gettimeofday(&tv,NULL);17.394 - uint32_t ns = ((tv.tv_sec - cocoa_gui_lasttv.tv_sec) * 1000000000) +17.395 - (tv.tv_usec - cocoa_gui_lasttv.tv_usec)*1000;17.396 - if( (ns * 1.05) < current_period ) {17.397 - // We've gotten ahead - sleep for a little bit17.398 - struct timespec tv;17.399 - tv.tv_sec = 0;17.400 - tv.tv_nsec = current_period - ns;17.401 - nanosleep(&tv, &tv);17.402 - }17.403 -17.404 - /* Update the display every 10 ticks (ie 10 times a second) and17.405 - * save the current tv value */17.406 - if( cocoa_gui_ticks > 10 ) {17.407 - gchar buf[32];17.408 - cocoa_gui_ticks -= 10;17.409 -17.410 - double speed = (float)( (double)current_period * 100.0 / ns );17.411 - cocoa_gui_lasttv.tv_sec = tv.tv_sec;17.412 - cocoa_gui_lasttv.tv_usec = tv.tv_usec;17.413 - snprintf( buf, 32, _("Running (%2.4f%%)"), speed );17.414 - [mainWindow setStatusText: buf];17.415 -17.416 - }17.417 - }17.418 - return nanosecs;17.419 -}17.420 -17.421 -void cocoa_gui_update( void )17.422 -{17.423 -17.424 -}17.425 -17.426 -void cocoa_gui_start( void )17.427 -{17.428 - [mainWindow setRunning: YES];17.429 - cocoa_gui_nanos = 0;17.430 - gettimeofday(&cocoa_gui_lasttv,NULL);17.431 -}17.432 -17.433 -void cocoa_gui_stop( void )17.434 -{17.435 - [mainWindow setRunning: NO];17.436 -}17.437 -17.438 -/**17.439 - * Queue a dreamcast_run() to execute after the currently event(s)17.440 - */17.441 -void cocoa_gui_run_later( void )17.442 -{17.443 - [[NSRunLoop currentRunLoop] performSelector: @selector(run_immediate)17.444 - target: [NSApp delegate] argument: nil order: 117.445 - modes: [NSArray arrayWithObject: NSDefaultRunLoopMode] ];17.446 -}17.447 -17.448 -/*************************** Convenience methods ***************************/17.449 -17.450 -NSImage *NSImage_new_from_framebuffer( frame_buffer_t buffer )17.451 -{17.452 - NSBitmapImageRep *rep =17.453 - [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: &buffer->data17.454 - pixelsWide: buffer->width pixelsHigh: buffer->height17.455 - bitsPerSample: 8 samplesPerPixel: 317.456 - hasAlpha: NO isPlanar: NO17.457 - colorSpaceName: NSDeviceRGBColorSpace bitmapFormat: 017.458 - bytesPerRow: buffer->rowstride bitsPerPixel: 24];17.459 -17.460 - NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize(0.0,0.0)];17.461 - [image addRepresentation: rep];17.462 - return image;17.463 -}17.464 -17.465 -17.466 -NSTextField *cocoa_gui_add_label( NSView *parent, NSString *text, NSRect frame )17.467 -{17.468 - NSTextField *label = [[NSTextField alloc] initWithFrame: frame];17.469 - [label setStringValue: text];17.470 - [label setBordered: NO];17.471 - [label setDrawsBackground: NO];17.472 - [label setEditable: NO];17.473 - [label setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];17.474 - if( parent != NULL ) {17.475 - [parent addSubview: label];17.476 - }17.477 - return label;17.478 -}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000018.2 +++ b/src/cocoaui/cocoaui.m Thu Jan 15 04:15:11 2009 +000018.3 @@ -0,0 +1,475 @@18.4 +/**18.5 + * $Id$18.6 + *18.7 + * Core Cocoa-based user interface18.8 + *18.9 + * Copyright (c) 2008 Nathan Keynes.18.10 + *18.11 + * This program is free software; you can redistribute it and/or modify18.12 + * it under the terms of the GNU General Public License as published by18.13 + * the Free Software Foundation; either version 2 of the License, or18.14 + * (at your option) any later version.18.15 + *18.16 + * This program is distributed in the hope that it will be useful,18.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of18.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18.19 + * GNU General Public License for more details.18.20 + */18.21 +18.22 +#include <AppKit/AppKit.h>18.23 +#include <stdio.h>18.24 +#include <stdlib.h>18.25 +#include <string.h>18.26 +#include <sys/time.h>18.27 +#include "lxdream.h"18.28 +#include "dream.h"18.29 +#include "dreamcast.h"18.30 +#include "config.h"18.31 +#include "display.h"18.32 +#include "gui.h"18.33 +#include "gdrom/gdrom.h"18.34 +#include "gdlist.h"18.35 +#include "loader.h"18.36 +#include "cocoaui/cocoaui.h"18.37 +18.38 +void cocoa_gui_update( void );18.39 +void cocoa_gui_start( void );18.40 +void cocoa_gui_stop( void );18.41 +void cocoa_gui_run_later( void );18.42 +uint32_t cocoa_gui_run_slice( uint32_t nanosecs );18.43 +18.44 +struct dreamcast_module cocoa_gui_module = { "gui", NULL,18.45 + cocoa_gui_update,18.46 + cocoa_gui_start,18.47 + cocoa_gui_run_slice,18.48 + cocoa_gui_stop,18.49 + NULL, NULL };18.50 +18.51 +/**18.52 + * Count of running nanoseconds - used to cut back on the GUI runtime18.53 + */18.54 +static uint32_t cocoa_gui_nanos = 0;18.55 +static uint32_t cocoa_gui_ticks = 0;18.56 +static struct timeval cocoa_gui_lasttv;18.57 +static BOOL cocoa_gui_autorun = NO;18.58 +static BOOL cocoa_gui_is_running = NO;18.59 +static LxdreamMainWindow *mainWindow = NULL;18.60 +18.61 +@interface NSApplication (PrivateAdditions)18.62 +- (void) setAppleMenu:(NSMenu *)aMenu;18.63 +@end18.64 +18.65 +gboolean cocoa_gui_disc_changed( gdrom_disc_t disc, const gchar *disc_name, void *user_data )18.66 +{18.67 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];18.68 + LxdreamMainWindow *window = (LxdreamMainWindow *)user_data;18.69 + [window updateTitle];18.70 + [pool release];18.71 + return TRUE;18.72 +}18.73 +18.74 +/**18.75 + * Produces the menu title by looking the text up in gettext, removing any18.76 + * underscores, and returning the result as an NSString.18.77 + */18.78 +static NSString *NSMENU_( const char *text )18.79 +{18.80 + const char *s = gettext(text);18.81 + char buf[strlen(s)+1];18.82 + char *d = buf;18.83 +18.84 + while( *s != '\0' ) {18.85 + if( *s != '_' ) {18.86 + *d++ = *s;18.87 + }18.88 + s++;18.89 + }18.90 + *d = '\0';18.91 +18.92 + return [NSString stringWithUTF8String: buf];18.93 +}18.94 +18.95 +static void cocoa_gui_create_menu(void)18.96 +{18.97 + NSMenu *appleMenu, *services;18.98 + NSMenuItem *menuItem;18.99 + NSString *title;18.100 + NSString *appName;18.101 +18.102 + appName = @"Lxdream";18.103 + appleMenu = [[NSMenu alloc] initWithTitle:@""];18.104 +18.105 + /* Add menu items */18.106 + title = [@"About " stringByAppendingString:appName];18.107 + [appleMenu addItemWithTitle:title action:@selector(about_action:) keyEquivalent:@""];18.108 +18.109 + [appleMenu addItem:[NSMenuItem separatorItem]];18.110 + [appleMenu addItemWithTitle: NSMENU_("_Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];18.111 +18.112 + // Services Menu18.113 + [appleMenu addItem:[NSMenuItem separatorItem]];18.114 + services = [[[NSMenu alloc] init] autorelease];18.115 + [appleMenu addItemWithTitle: NS_("Services") action:nil keyEquivalent:@""];18.116 + [appleMenu setSubmenu: services forItem: [appleMenu itemWithTitle: @"Services"]];18.117 +18.118 + // Hide AppName18.119 + title = [@"Hide " stringByAppendingString:appName];18.120 + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];18.121 +18.122 + // Hide Others18.123 + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others"18.124 + action:@selector(hideOtherApplications:)18.125 + keyEquivalent:@"h"];18.126 + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];18.127 +18.128 + // Show All18.129 + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];18.130 + [appleMenu addItem:[NSMenuItem separatorItem]];18.131 +18.132 + // Quit AppName18.133 + title = [@"Quit " stringByAppendingString:appName];18.134 + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];18.135 +18.136 + /* Put menu into the menubar */18.137 + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];18.138 + [menuItem setSubmenu: appleMenu];18.139 + NSMenu *menu = [NSMenu new];18.140 + [menu addItem: menuItem];18.141 +18.142 + NSMenu *gdromMenu = cocoa_gdrom_menu_new();18.143 +18.144 + NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NSMENU_("_File")];18.145 + [fileMenu addItemWithTitle: NSMENU_("Load _Binary...") action: @selector(load_binary_action:) keyEquivalent: @"b"];18.146 + [[fileMenu addItemWithTitle: NSMENU_("_GD-Rom") action: nil keyEquivalent: @""]18.147 + setSubmenu: gdromMenu];18.148 + [fileMenu addItem: [NSMenuItem separatorItem]];18.149 + [[fileMenu addItemWithTitle: NSMENU_("_Reset") action: @selector(reset_action:) keyEquivalent: @"r"]18.150 + setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];18.151 + [fileMenu addItemWithTitle: NSMENU_("_Pause") action: @selector(pause_action:) keyEquivalent: @"p"];18.152 + [fileMenu addItemWithTitle: NS_("Resume") action: @selector(run_action:) keyEquivalent: @"r"];18.153 + [fileMenu addItem: [NSMenuItem separatorItem]];18.154 + [fileMenu addItemWithTitle: NSMENU_("_Load State...") action: @selector(load_action:) keyEquivalent: @"o"];18.155 + [fileMenu addItemWithTitle: NSMENU_("_Save State...") action: @selector(save_action:) keyEquivalent: @"s"];18.156 +18.157 + menuItem = [[NSMenuItem alloc] initWithTitle:NSMENU_("_File") action: nil keyEquivalent: @""];18.158 + [menuItem setSubmenu: fileMenu];18.159 + [menu addItem: menuItem];18.160 +18.161 + /* Tell the application object that this is now the application menu */18.162 + [NSApp setMainMenu: menu];18.163 + [NSApp setAppleMenu: appleMenu];18.164 + [NSApp setServicesMenu: services];18.165 +18.166 + /* Finally give up our references to the objects */18.167 + [appleMenu release];18.168 + [menuItem release];18.169 + [menu release];18.170 +}18.171 +18.172 +@interface LxdreamDelegate : NSObject18.173 +@end18.174 +18.175 +@implementation LxdreamDelegate18.176 +- (void)windowWillClose: (NSNotification *)notice18.177 +{18.178 + dreamcast_shutdown();18.179 + exit(0);18.180 +}18.181 +- (void)windowDidBecomeMain: (NSNotification *)notice18.182 +{18.183 + if( cocoa_gui_autorun ) {18.184 + cocoa_gui_autorun = NO;18.185 + cocoa_gui_run_later();18.186 + }18.187 +}18.188 +- (void)windowDidBecomeKey: (NSNotification *)notice18.189 +{18.190 + display_set_focused( TRUE );18.191 +}18.192 +- (void)windowDidResignKey: (NSNotification *)notice18.193 +{18.194 + display_set_focused( FALSE );18.195 + [mainWindow setIsGrabbed: NO];18.196 +}18.197 +- (BOOL)application: (NSApplication *)app openFile: (NSString *)filename18.198 +{18.199 + const gchar *cname = [filename UTF8String];18.200 + if( file_load_magic(cname) ) {18.201 + // Queue up a run event18.202 + cocoa_gui_run_later();18.203 + return YES;18.204 + } else {18.205 + return NO;18.206 + }18.207 +18.208 +}18.209 +- (void) about_action: (id)sender18.210 +{18.211 + NSArray *keys = [NSArray arrayWithObjects: @"Version", @"Copyright", nil];18.212 + NSArray *values = [NSArray arrayWithObjects: NS_(lxdream_full_version), NS_(lxdream_copyright), nil];18.213 +18.214 + NSDictionary *options= [NSDictionary dictionaryWithObjects: values forKeys: keys];18.215 +18.216 + [NSApp orderFrontStandardAboutPanelWithOptions: options];18.217 +}18.218 +- (void) preferences_action: (id)sender18.219 +{18.220 + cocoa_gui_show_preferences();18.221 +}18.222 +- (void) load_action: (id)sender18.223 +{18.224 + NSOpenPanel *panel = [NSOpenPanel openPanel];18.225 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);18.226 + NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);18.227 + NSArray *fileTypes = [NSArray arrayWithObject: @"dst"];18.228 + int result = [panel runModalForDirectory: path file: nil types: fileTypes];18.229 + if( result == NSOKButton && [[panel filenames] count] > 0 ) {18.230 + NSString *filename = [[panel filenames] objectAtIndex: 0];18.231 + dreamcast_load_state( [filename UTF8String] );18.232 + }18.233 +}18.234 +- (void) save_action: (id)sender18.235 +{18.236 + NSSavePanel *panel = [NSSavePanel savePanel];18.237 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);18.238 + NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);18.239 + [panel setRequiredFileType: @"dst"];18.240 + int result = [panel runModalForDirectory: path file:@""];18.241 + if( result == NSOKButton ) {18.242 + NSString *filename = [panel filename];18.243 + dreamcast_save_state( [filename UTF8String] );18.244 + }18.245 +}18.246 +- (void) load_binary_action: (id)sender18.247 +{18.248 + NSOpenPanel *panel = [NSOpenPanel openPanel];18.249 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);18.250 + NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);18.251 + int result = [panel runModalForDirectory: path file: nil types: nil];18.252 + if( result == NSOKButton && [[panel filenames] count] > 0 ) {18.253 + NSString *filename = [[panel filenames] objectAtIndex: 0];18.254 + file_load_magic( [filename UTF8String] );18.255 + }18.256 +}18.257 +- (void) mount_action: (id)sender18.258 +{18.259 + NSOpenPanel *panel = [NSOpenPanel openPanel];18.260 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);18.261 + NSString *path = (dir == NULL ? NSHomeDirectory() : [NSString stringWithCString: dir]);18.262 + int result = [panel runModalForDirectory: path file: nil types: nil];18.263 + if( result == NSOKButton && [[panel filenames] count] > 0 ) {18.264 + NSString *filename = [[panel filenames] objectAtIndex: 0];18.265 + gdrom_mount_image( [filename UTF8String] );18.266 + }18.267 +}18.268 +- (void) pause_action: (id)sender18.269 +{18.270 + dreamcast_stop();18.271 +}18.272 +18.273 +- (void) reset_action: (id)sender18.274 +{18.275 + dreamcast_reset();18.276 +}18.277 +- (void) run_action: (id)sender18.278 +{18.279 + if( !dreamcast_is_running() ) {18.280 + cocoa_gui_run_later();18.281 + }18.282 +}18.283 +- (void) run_immediate18.284 +{18.285 + dreamcast_run();18.286 + [mainWindow setRunning: NO];18.287 +}18.288 +- (void) gdrom_list_action: (id)sender18.289 +{18.290 + gdrom_list_set_selection( [sender tag] );18.291 +}18.292 +@end18.293 +18.294 +18.295 +gboolean gui_parse_cmdline( int *argc, char **argv[] )18.296 +{18.297 + /* If started from the finder, the first (and only) arg will look something like18.298 + * -psn_0_... - we want to remove this so that lxdream doesn't try to process it18.299 + * normally18.300 + */18.301 + if( *argc == 2 && strncmp((*argv)[1], "-psn_", 5) == 0 ) {18.302 + *argc = 1;18.303 + }18.304 + return TRUE;18.305 +}18.306 +18.307 +gboolean gui_init( gboolean withDebug )18.308 +{18.309 + dreamcast_register_module( &cocoa_gui_module );18.310 +18.311 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];18.312 + [NSApplication sharedApplication];18.313 +18.314 + LxdreamDelegate *delegate = [[LxdreamDelegate alloc] init];18.315 + [NSApp setDelegate: delegate];18.316 + NSString *iconFile = [[NSBundle mainBundle] pathForResource:@"dcemu" ofType:@"gif"];18.317 + NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile: iconFile];18.318 + [iconImage setName: @"NSApplicationIcon"];18.319 + [NSApp setApplicationIconImage: iconImage];18.320 + cocoa_gui_create_menu();18.321 + mainWindow = cocoa_gui_create_main_window();18.322 + [mainWindow makeKeyAndOrderFront: nil];18.323 + [NSApp activateIgnoringOtherApps: YES];18.324 +18.325 + register_gdrom_disc_change_hook( cocoa_gui_disc_changed, mainWindow );18.326 +18.327 + [pool release];18.328 + return TRUE;18.329 +}18.330 +18.331 +void gui_main_loop( gboolean run )18.332 +{18.333 + if( run ) {18.334 + cocoa_gui_autorun = YES;18.335 + }18.336 + cocoa_gui_is_running = YES;18.337 + [NSApp run];18.338 + cocoa_gui_is_running = NO;18.339 +}18.340 +18.341 +void gui_update_state(void)18.342 +{18.343 + cocoa_gui_update();18.344 +}18.345 +18.346 +void gui_set_use_grab( gboolean grab )18.347 +{18.348 + [mainWindow setUseGrab: (grab ? YES : NO)];18.349 +}18.350 +18.351 +gboolean gui_error_dialog( const char *msg, ... )18.352 +{18.353 + if( cocoa_gui_is_running ) {18.354 + NSString *error_string;18.355 +18.356 + va_list args;18.357 + va_start(args, msg);18.358 + error_string = [[NSString alloc] initWithFormat: [NSString stringWithCString: msg] arguments: args];18.359 + NSRunAlertPanel(NS_("Error in Lxdream"), error_string, nil, nil, nil);18.360 + va_end(args);18.361 + return TRUE;18.362 + } else {18.363 + return FALSE;18.364 + }18.365 +}18.366 +18.367 +void gui_update_io_activity( io_activity_type io, gboolean active )18.368 +{18.369 +18.370 +}18.371 +18.372 +18.373 +uint32_t cocoa_gui_run_slice( uint32_t nanosecs )18.374 +{18.375 + NSEvent *event;18.376 + NSAutoreleasePool *pool;18.377 +18.378 + cocoa_gui_nanos += nanosecs;18.379 + if( cocoa_gui_nanos > GUI_TICK_PERIOD ) { /* 10 ms */18.380 + cocoa_gui_nanos -= GUI_TICK_PERIOD;18.381 + cocoa_gui_ticks ++;18.382 + uint32_t current_period = cocoa_gui_ticks * GUI_TICK_PERIOD;18.383 +18.384 + // Run the event loop18.385 + pool = [NSAutoreleasePool new];18.386 + while( (event = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil18.387 + inMode: NSDefaultRunLoopMode dequeue: YES]) != nil ) {18.388 + [NSApp sendEvent: event];18.389 + }18.390 + [pool release];18.391 +18.392 + struct timeval tv;18.393 + gettimeofday(&tv,NULL);18.394 + uint32_t ns = ((tv.tv_sec - cocoa_gui_lasttv.tv_sec) * 1000000000) +18.395 + (tv.tv_usec - cocoa_gui_lasttv.tv_usec)*1000;18.396 + if( (ns * 1.05) < current_period ) {18.397 + // We've gotten ahead - sleep for a little bit18.398 + struct timespec tv;18.399 + tv.tv_sec = 0;18.400 + tv.tv_nsec = current_period - ns;18.401 + nanosleep(&tv, &tv);18.402 + }18.403 +18.404 + /* Update the display every 10 ticks (ie 10 times a second) and18.405 + * save the current tv value */18.406 + if( cocoa_gui_ticks > 10 ) {18.407 + gchar buf[32];18.408 + cocoa_gui_ticks -= 10;18.409 +18.410 + double speed = (float)( (double)current_period * 100.0 / ns );18.411 + cocoa_gui_lasttv.tv_sec = tv.tv_sec;18.412 + cocoa_gui_lasttv.tv_usec = tv.tv_usec;18.413 + snprintf( buf, 32, _("Running (%2.4f%%)"), speed );18.414 + [mainWindow setStatusText: buf];18.415 +18.416 + }18.417 + }18.418 + return nanosecs;18.419 +}18.420 +18.421 +void cocoa_gui_update( void )18.422 +{18.423 +18.424 +}18.425 +18.426 +void cocoa_gui_start( void )18.427 +{18.428 + [mainWindow setRunning: YES];18.429 + cocoa_gui_nanos = 0;18.430 + gettimeofday(&cocoa_gui_lasttv,NULL);18.431 +}18.432 +18.433 +void cocoa_gui_stop( void )18.434 +{18.435 + [mainWindow setRunning: NO];18.436 +}18.437 +18.438 +/**18.439 + * Queue a dreamcast_run() to execute after the currently event(s)18.440 + */18.441 +void cocoa_gui_run_later( void )18.442 +{18.443 + [[NSRunLoop currentRunLoop] performSelector: @selector(run_immediate)18.444 + target: [NSApp delegate] argument: nil order: 118.445 + modes: [NSArray arrayWithObject: NSDefaultRunLoopMode] ];18.446 +}18.447 +18.448 +/*************************** Convenience methods ***************************/18.449 +18.450 +NSImage *NSImage_new_from_framebuffer( frame_buffer_t buffer )18.451 +{18.452 + NSBitmapImageRep *rep =18.453 + [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: &buffer->data18.454 + pixelsWide: buffer->width pixelsHigh: buffer->height18.455 + bitsPerSample: 8 samplesPerPixel: 318.456 + hasAlpha: NO isPlanar: NO18.457 + colorSpaceName: NSDeviceRGBColorSpace bitmapFormat: 018.458 + bytesPerRow: buffer->rowstride bitsPerPixel: 24];18.459 +18.460 + NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize(0.0,0.0)];18.461 + [image addRepresentation: rep];18.462 + return image;18.463 +}18.464 +18.465 +18.466 +NSTextField *cocoa_gui_add_label( NSView *parent, NSString *text, NSRect frame )18.467 +{18.468 + NSTextField *label = [[NSTextField alloc] initWithFrame: frame];18.469 + [label setStringValue: text];18.470 + [label setBordered: NO];18.471 + [label setDrawsBackground: NO];18.472 + [label setEditable: NO];18.473 + [label setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];18.474 + if( parent != NULL ) {18.475 + [parent addSubview: label];18.476 + }18.477 + return label;18.478 +}
19.1 --- a/src/drivers/audio_osx.c Thu Jan 15 03:54:21 2009 +000019.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000019.3 @@ -1,127 +0,0 @@19.4 -/**19.5 - * $Id$19.6 - *19.7 - * The darwin core-audio audio driver19.8 - *19.9 - * Copyright (c) 2008 Nathan Keynes.19.10 - *19.11 - * This program is free software; you can redistribute it and/or modify19.12 - * it under the terms of the GNU General Public License as published by19.13 - * the Free Software Foundation; either version 2 of the License, or19.14 - * (at your option) any later version.19.15 - *19.16 - * This program is distributed in the hope that it will be useful,19.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of19.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19.19 - * GNU General Public License for more details.19.20 - */19.21 -#include <stdio.h>19.22 -#include <unistd.h>19.23 -#include <CoreAudio/CoreAudio.h>19.24 -#include "aica/audio.h"19.25 -#include "lxdream.h"19.26 -19.27 -#define BUFFER_SIZE (sizeof(float)*2*2205)19.28 -19.29 -static AudioDeviceID output_device;19.30 -static volatile audio_buffer_t output_buffer = NULL;19.31 -static uint32_t buffer_size;19.32 -19.33 -OSStatus audio_osx_callback( AudioDeviceID inDevice,19.34 - const AudioTimeStamp *inNow,19.35 - const AudioBufferList *inInputData,19.36 - const AudioTimeStamp *inInputTime,19.37 - AudioBufferList *outOutputData,19.38 - const AudioTimeStamp *inOutputTime,19.39 - void *inClientData)19.40 -{19.41 - char *output = outOutputData->mBuffers[0].mData;19.42 - int data_requested = buffer_size;19.43 -19.44 - while( output_buffer != NULL && data_requested > 0 ) {19.45 - int copysize = output_buffer->length - output_buffer->posn;19.46 - if( copysize > data_requested ) {19.47 - copysize = data_requested;19.48 - }19.49 - memcpy( output, &output_buffer->data[output_buffer->posn], copysize );19.50 - output += copysize;19.51 - data_requested -= copysize;19.52 - output_buffer->posn += copysize;19.53 - if( output_buffer->posn >= output_buffer->length ) {19.54 - output_buffer = audio_next_read_buffer();19.55 - }19.56 - }19.57 - if( data_requested > 0 ) {19.58 - memset( output, 0, data_requested );19.59 - }19.60 - return noErr;19.61 -}19.62 -19.63 -static gboolean audio_osx_shutdown()19.64 -{19.65 - AudioDeviceStop( output_device, audio_osx_callback );19.66 - AudioDeviceRemoveIOProc( output_device, audio_osx_callback );19.67 - return TRUE;19.68 -}19.69 -19.70 -static gboolean audio_osx_init()19.71 -{19.72 - UInt32 size = sizeof(output_device);19.73 - AudioStreamBasicDescription outputDesc;19.74 - UInt32 outputDescSize = sizeof(outputDesc);19.75 -19.76 - if( AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,19.77 - &size, &output_device) != noErr ||19.78 - output_device == kAudioDeviceUnknown ) {19.79 - return FALSE;19.80 - }19.81 -19.82 - if( AudioDeviceGetProperty( output_device, 1, 0, kAudioDevicePropertyStreamFormat,19.83 - &outputDescSize, &outputDesc ) != noErr ) {19.84 - return FALSE;19.85 - }19.86 -19.87 - buffer_size = BUFFER_SIZE;19.88 -19.89 - if( AudioDeviceSetProperty( output_device, 0, 0, 0, kAudioDevicePropertyBufferSize,19.90 - sizeof(buffer_size), &buffer_size ) != noErr ) {19.91 - return FALSE;19.92 - }19.93 -19.94 - AudioDeviceAddIOProc( output_device, audio_osx_callback, NULL );19.95 - return TRUE;19.96 -}19.97 -static gboolean audio_osx_process_buffer( audio_buffer_t buffer )19.98 -{19.99 - if( output_buffer == NULL ) {19.100 - output_buffer = buffer;19.101 - output_buffer->posn = 0;19.102 - AudioDeviceStart(output_device, audio_osx_callback);19.103 - }19.104 - return FALSE;19.105 -}19.106 -19.107 -void audio_osx_start()19.108 -{19.109 - if( output_buffer != NULL ) {19.110 - AudioDeviceStart(output_device, audio_osx_callback);19.111 - }19.112 -}19.113 -19.114 -void audio_osx_stop()19.115 -{19.116 - AudioDeviceStop( output_device, audio_osx_callback );19.117 -}19.118 -19.119 -19.120 -struct audio_driver audio_osx_driver = {19.121 - "osx",19.122 - N_("OS X CoreAudio system driver"),19.123 - DEFAULT_SAMPLE_RATE,19.124 - AUDIO_FMT_FLOATST,19.125 - audio_osx_init,19.126 - audio_osx_start,19.127 - audio_osx_process_buffer,19.128 - audio_osx_stop,19.129 - audio_osx_shutdown};19.130 -
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000020.2 +++ b/src/drivers/audio_osx.m Thu Jan 15 04:15:11 2009 +000020.3 @@ -0,0 +1,127 @@20.4 +/**20.5 + * $Id$20.6 + *20.7 + * The darwin core-audio audio driver20.8 + *20.9 + * Copyright (c) 2008 Nathan Keynes.20.10 + *20.11 + * This program is free software; you can redistribute it and/or modify20.12 + * it under the terms of the GNU General Public License as published by20.13 + * the Free Software Foundation; either version 2 of the License, or20.14 + * (at your option) any later version.20.15 + *20.16 + * This program is distributed in the hope that it will be useful,20.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of20.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20.19 + * GNU General Public License for more details.20.20 + */20.21 +#include <stdio.h>20.22 +#include <unistd.h>20.23 +#include <CoreAudio/CoreAudio.h>20.24 +#include "aica/audio.h"20.25 +#include "lxdream.h"20.26 +20.27 +#define BUFFER_SIZE (sizeof(float)*2*2205)20.28 +20.29 +static AudioDeviceID output_device;20.30 +static volatile audio_buffer_t output_buffer = NULL;20.31 +static uint32_t buffer_size;20.32 +20.33 +OSStatus audio_osx_callback( AudioDeviceID inDevice,20.34 + const AudioTimeStamp *inNow,20.35 + const AudioBufferList *inInputData,20.36 + const AudioTimeStamp *inInputTime,20.37 + AudioBufferList *outOutputData,20.38 + const AudioTimeStamp *inOutputTime,20.39 + void *inClientData)20.40 +{20.41 + char *output = outOutputData->mBuffers[0].mData;20.42 + int data_requested = buffer_size;20.43 +20.44 + while( output_buffer != NULL && data_requested > 0 ) {20.45 + int copysize = output_buffer->length - output_buffer->posn;20.46 + if( copysize > data_requested ) {20.47 + copysize = data_requested;20.48 + }20.49 + memcpy( output, &output_buffer->data[output_buffer->posn], copysize );20.50 + output += copysize;20.51 + data_requested -= copysize;20.52 + output_buffer->posn += copysize;20.53 + if( output_buffer->posn >= output_buffer->length ) {20.54 + output_buffer = audio_next_read_buffer();20.55 + }20.56 + }20.57 + if( data_requested > 0 ) {20.58 + memset( output, 0, data_requested );20.59 + }20.60 + return noErr;20.61 +}20.62 +20.63 +static gboolean audio_osx_shutdown()20.64 +{20.65 + AudioDeviceStop( output_device, audio_osx_callback );20.66 + AudioDeviceRemoveIOProc( output_device, audio_osx_callback );20.67 + return TRUE;20.68 +}20.69 +20.70 +static gboolean audio_osx_init()20.71 +{20.72 + UInt32 size = sizeof(output_device);20.73 + AudioStreamBasicDescription outputDesc;20.74 + UInt32 outputDescSize = sizeof(outputDesc);20.75 +20.76 + if( AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,20.77 + &size, &output_device) != noErr ||20.78 + output_device == kAudioDeviceUnknown ) {20.79 + return FALSE;20.80 + }20.81 +20.82 + if( AudioDeviceGetProperty( output_device, 1, 0, kAudioDevicePropertyStreamFormat,20.83 + &outputDescSize, &outputDesc ) != noErr ) {20.84 + return FALSE;20.85 + }20.86 +20.87 + buffer_size = BUFFER_SIZE;20.88 +20.89 + if( AudioDeviceSetProperty( output_device, 0, 0, 0, kAudioDevicePropertyBufferSize,20.90 + sizeof(buffer_size), &buffer_size ) != noErr ) {20.91 + return FALSE;20.92 + }20.93 +20.94 + AudioDeviceAddIOProc( output_device, audio_osx_callback, NULL );20.95 + return TRUE;20.96 +}20.97 +static gboolean audio_osx_process_buffer( audio_buffer_t buffer )20.98 +{20.99 + if( output_buffer == NULL ) {20.100 + output_buffer = buffer;20.101 + output_buffer->posn = 0;20.102 + AudioDeviceStart(output_device, audio_osx_callback);20.103 + }20.104 + return FALSE;20.105 +}20.106 +20.107 +void audio_osx_start()20.108 +{20.109 + if( output_buffer != NULL ) {20.110 + AudioDeviceStart(output_device, audio_osx_callback);20.111 + }20.112 +}20.113 +20.114 +void audio_osx_stop()20.115 +{20.116 + AudioDeviceStop( output_device, audio_osx_callback );20.117 +}20.118 +20.119 +20.120 +struct audio_driver audio_osx_driver = {20.121 + "osx",20.122 + N_("OS X CoreAudio system driver"),20.123 + DEFAULT_SAMPLE_RATE,20.124 + AUDIO_FMT_FLOATST,20.125 + audio_osx_init,20.126 + audio_osx_start,20.127 + audio_osx_process_buffer,20.128 + audio_osx_stop,20.129 + audio_osx_shutdown};20.130 +
21.1 --- a/src/drivers/osx_iokit.c Thu Jan 15 03:54:21 2009 +000021.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000021.3 @@ -1,356 +0,0 @@21.4 -/**21.5 - * $Id$21.6 - *21.7 - * OSX support functions for handling the IOKit registry.21.8 - * Currently this manages access to CD/DVD drives + media, plus HID devices.21.9 - *21.10 - * The HID part is much simpler...21.11 - *21.12 - * Copyright (c) 2008 Nathan Keynes.21.13 - *21.14 - * This program is free software; you can redistribute it and/or modify21.15 - * it under the terms of the GNU General Public License as published by21.16 - * the Free Software Foundation; either version 2 of the License, or21.17 - * (at your option) any later version.21.18 - *21.19 - * This program is distributed in the hope that it will be useful,21.20 - * but WITHOUT ANY WARRANTY; without even the implied warranty of21.21 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21.22 - * GNU General Public License for more details.21.23 - */21.24 -21.25 -#include <glib/gmem.h>21.26 -#include <glib/gstrfuncs.h>21.27 -#include <sys/param.h>21.28 -#include <paths.h>21.29 -#include <string.h>21.30 -#include <unistd.h>21.31 -#include <stdio.h>21.32 -#include <fcntl.h>21.33 -#include <CoreFoundation/CFRunLoop.h>21.34 -#include <IOKit/IOMessage.h>21.35 -#include <IOKit/hid/IOHIDLib.h>21.36 -#include "osx_iokit.h"21.37 -21.38 -21.39 -21.40 -static IONotificationPortRef notify_port = 0;21.41 -static io_iterator_t iokit_iterators[4] = {0,0,0,0};21.42 -21.43 -struct osx_cdrom_drive {21.44 - io_string_t ioservice_path;21.45 - io_string_t vendor_name;21.46 - io_string_t product_name;21.47 - char media_path[MAXPATHLEN]; // BSD device path if media present, otherwise the empty string.21.48 - io_iterator_t media_load_iterator;21.49 - io_iterator_t media_unload_iterator;21.50 - int media_fh; // BSD device handle if open, otherwise -121.51 - media_changed_callback_t media_changed;21.52 - void *media_changed_user_data;21.53 -};21.54 -21.55 -static gboolean get_bsdname_for_iomedia( io_object_t iomedia, char *buf, int buflen );21.56 -21.57 -/***************** IOKit Callbacks ******************/21.58 -21.59 -/**21.60 - * Called from IOKit for any IOMessages on an IOMedia. Currently the only message21.61 - * we're interested in is service termination.21.62 - */21.63 -static void osx_cdrom_media_notify( void *ref, io_service_t service, uint32_t msgType,21.64 - void *msgArgument )21.65 -{21.66 - if( msgType == kIOMessageServiceIsTerminated ) {21.67 - osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;21.68 - if( drive->media_changed != NULL ) {21.69 - drive->media_changed( drive, FALSE, drive->media_changed_user_data );21.70 - }21.71 - if( drive->media_fh != -1 ) {21.72 - close(drive->media_fh);21.73 - drive->media_fh = -1;21.74 - }21.75 - drive->media_path[0] = '\0';21.76 - IOObjectRelease( drive->media_unload_iterator );21.77 - }21.78 -}21.79 -21.80 -/**21.81 - * Called from IOKit when an IOMedia is inserted that we have be interested in.21.82 - * FIXME: Can the matcher be restricted to descendents of the drive node? currently21.83 - * we watch for all IOMedia events and compare the device path to see if it's one we21.84 - * care about.21.85 - * FIXME: We assume for now that a drive has at most one piece of media at a time.21.86 - * If this isn't the case, the system may get a little confused.21.87 - */21.88 -static void osx_cdrom_media_inserted( void *ref, io_iterator_t iterator )21.89 -{21.90 - osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;21.91 -21.92 - io_object_t object;21.93 - while( (object = IOIteratorNext(iterator)) != 0 ) {21.94 - io_string_t iopath = "";21.95 - IORegistryEntryGetPath( object, kIOServicePlane, iopath );21.96 - if( drive != NULL && g_str_has_prefix(iopath, drive->ioservice_path ) &&21.97 - get_bsdname_for_iomedia(object, drive->media_path, sizeof(drive->media_path)) ) {21.98 - // A disc was inserted within the drive of interest21.99 - if( drive->media_fh != -1 ) {21.100 - close(drive->media_fh);21.101 - drive->media_fh = -1;21.102 - }21.103 -21.104 - if( drive->media_changed != NULL ) {21.105 - drive->media_changed(drive, TRUE, drive->media_changed_user_data);21.106 - }21.107 - // Add a notification listener to get removal events.21.108 - IOServiceAddInterestNotification( notify_port, object, kIOGeneralInterest,21.109 - osx_cdrom_media_notify, drive, &drive->media_unload_iterator );21.110 -21.111 - }21.112 - IOObjectRelease( object );21.113 - }21.114 -}21.115 -21.116 -static void osx_drives_changed( void *ref, io_iterator_t iterator )21.117 -{21.118 - io_object_t object;21.119 - while( (object = IOIteratorNext(iterator)) != 0 ) {21.120 - IOObjectRelease(object);21.121 - }21.122 -21.123 -}21.124 -21.125 -/******************** Support functions *********************/21.126 -21.127 -/**21.128 - * Determine the BSD device name (ie "/dev/rdisk1") for a given IO object.21.129 - * @return TRUE if the device name was retrieved, FALSE if the request failed.21.130 - */21.131 -static gboolean get_bsdname_for_iomedia( io_object_t iomedia, char *buf, int buflen )21.132 -{21.133 - gboolean result = FALSE;21.134 - CFTypeRef pathRef = IORegistryEntryCreateCFProperty(iomedia, CFSTR(kIOBSDNameKey),21.135 - kCFAllocatorDefault, 0 );21.136 - if( pathRef ) {21.137 - char pathlen;21.138 - strcpy( buf, _PATH_DEV "r" );21.139 - pathlen = strlen(buf);21.140 - if( CFStringGetCString( pathRef, buf + pathlen, buflen-pathlen,21.141 - kCFStringEncodingASCII ) != noErr ) {21.142 - result = TRUE;21.143 - }21.144 - CFRelease(pathRef);21.145 - }21.146 - return result;21.147 -}21.148 -21.149 -static gboolean osx_cdrom_drive_get_name( io_object_t object, char *vendor, int vendor_len,21.150 - char *product, int product_len )21.151 -{21.152 - gboolean result = FALSE;21.153 - CFMutableDictionaryRef props = 0;21.154 - if( IORegistryEntryCreateCFProperties(object, &props, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS ) {21.155 - CFDictionaryRef dict =21.156 - (CFDictionaryRef)CFDictionaryGetValue(props, CFSTR(kIOPropertyDeviceCharacteristicsKey));21.157 - if( dict != NULL ) {21.158 - CFTypeRef value = CFDictionaryGetValue(dict, CFSTR(kIOPropertyVendorNameKey));21.159 - if( value && CFGetTypeID(value) == CFStringGetTypeID() ) {21.160 - CFStringGetCString( (CFStringRef)value, vendor, vendor_len, kCFStringEncodingUTF8 );21.161 - } else {21.162 - vendor[0] = 0;21.163 - }21.164 -21.165 - value = CFDictionaryGetValue(dict, CFSTR(kIOPropertyProductNameKey));21.166 - if ( value && CFGetTypeID(value) == CFStringGetTypeID() ) {21.167 - CFStringGetCString( (CFStringRef)value, product, product_len, kCFStringEncodingUTF8 );21.168 - } else {21.169 - product[0] = 0;21.170 - }21.171 - result = TRUE;21.172 - }21.173 -21.174 - CFRelease(props);21.175 - }21.176 - return result;21.177 -}21.178 -21.179 -/**21.180 - * Construct and initialize a new osx_cdrom_drive object, including registering21.181 - * it's media inserted notification.21.182 - */21.183 -static osx_cdrom_drive_t osx_cdrom_drive_new( io_object_t device )21.184 -{21.185 - osx_cdrom_drive_t drive = g_malloc0(sizeof(struct osx_cdrom_drive));21.186 -21.187 - IORegistryEntryGetPath( device, kIOServicePlane, drive->ioservice_path );21.188 - osx_cdrom_drive_get_name( device, drive->vendor_name, sizeof(drive->vendor_name),21.189 - drive->product_name, sizeof(drive->product_name) );21.190 - drive->media_path[0] = '\0';21.191 - drive->media_changed = NULL;21.192 - drive->media_changed_user_data = NULL;21.193 - drive->media_fh = -1;21.194 -21.195 - IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,21.196 - IOServiceMatching("IOMedia"),21.197 - osx_cdrom_media_inserted, drive,21.198 - &drive->media_load_iterator );21.199 - osx_cdrom_media_inserted( drive, drive->media_load_iterator );21.200 - return drive;21.201 -}21.202 -21.203 -/************************ Exported functions *************************/21.204 -21.205 -osx_cdrom_drive_t osx_cdrom_open_drive( const char *devname )21.206 -{21.207 - io_object_t object = IORegistryEntryFromPath( kIOMasterPortDefault, devname );21.208 - if( object == MACH_PORT_NULL ) {21.209 - return NULL;21.210 - }21.211 -21.212 - osx_cdrom_drive_t drive = osx_cdrom_drive_new( object );21.213 - IOObjectRelease( object );21.214 - return drive;21.215 -}21.216 -21.217 -void osx_cdrom_set_media_changed_callback( osx_cdrom_drive_t drive,21.218 - media_changed_callback_t callback,21.219 - void *user_data )21.220 -{21.221 - drive->media_changed = callback;21.222 - drive->media_changed_user_data = user_data;21.223 -}21.224 -21.225 -void osx_cdrom_close_drive( osx_cdrom_drive_t drive )21.226 -{21.227 - IOObjectRelease( drive->media_load_iterator );21.228 - IOObjectRelease( drive->media_unload_iterator );21.229 - if( drive->media_fh != -1 ) {21.230 - close(drive->media_fh);21.231 - drive->media_fh = -1;21.232 - }21.233 - g_free( drive );21.234 -}21.235 -21.236 -int osx_cdrom_get_media_handle( osx_cdrom_drive_t drive )21.237 -{21.238 - if( drive->media_fh == -1 ) {21.239 - if( drive->media_path[0] != '\0' ) {21.240 - drive->media_fh = open( drive->media_path, O_RDONLY|O_NONBLOCK );21.241 - }21.242 - }21.243 - return drive->media_fh;21.244 -}21.245 -21.246 -void osx_cdrom_release_media_handle( osx_cdrom_drive_t drive )21.247 -{21.248 - if( drive->media_fh != -1 ) {21.249 - close( drive->media_fh );21.250 - drive->media_fh = -1;21.251 - }21.252 -}21.253 -21.254 -static io_object_t iterator_find_cdrom( io_object_t iterator, find_drive_callback_t callback, void *user_data )21.255 -{21.256 - io_object_t object;21.257 - while( (object = IOIteratorNext(iterator)) != 0 ) {21.258 - io_string_t iopath = "";21.259 - char product[256], vendor[256];21.260 - IORegistryEntryGetPath( object, kIOServicePlane, iopath );21.261 - osx_cdrom_drive_get_name( object, vendor, sizeof(vendor), product, sizeof(product) );21.262 - if( callback( object, vendor, product, iopath, user_data ) ) {21.263 - IOObjectRelease(iterator);21.264 - return object;21.265 - }21.266 - IOObjectRelease(object);21.267 - }21.268 - IOObjectRelease(iterator);21.269 - return 0;21.270 -}21.271 -21.272 -21.273 -/**21.274 - * Search for a CD or DVD drive (instance of IODVDServices or IOCompactDiscServices).21.275 - * The callback will be called repeatedly until either it returns TRUE, or all drives21.276 - * have been iterated over.21.277 - *21.278 - * @return an IO registry entry for the matched drive, or 0 if no drives matched.21.279 - *21.280 - * Note: Use of IOCompactDiscServices is somewhat tentative since I don't have a Mac21.281 - * with a CD-Rom drive.21.282 - */21.283 -io_object_t find_cdrom_drive( find_drive_callback_t callback, void *user_data )21.284 -{21.285 - mach_port_t master_port;21.286 - CFMutableDictionaryRef match;21.287 - io_iterator_t services;21.288 - io_object_t result;21.289 -21.290 - if( IOMasterPort( MACH_PORT_NULL, &master_port ) != KERN_SUCCESS ) {21.291 - return 0; // Failed to get the master port?21.292 - }21.293 -21.294 - match = IOServiceMatching("IODVDServices");21.295 - if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {21.296 - return 0;21.297 - }21.298 -21.299 - result = iterator_find_cdrom( services, callback, user_data );21.300 - if( result != 0 ) {21.301 - return result;21.302 - }21.303 -21.304 - match = IOServiceMatching("IOCompactDiscServices");21.305 - if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {21.306 - return 0;21.307 - }21.308 - return iterator_find_cdrom( services, callback, user_data );21.309 -}21.310 -21.311 -21.312 -// *********************** Notification management ************************/21.313 -21.314 -static void osx_hid_inserted( void *ref, io_iterator_t iterator )21.315 -{21.316 - io_object_t object;21.317 - while( (object = IOIteratorNext(iterator)) != 0 ) {21.318 - io_string_t iopath = "";21.319 - IORegistryEntryGetPath( object, kIOServicePlane, iopath );21.320 - IOObjectRelease( object );21.321 - }21.322 -}21.323 -21.324 -gboolean osx_register_iokit_notifications()21.325 -{21.326 - notify_port = IONotificationPortCreate( kIOMasterPortDefault );21.327 - CFRunLoopSourceRef runloop_source = IONotificationPortGetRunLoopSource( notify_port );21.328 - CFRunLoopAddSource( CFRunLoopGetCurrent(), runloop_source, kCFRunLoopCommonModes );21.329 -21.330 - // Drive notifications21.331 - if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,21.332 - IOServiceMatching("IOCompactDiscServies"),21.333 - osx_drives_changed, NULL, &iokit_iterators[0] ) != kIOReturnSuccess ) {21.334 - ERROR( "IOServiceAddMatchingNotification failed" );21.335 - }21.336 - osx_drives_changed(NULL, iokit_iterators[0]);21.337 - if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,21.338 - IOServiceMatching("IODVDServies"),21.339 - osx_drives_changed, NULL, &iokit_iterators[1] ) != kIOReturnSuccess ) {21.340 - ERROR( "IOServiceAddMatchingNotification failed" );21.341 - }21.342 - osx_drives_changed(NULL, iokit_iterators[1]);21.343 -21.344 - if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,21.345 - IOServiceMatching(kIOHIDDeviceKey),21.346 - osx_hid_inserted, NULL, &iokit_iterators[2] ) != kIOReturnSuccess ) {21.347 - ERROR( "IOServiceAddMatchingNotification failed" );21.348 - }21.349 - osx_hid_inserted(NULL, iokit_iterators[2]);21.350 - return TRUE;21.351 -}21.352 -21.353 -void osx_unregister_iokit_notifications()21.354 -{21.355 - CFRunLoopSourceRef runloop_source = IONotificationPortGetRunLoopSource( notify_port );21.356 - CFRunLoopRemoveSource( CFRunLoopGetCurrent(), runloop_source, kCFRunLoopCommonModes );21.357 - IONotificationPortDestroy( notify_port );21.358 - notify_port = 0;21.359 -}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000022.2 +++ b/src/drivers/osx_iokit.m Thu Jan 15 04:15:11 2009 +000022.3 @@ -0,0 +1,356 @@22.4 +/**22.5 + * $Id$22.6 + *22.7 + * OSX support functions for handling the IOKit registry.22.8 + * Currently this manages access to CD/DVD drives + media, plus HID devices.22.9 + *22.10 + * The HID part is much simpler...22.11 + *22.12 + * Copyright (c) 2008 Nathan Keynes.22.13 + *22.14 + * This program is free software; you can redistribute it and/or modify22.15 + * it under the terms of the GNU General Public License as published by22.16 + * the Free Software Foundation; either version 2 of the License, or22.17 + * (at your option) any later version.22.18 + *22.19 + * This program is distributed in the hope that it will be useful,22.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of22.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22.22 + * GNU General Public License for more details.22.23 + */22.24 +22.25 +#include <glib/gmem.h>22.26 +#include <glib/gstrfuncs.h>22.27 +#include <sys/param.h>22.28 +#include <paths.h>22.29 +#include <string.h>22.30 +#include <unistd.h>22.31 +#include <stdio.h>22.32 +#include <fcntl.h>22.33 +#include <CoreFoundation/CFRunLoop.h>22.34 +#include <IOKit/IOMessage.h>22.35 +#include <IOKit/hid/IOHIDLib.h>22.36 +#include "osx_iokit.h"22.37 +22.38 +22.39 +22.40 +static IONotificationPortRef notify_port = 0;22.41 +static io_iterator_t iokit_iterators[4] = {0,0,0,0};22.42 +22.43 +struct osx_cdrom_drive {22.44 + io_string_t ioservice_path;22.45 + io_string_t vendor_name;22.46 + io_string_t product_name;22.47 + char media_path[MAXPATHLEN]; // BSD device path if media present, otherwise the empty string.22.48 + io_iterator_t media_load_iterator;22.49 + io_iterator_t media_unload_iterator;22.50 + int media_fh; // BSD device handle if open, otherwise -122.51 + media_changed_callback_t media_changed;22.52 + void *media_changed_user_data;22.53 +};22.54 +22.55 +static gboolean get_bsdname_for_iomedia( io_object_t iomedia, char *buf, int buflen );22.56 +22.57 +/***************** IOKit Callbacks ******************/22.58 +22.59 +/**22.60 + * Called from IOKit for any IOMessages on an IOMedia. Currently the only message22.61 + * we're interested in is service termination.22.62 + */22.63 +static void osx_cdrom_media_notify( void *ref, io_service_t service, uint32_t msgType,22.64 + void *msgArgument )22.65 +{22.66 + if( msgType == kIOMessageServiceIsTerminated ) {22.67 + osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;22.68 + if( drive->media_changed != NULL ) {22.69 + drive->media_changed( drive, FALSE, drive->media_changed_user_data );22.70 + }22.71 + if( drive->media_fh != -1 ) {22.72 + close(drive->media_fh);22.73 + drive->media_fh = -1;22.74 + }22.75 + drive->media_path[0] = '\0';22.76 + IOObjectRelease( drive->media_unload_iterator );22.77 + }22.78 +}22.79 +22.80 +/**22.81 + * Called from IOKit when an IOMedia is inserted that we have be interested in.22.82 + * FIXME: Can the matcher be restricted to descendents of the drive node? currently22.83 + * we watch for all IOMedia events and compare the device path to see if it's one we22.84 + * care about.22.85 + * FIXME: We assume for now that a drive has at most one piece of media at a time.22.86 + * If this isn't the case, the system may get a little confused.22.87 + */22.88 +static void osx_cdrom_media_inserted( void *ref, io_iterator_t iterator )22.89 +{22.90 + osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;22.91 +22.92 + io_object_t object;22.93 + while( (object = IOIteratorNext(iterator)) != 0 ) {22.94 + io_string_t iopath = "";22.95 + IORegistryEntryGetPath( object, kIOServicePlane, iopath );22.96 + if( drive != NULL && g_str_has_prefix(iopath, drive->ioservice_path ) &&22.97 + get_bsdname_for_iomedia(object, drive->media_path, sizeof(drive->media_path)) ) {22.98 + // A disc was inserted within the drive of interest22.99 + if( drive->media_fh != -1 ) {22.100 + close(drive->media_fh);22.101 + drive->media_fh = -1;22.102 + }22.103 +22.104 + if( drive->media_changed != NULL ) {22.105 + drive->media_changed(drive, TRUE, drive->media_changed_user_data);22.106 + }22.107 + // Add a notification listener to get removal events.22.108 + IOServiceAddInterestNotification( notify_port, object, kIOGeneralInterest,22.109 + osx_cdrom_media_notify, drive, &drive->media_unload_iterator );22.110 +22.111 + }22.112 + IOObjectRelease( object );22.113 + }22.114 +}22.115 +22.116 +static void osx_drives_changed( void *ref, io_iterator_t iterator )22.117 +{22.118 + io_object_t object;22.119 + while( (object = IOIteratorNext(iterator)) != 0 ) {22.120 + IOObjectRelease(object);22.121 + }22.122 +22.123 +}22.124 +22.125 +/******************** Support functions *********************/22.126 +22.127 +/**22.128 + * Determine the BSD device name (ie "/dev/rdisk1") for a given IO object.22.129 + * @return TRUE if the device name was retrieved, FALSE if the request failed.22.130 + */22.131 +static gboolean get_bsdname_for_iomedia( io_object_t iomedia, char *buf, int buflen )22.132 +{22.133 + gboolean result = FALSE;22.134 + CFTypeRef pathRef = IORegistryEntryCreateCFProperty(iomedia, CFSTR(kIOBSDNameKey),22.135 + kCFAllocatorDefault, 0 );22.136 + if( pathRef ) {22.137 + char pathlen;22.138 + strcpy( buf, _PATH_DEV "r" );22.139 + pathlen = strlen(buf);22.140 + if( CFStringGetCString( pathRef, buf + pathlen, buflen-pathlen,22.141 + kCFStringEncodingASCII ) != noErr ) {22.142 + result = TRUE;22.143 + }22.144 + CFRelease(pathRef);22.145 + }22.146 + return result;22.147 +}22.148 +22.149 +static gboolean osx_cdrom_drive_get_name( io_object_t object, char *vendor, int vendor_len,22.150 + char *product, int product_len )22.151 +{22.152 + gboolean result = FALSE;22.153 + CFMutableDictionaryRef props = 0;22.154 + if( IORegistryEntryCreateCFProperties(object, &props, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS ) {22.155 + CFDictionaryRef dict =22.156 + (CFDictionaryRef)CFDictionaryGetValue(props, CFSTR(kIOPropertyDeviceCharacteristicsKey));22.157 + if( dict != NULL ) {22.158 + CFTypeRef value = CFDictionaryGetValue(dict, CFSTR(kIOPropertyVendorNameKey));22.159 + if( value && CFGetTypeID(value) == CFStringGetTypeID() ) {22.160 + CFStringGetCString( (CFStringRef)value, vendor, vendor_len, kCFStringEncodingUTF8 );22.161 + } else {22.162 + vendor[0] = 0;22.163 + }22.164 +22.165 + value = CFDictionaryGetValue(dict, CFSTR(kIOPropertyProductNameKey));22.166 + if ( value && CFGetTypeID(value) == CFStringGetTypeID() ) {22.167 + CFStringGetCString( (CFStringRef)value, product, product_len, kCFStringEncodingUTF8 );22.168 + } else {22.169 + product[0] = 0;22.170 + }22.171 + result = TRUE;22.172 + }22.173 +22.174 + CFRelease(props);22.175 + }22.176 + return result;22.177 +}22.178 +22.179 +/**22.180 + * Construct and initialize a new osx_cdrom_drive object, including registering22.181 + * it's media inserted notification.22.182 + */22.183 +static osx_cdrom_drive_t osx_cdrom_drive_new( io_object_t device )22.184 +{22.185 + osx_cdrom_drive_t drive = g_malloc0(sizeof(struct osx_cdrom_drive));22.186 +22.187 + IORegistryEntryGetPath( device, kIOServicePlane, drive->ioservice_path );22.188 + osx_cdrom_drive_get_name( device, drive->vendor_name, sizeof(drive->vendor_name),22.189 + drive->product_name, sizeof(drive->product_name) );22.190 + drive->media_path[0] = '\0';22.191 + drive->media_changed = NULL;22.192 + drive->media_changed_user_data = NULL;22.193 + drive->media_fh = -1;22.194 +22.195 + IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,22.196 + IOServiceMatching("IOMedia"),22.197 + osx_cdrom_media_inserted, drive,22.198 + &drive->media_load_iterator );22.199 + osx_cdrom_media_inserted( drive, drive->media_load_iterator );22.200 + return drive;22.201 +}22.202 +22.203 +/************************ Exported functions *************************/22.204 +22.205 +osx_cdrom_drive_t osx_cdrom_open_drive( const char *devname )22.206 +{22.207 + io_object_t object = IORegistryEntryFromPath( kIOMasterPortDefault, devname );22.208 + if( object == MACH_PORT_NULL ) {22.209 + return NULL;22.210 + }22.211 +22.212 + osx_cdrom_drive_t drive = osx_cdrom_drive_new( object );22.213 + IOObjectRelease( object );22.214 + return drive;22.215 +}22.216 +22.217 +void osx_cdrom_set_media_changed_callback( osx_cdrom_drive_t drive,22.218 + media_changed_callback_t callback,22.219 + void *user_data )22.220 +{22.221 + drive->media_changed = callback;22.222 + drive->media_changed_user_data = user_data;22.223 +}22.224 +22.225 +void osx_cdrom_close_drive( osx_cdrom_drive_t drive )22.226 +{22.227 + IOObjectRelease( drive->media_load_iterator );22.228 + IOObjectRelease( drive->media_unload_iterator );22.229 + if( drive->media_fh != -1 ) {22.230 + close(drive->media_fh);22.231 + drive->media_fh = -1;22.232 + }22.233 + g_free( drive );22.234 +}22.235 +22.236 +int osx_cdrom_get_media_handle( osx_cdrom_drive_t drive )22.237 +{22.238 + if( drive->media_fh == -1 ) {22.239 + if( drive->media_path[0] != '\0' ) {22.240 + drive->media_fh = open( drive->media_path, O_RDONLY|O_NONBLOCK );22.241 + }22.242 + }22.243 + return drive->media_fh;22.244 +}22.245 +22.246 +void osx_cdrom_release_media_handle( osx_cdrom_drive_t drive )22.247 +{22.248 + if( drive->media_fh != -1 ) {22.249 + close( drive->media_fh );22.250 + drive->media_fh = -1;22.251 + }22.252 +}22.253 +22.254 +static io_object_t iterator_find_cdrom( io_object_t iterator, find_drive_callback_t callback, void *user_data )22.255 +{22.256 + io_object_t object;22.257 + while( (object = IOIteratorNext(iterator)) != 0 ) {22.258 + io_string_t iopath = "";22.259 + char product[256], vendor[256];22.260 + IORegistryEntryGetPath( object, kIOServicePlane, iopath );22.261 + osx_cdrom_drive_get_name( object, vendor, sizeof(vendor), product, sizeof(product) );22.262 + if( callback( object, vendor, product, iopath, user_data ) ) {22.263 + IOObjectRelease(iterator);22.264 + return object;22.265 + }22.266 + IOObjectRelease(object);22.267 + }22.268 + IOObjectRelease(iterator);22.269 + return 0;22.270 +}22.271 +22.272 +22.273 +/**22.274 + * Search for a CD or DVD drive (instance of IODVDServices or IOCompactDiscServices).22.275 + * The callback will be called repeatedly until either it returns TRUE, or all drives22.276 + * have been iterated over.22.277 + *22.278 + * @return an IO registry entry for the matched drive, or 0 if no drives matched.22.279 + *22.280 + * Note: Use of IOCompactDiscServices is somewhat tentative since I don't have a Mac22.281 + * with a CD-Rom drive.22.282 + */22.283 +io_object_t find_cdrom_drive( find_drive_callback_t callback, void *user_data )22.284 +{22.285 + mach_port_t master_port;22.286 + CFMutableDictionaryRef match;22.287 + io_iterator_t services;22.288 + io_object_t result;22.289 +22.290 + if( IOMasterPort( MACH_PORT_NULL, &master_port ) != KERN_SUCCESS ) {22.291 + return 0; // Failed to get the master port?22.292 + }22.293 +22.294 + match = IOServiceMatching("IODVDServices");22.295 + if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {22.296 + return 0;22.297 + }22.298 +22.299 + result = iterator_find_cdrom( services, callback, user_data );22.300 + if( result != 0 ) {22.301 + return result;22.302 + }22.303 +22.304 + match = IOServiceMatching("IOCompactDiscServices");22.305 + if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {22.306 + return 0;22.307 + }22.308 + return iterator_find_cdrom( services, callback, user_data );22.309 +}22.310 +22.311 +22.312 +// *********************** Notification management ************************/22.313 +22.314 +static void osx_hid_inserted( void *ref, io_iterator_t iterator )22.315 +{22.316 + io_object_t object;22.317 + while( (object = IOIteratorNext(iterator)) != 0 ) {22.318 + io_string_t iopath = "";22.319 + IORegistryEntryGetPath( object, kIOServicePlane, iopath );22.320 + IOObjectRelease( object );22.321 + }22.322 +}22.323 +22.324 +gboolean osx_register_iokit_notifications()22.325 +{22.326 + notify_port = IONotificationPortCreate( kIOMasterPortDefault );22.327 + CFRunLoopSourceRef runloop_source = IONotificationPortGetRunLoopSource( notify_port );22.328 + CFRunLoopAddSource( CFRunLoopGetCurrent(), runloop_source, kCFRunLoopCommonModes );22.329 +22.330 + // Drive notifications22.331 + if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,22.332 + IOServiceMatching("IOCompactDiscServies"),22.333 + osx_drives_changed, NULL, &iokit_iterators[0] ) != kIOReturnSuccess ) {22.334 + ERROR( "IOServiceAddMatchingNotification failed" );22.335 + }22.336 + osx_drives_changed(NULL, iokit_iterators[0]);22.337 + if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,22.338 + IOServiceMatching("IODVDServies"),22.339 + osx_drives_changed, NULL, &iokit_iterators[1] ) != kIOReturnSuccess ) {22.340 + ERROR( "IOServiceAddMatchingNotification failed" );22.341 + }22.342 + osx_drives_changed(NULL, iokit_iterators[1]);22.343 +22.344 + if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,22.345 + IOServiceMatching(kIOHIDDeviceKey),22.346 + osx_hid_inserted, NULL, &iokit_iterators[2] ) != kIOReturnSuccess ) {22.347 + ERROR( "IOServiceAddMatchingNotification failed" );22.348 + }22.349 + osx_hid_inserted(NULL, iokit_iterators[2]);22.350 + return TRUE;22.351 +}22.352 +22.353 +void osx_unregister_iokit_notifications()22.354 +{22.355 + CFRunLoopSourceRef runloop_source = IONotificationPortGetRunLoopSource( notify_port );22.356 + CFRunLoopRemoveSource( CFRunLoopGetCurrent(), runloop_source, kCFRunLoopCommonModes );22.357 + IONotificationPortDestroy( notify_port );22.358 + notify_port = 0;22.359 +}
23.1 --- a/src/drivers/video_nsgl.c Thu Jan 15 03:54:21 2009 +000023.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000023.3 @@ -1,81 +0,0 @@23.4 -/**23.5 - * $Id$23.6 - *23.7 - * Cocoa (NSOpenGL) video driver23.8 - *23.9 - * Copyright (c) 2005 Nathan Keynes.23.10 - *23.11 - * This program is free software; you can redistribute it and/or modify23.12 - * it under the terms of the GNU General Public License as published by23.13 - * the Free Software Foundation; either version 2 of the License, or23.14 - * (at your option) any later version.23.15 - *23.16 - * This program is distributed in the hope that it will be useful,23.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of23.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23.19 - * GNU General Public License for more details.23.20 - */23.21 -23.22 -#include <AppKit/NSOpenGL.h>23.23 -#include <Foundation/NSAutoreleasePool.h>23.24 -#include "drivers/video_nsgl.h"23.25 -#include "drivers/video_gl.h"23.26 -#include "pvr2/glutil.h"23.27 -23.28 -static NSOpenGLContext *nsgl_context = nil;23.29 -23.30 -gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver )23.31 -{23.32 - NSAutoreleasePool *pool = [NSAutoreleasePool new];23.33 - NSOpenGLPixelFormatAttribute attributes[] = {23.34 - NSOpenGLPFAWindow,23.35 - // NSOpenGLPFADoubleBuffer,23.36 - NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,23.37 - (NSOpenGLPixelFormatAttribute)nil };23.38 -23.39 - NSOpenGLPixelFormat *pixelFormat =23.40 - [[[NSOpenGLPixelFormat alloc] initWithAttributes: attributes] autorelease];23.41 - nsgl_context =23.42 - [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil];23.43 - [nsgl_context setView: view];23.44 - [nsgl_context makeCurrentContext];23.45 - [pool release];23.46 - if( gl_fbo_is_supported() ) {23.47 - gl_fbo_init(driver);23.48 - } else {23.49 - ERROR( "FBO not supported" );23.50 - return FALSE;23.51 - }23.52 -23.53 - return TRUE;23.54 -}23.55 -23.56 -void video_nsgl_update()23.57 -{23.58 - if( nsgl_context != nil ) {23.59 - [nsgl_context update];23.60 - }23.61 -}23.62 -23.63 -void video_nsgl_make_current()23.64 -{23.65 - if( nsgl_context != nil ) {23.66 - [nsgl_context makeCurrentContext];23.67 - }23.68 -}23.69 -23.70 -void video_nsgl_swap_buffers()23.71 -{23.72 - if( nsgl_context != nil ) {23.73 - [nsgl_context flushBuffer];23.74 - }23.75 -}23.76 -23.77 -void video_nsgl_shutdown()23.78 -{23.79 - if( nsgl_context != nil ) {23.80 - [NSOpenGLContext clearCurrentContext];23.81 - [nsgl_context release];23.82 - nsgl_context = nil;23.83 - }23.84 -}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000024.2 +++ b/src/drivers/video_nsgl.m Thu Jan 15 04:15:11 2009 +000024.3 @@ -0,0 +1,81 @@24.4 +/**24.5 + * $Id$24.6 + *24.7 + * Cocoa (NSOpenGL) video driver24.8 + *24.9 + * Copyright (c) 2005 Nathan Keynes.24.10 + *24.11 + * This program is free software; you can redistribute it and/or modify24.12 + * it under the terms of the GNU General Public License as published by24.13 + * the Free Software Foundation; either version 2 of the License, or24.14 + * (at your option) any later version.24.15 + *24.16 + * This program is distributed in the hope that it will be useful,24.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of24.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24.19 + * GNU General Public License for more details.24.20 + */24.21 +24.22 +#include <AppKit/NSOpenGL.h>24.23 +#include <Foundation/NSAutoreleasePool.h>24.24 +#include "drivers/video_nsgl.h"24.25 +#include "drivers/video_gl.h"24.26 +#include "pvr2/glutil.h"24.27 +24.28 +static NSOpenGLContext *nsgl_context = nil;24.29 +24.30 +gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver )24.31 +{24.32 + NSAutoreleasePool *pool = [NSAutoreleasePool new];24.33 + NSOpenGLPixelFormatAttribute attributes[] = {24.34 + NSOpenGLPFAWindow,24.35 + // NSOpenGLPFADoubleBuffer,24.36 + NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,24.37 + (NSOpenGLPixelFormatAttribute)nil };24.38 +24.39 + NSOpenGLPixelFormat *pixelFormat =24.40 + [[[NSOpenGLPixelFormat alloc] initWithAttributes: attributes] autorelease];24.41 + nsgl_context =24.42 + [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil];24.43 + [nsgl_context setView: view];24.44 + [nsgl_context makeCurrentContext];24.45 + [pool release];24.46 + if( gl_fbo_is_supported() ) {24.47 + gl_fbo_init(driver);24.48 + } else {24.49 + ERROR( "FBO not supported" );24.50 + return FALSE;24.51 + }24.52 +24.53 + return TRUE;24.54 +}24.55 +24.56 +void video_nsgl_update()24.57 +{24.58 + if( nsgl_context != nil ) {24.59 + [nsgl_context update];24.60 + }24.61 +}24.62 +24.63 +void video_nsgl_make_current()24.64 +{24.65 + if( nsgl_context != nil ) {24.66 + [nsgl_context makeCurrentContext];24.67 + }24.68 +}24.69 +24.70 +void video_nsgl_swap_buffers()24.71 +{24.72 + if( nsgl_context != nil ) {24.73 + [nsgl_context flushBuffer];24.74 + }24.75 +}24.76 +24.77 +void video_nsgl_shutdown()24.78 +{24.79 + if( nsgl_context != nil ) {24.80 + [NSOpenGLContext clearCurrentContext];24.81 + [nsgl_context release];24.82 + nsgl_context = nil;24.83 + }24.84 +}
25.1 --- a/src/drivers/video_osx.c Thu Jan 15 03:54:21 2009 +000025.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000025.3 @@ -1,308 +0,0 @@25.4 -/**25.5 - * $Id$25.6 - *25.7 - * The OS/X side of the video support (responsible for actually displaying /25.8 - * rendering frames)25.9 - *25.10 - * Copyright (c) 2008 Nathan Keynes.25.11 - *25.12 - * This program is free software; you can redistribute it and/or modify25.13 - * it under the terms of the GNU General Public License as published by25.14 - * the Free Software Foundation; either version 2 of the License, or25.15 - * (at your option) any later version.25.16 - *25.17 - * This program is distributed in the hope that it will be useful,25.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of25.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the25.20 - * GNU General Public License for more details.25.21 - */25.22 -25.23 -#include <stdlib.h>25.24 -#include <string.h>25.25 -#include "lxdream.h"25.26 -#include "display.h"25.27 -#include "dckeysyms.h"25.28 -#include "cocoaui/cocoaui.h"25.29 -#include "drivers/video_nsgl.h"25.30 -#include "drivers/video_gl.h"25.31 -#include "pvr2/pvr2.h"25.32 -#import <AppKit/AppKit.h>25.33 -25.34 -#include "mac_keymap.h"25.35 -25.36 -#define MOUSE_X_SCALE 525.37 -#define MOUSE_Y_SCALE 525.38 -25.39 -static gboolean video_osx_init();25.40 -static void video_osx_shutdown();25.41 -static void video_osx_display_blank( uint32_t colour );25.42 -static uint16_t video_osx_resolve_keysym( const gchar *keysym );25.43 -static uint16_t video_osx_keycode_to_dckeysym(uint16_t keycode);25.44 -static gchar *video_osx_keycode_to_keysym(uint16_t keycode);25.45 -25.46 -struct display_driver display_osx_driver = {25.47 - "osx",25.48 - N_("OS X Cocoa GUI-based OpenGL driver"),25.49 - video_osx_init, video_osx_shutdown,25.50 - video_osx_resolve_keysym,25.51 - video_osx_keycode_to_dckeysym,25.52 - video_osx_keycode_to_keysym,25.53 - NULL, NULL, NULL, NULL, NULL,25.54 - NULL,25.55 - video_osx_display_blank, NULL };25.56 -25.57 -25.58 -static NSView *video_view = NULL;25.59 -int video_width = 640;25.60 -int video_height = 480;25.61 -25.62 -#define MAX_MASK_KEYCODE 12825.63 -25.64 -@interface LxdreamOSXView : LxdreamVideoView25.65 -{25.66 - int flagsMask[MAX_MASK_KEYCODE];25.67 -}25.68 -@end25.69 -25.70 -@implementation LxdreamVideoView25.71 -- (void)setIsGrabbed: (BOOL)grabbed25.72 -{25.73 - isGrabbed = grabbed;25.74 -}25.75 -- (void) setDelegate: (id)other25.76 -{25.77 - delegate = other;25.78 -}25.79 -- (id)delegate25.80 -{25.81 - return delegate;25.82 -}25.83 -@end25.84 -25.85 -@implementation LxdreamOSXView25.86 -//--------------------------------------------------------------------25.87 -- (id)initWithFrame: (NSRect)contentRect25.88 -{25.89 - if( [super initWithFrame: contentRect] != nil ) {25.90 - int i;25.91 - isGrabbed = NO;25.92 - for( i=0; i<MAX_MASK_KEYCODE; i++ ) {25.93 - flagsMask[i] = 0;25.94 - }25.95 - return self;25.96 - }25.97 - return nil;25.98 -}25.99 -- (BOOL)requestGrab25.100 -{25.101 - if( delegate && [delegate respondsToSelector: @selector(viewRequestedGrab:)] )25.102 - return [delegate performSelector: @selector(viewRequestedGrab:) withObject: self] != nil;25.103 - return NO;25.104 -}25.105 -- (BOOL)requestUngrab25.106 -{25.107 - if( delegate && [delegate respondsToSelector: @selector(viewRequestedUngrab:)] )25.108 - return [delegate performSelector: @selector(viewRequestedUngrab:) withObject: self] != nil;25.109 - return NO;25.110 -}25.111 -- (BOOL)isOpaque25.112 -{25.113 - return YES;25.114 -}25.115 -- (BOOL)acceptsFirstResponder25.116 -{25.117 - return YES;25.118 -}25.119 -- (BOOL)isFlipped25.120 -{25.121 - return YES;25.122 -}25.123 -//--------------------------------------------------------------------25.124 -- (void)drawRect: (NSRect) rect25.125 -{25.126 - NSSize size = [self frame].size;25.127 - if( video_width != size.width || video_height != size.height ) {25.128 - video_width = size.width;25.129 - video_height = size.height;25.130 - video_nsgl_update();25.131 - }25.132 - pvr2_redraw_display();25.133 -}25.134 -- (void)keyDown: (NSEvent *) event25.135 -{25.136 - if( ![event isARepeat] ) {25.137 - input_event_keydown( NULL, [event keyCode]+1, 1 );25.138 - }25.139 -}25.140 -- (void)keyUp: (NSEvent *) event25.141 -{25.142 - input_event_keyup( NULL, [event keyCode]+1, 1 );25.143 -}25.144 -- (void)flagsChanged: (NSEvent *) event25.145 -{25.146 - int keycode = [event keyCode];25.147 - if( ([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask) ) {25.148 - [self requestUngrab];25.149 - }25.150 -25.151 - if( flagsMask[keycode] == 0 ) {25.152 - input_event_keydown( NULL, keycode+1, 1 );25.153 - flagsMask[keycode] = 1;25.154 - } else {25.155 - input_event_keyup( NULL, keycode+1, 1 );25.156 - flagsMask[keycode] = 0;25.157 - }25.158 -}25.159 -- (void)emitMouseDownEvent: (NSEvent *)event button: (int)button25.160 -{25.161 - if( isGrabbed ) {25.162 - input_event_mousedown( button, 0, 0, FALSE );25.163 - } else {25.164 - NSPoint pt = [event locationInWindow];25.165 - int x = (int)pt.x;25.166 - int y = video_height - (int)pt.y;25.167 - gl_window_to_system_coords(&x,&y);25.168 - input_event_mousedown( button, x, y, TRUE );25.169 - }25.170 -}25.171 -- (void)emitMouseUpEvent: (NSEvent *)event button: (int)button25.172 -{25.173 - if( isGrabbed ) {25.174 - input_event_mouseup( button, 0, 0, FALSE );25.175 - } else {25.176 - NSPoint pt = [event locationInWindow];25.177 - int x = (int)pt.x;25.178 - int y = video_height - (int)pt.y;25.179 - gl_window_to_system_coords(&x,&y);25.180 - input_event_mouseup( button, x, y, TRUE );25.181 - }25.182 -}25.183 -- (void)emitMouseMoveEvent: (NSEvent *)event25.184 -{25.185 - if( isGrabbed ) {25.186 - input_event_mousemove( [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );25.187 - } else {25.188 - NSPoint pt = [event locationInWindow];25.189 - int x = (int)pt.x;25.190 - int y = video_height - (int)pt.y;25.191 - gl_window_to_system_coords(&x,&y);25.192 - input_event_mousemove( x, y, TRUE );25.193 - }25.194 -}25.195 -- (void)mouseExited: (NSEvent *)event25.196 -{25.197 - if( !isGrabbed ) {25.198 - input_event_mousemove( -1, -1, TRUE );25.199 - }25.200 -}25.201 -25.202 -- (void)mouseDown: (NSEvent *) event25.203 -{25.204 - // If using grab but not grabbed yet, the first click should be consumed25.205 - // by the grabber. In all other circumstances we process normally.25.206 - if( isGrabbed || ![self requestGrab] ) {25.207 - [self emitMouseDownEvent: event button: 0];25.208 - }25.209 -}25.210 -- (void)mouseUp: (NSEvent *)event25.211 -{25.212 - [self emitMouseUpEvent: event button: 0];25.213 -}25.214 -25.215 -- (void)rightMouseDown: (NSEvent *) event25.216 -{25.217 - [self emitMouseDownEvent: event button: 1];25.218 -}25.219 -- (void)rightMouseUp: (NSEvent *)event25.220 -{25.221 - [self emitMouseUpEvent: event button: 1];25.222 -}25.223 -- (void)otherMouseDown: (NSEvent *) event25.224 -{25.225 - [self emitMouseDownEvent: event button: [event buttonNumber]];25.226 -}25.227 -- (void)otherMouseUp: (NSEvent *) event25.228 -{25.229 - [self emitMouseUpEvent: event button: [event buttonNumber]];25.230 -}25.231 -- (void)mouseMoved: (NSEvent *) event25.232 -{25.233 - [self emitMouseMoveEvent: event];25.234 -}25.235 -- (void)mouseDragged: (NSEvent *) event25.236 -{25.237 - [self emitMouseMoveEvent: event];25.238 -}25.239 -- (void)rightMouseDragged: (NSEvent *) event25.240 -{25.241 - [self emitMouseMoveEvent: event];25.242 -}25.243 -- (void)otherMouseDragged: (NSEvent *) event25.244 -{25.245 - [self emitMouseMoveEvent: event];25.246 -}25.247 -25.248 -@end25.249 -25.250 -NSView *video_osx_create_drawable()25.251 -{25.252 - NSRect contentRect = {{0,0},{640,480}};25.253 - video_view = [[LxdreamOSXView alloc] initWithFrame: contentRect];25.254 - [video_view setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];25.255 - return video_view;25.256 -}25.257 -25.258 -static gboolean video_osx_init()25.259 -{25.260 - if( video_view == NULL ) {25.261 - return FALSE;25.262 - }25.263 - if( !video_nsgl_init_driver(video_view, &display_osx_driver) ) {25.264 - return FALSE;25.265 - }25.266 - pvr2_setup_gl_context();25.267 - return TRUE;25.268 -}25.269 -25.270 -static void video_osx_shutdown()25.271 -{25.272 -}25.273 -25.274 -static void video_osx_display_blank( uint32_t colour )25.275 -{25.276 -}25.277 -25.278 -static int mac_keymap_cmp(const void *a, const void *b)25.279 -{25.280 - const gchar *key = a;25.281 - const struct mac_keymap_struct *kb = b;25.282 - return strcasecmp(key, kb->name);25.283 -}25.284 -25.285 -static uint16_t video_osx_resolve_keysym( const gchar *keysym )25.286 -{25.287 - struct mac_keymap_struct *result = bsearch( keysym, mac_keysyms, mac_keysym_count, sizeof(struct mac_keymap_struct), mac_keymap_cmp );25.288 - if( result == NULL ) {25.289 - return 0;25.290 - } else {25.291 - return result->keycode + 1;25.292 - }25.293 -}25.294 -25.295 -static uint16_t video_osx_keycode_to_dckeysym(uint16_t keycode)25.296 -{25.297 - if( keycode < 1 || keycode > 128 ) {25.298 - return DCKB_NONE;25.299 - } else {25.300 - return mac_keycode_to_dckeysym[keycode-1];25.301 - }25.302 -}25.303 -25.304 -static gchar *video_osx_keycode_to_keysym(uint16_t keycode)25.305 -{25.306 - if( keycode < 1 || keycode > 128 ) {25.307 - return NULL;25.308 - } else {25.309 - return g_strdup(mac_keysyms_by_keycode[keycode-1]);25.310 - }25.311 -}25.312 \ No newline at end of file
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000026.2 +++ b/src/drivers/video_osx.m Thu Jan 15 04:15:11 2009 +000026.3 @@ -0,0 +1,308 @@26.4 +/**26.5 + * $Id$26.6 + *26.7 + * The OS/X side of the video support (responsible for actually displaying /26.8 + * rendering frames)26.9 + *26.10 + * Copyright (c) 2008 Nathan Keynes.26.11 + *26.12 + * This program is free software; you can redistribute it and/or modify26.13 + * it under the terms of the GNU General Public License as published by26.14 + * the Free Software Foundation; either version 2 of the License, or26.15 + * (at your option) any later version.26.16 + *26.17 + * This program is distributed in the hope that it will be useful,26.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of26.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the26.20 + * GNU General Public License for more details.26.21 + */26.22 +26.23 +#include <stdlib.h>26.24 +#include <string.h>26.25 +#include "lxdream.h"26.26 +#include "display.h"26.27 +#include "dckeysyms.h"26.28 +#include "cocoaui/cocoaui.h"26.29 +#include "drivers/video_nsgl.h"26.30 +#include "drivers/video_gl.h"26.31 +#include "pvr2/pvr2.h"26.32 +#import <AppKit/AppKit.h>26.33 +26.34 +#include "mac_keymap.h"26.35 +26.36 +#define MOUSE_X_SCALE 526.37 +#define MOUSE_Y_SCALE 526.38 +26.39 +static gboolean video_osx_init();26.40 +static void video_osx_shutdown();26.41 +static void video_osx_display_blank( uint32_t colour );26.42 +static uint16_t video_osx_resolve_keysym( const gchar *keysym );26.43 +static uint16_t video_osx_keycode_to_dckeysym(uint16_t keycode);26.44 +static gchar *video_osx_keycode_to_keysym(uint16_t keycode);26.45 +26.46 +struct display_driver display_osx_driver = {26.47 + "osx",26.48 + N_("OS X Cocoa GUI-based OpenGL driver"),26.49 + video_osx_init, video_osx_shutdown,26.50 + video_osx_resolve_keysym,26.51 + video_osx_keycode_to_dckeysym,26.52 + video_osx_keycode_to_keysym,26.53 + NULL, NULL, NULL, NULL, NULL,26.54 + NULL,26.55 + video_osx_display_blank, NULL };26.56 +26.57 +26.58 +static NSView *video_view = NULL;26.59 +int video_width = 640;26.60 +int video_height = 480;26.61 +26.62 +#define MAX_MASK_KEYCODE 12826.63 +26.64 +@interface LxdreamOSXView : LxdreamVideoView26.65 +{26.66 + int flagsMask[MAX_MASK_KEYCODE];26.67 +}26.68 +@end26.69 +26.70 +@implementation LxdreamVideoView26.71 +- (void)setIsGrabbed: (BOOL)grabbed26.72 +{26.73 + isGrabbed = grabbed;26.74 +}26.75 +- (void) setDelegate: (id)other26.76 +{26.77 + delegate = other;26.78 +}26.79 +- (id)delegate26.80 +{26.81 + return delegate;26.82 +}26.83 +@end26.84 +26.85 +@implementation LxdreamOSXView26.86 +//--------------------------------------------------------------------26.87 +- (id)initWithFrame: (NSRect)contentRect26.88 +{26.89 + if( [super initWithFrame: contentRect] != nil ) {26.90 + int i;26.91 + isGrabbed = NO;26.92 + for( i=0; i<MAX_MASK_KEYCODE; i++ ) {26.93 + flagsMask[i] = 0;26.94 + }26.95 + return self;26.96 + }26.97 + return nil;26.98 +}26.99 +- (BOOL)requestGrab26.100 +{26.101 + if( delegate && [delegate respondsToSelector: @selector(viewRequestedGrab:)] )26.102 + return [delegate performSelector: @selector(viewRequestedGrab:) withObject: self] != nil;26.103 + return NO;26.104 +}26.105 +- (BOOL)requestUngrab26.106 +{26.107 + if( delegate && [delegate respondsToSelector: @selector(viewRequestedUngrab:)] )26.108 + return [delegate performSelector: @selector(viewRequestedUngrab:) withObject: self] != nil;26.109 + return NO;26.110 +}26.111 +- (BOOL)isOpaque26.112 +{26.113 + return YES;26.114 +}26.115 +- (BOOL)acceptsFirstResponder26.116 +{26.117 + return YES;26.118 +}26.119 +- (BOOL)isFlipped26.120 +{26.121 + return YES;26.122 +}26.123 +//--------------------------------------------------------------------26.124 +- (void)drawRect: (NSRect) rect26.125 +{26.126 + NSSize size = [self frame].size;26.127 + if( video_width != size.width || video_height != size.height ) {26.128 + video_width = size.width;26.129 + video_height = size.height;26.130 + video_nsgl_update();26.131 + }26.132 + pvr2_redraw_display();26.133 +}26.134 +- (void)keyDown: (NSEvent *) event26.135 +{26.136 + if( ![event isARepeat] ) {26.137 + input_event_keydown( NULL, [event keyCode]+1, 1 );26.138 + }26.139 +}26.140 +- (void)keyUp: (NSEvent *) event26.141 +{26.142 + input_event_keyup( NULL, [event keyCode]+1, 1 );26.143 +}26.144 +- (void)flagsChanged: (NSEvent *) event26.145 +{26.146 + int keycode = [event keyCode];26.147 + if( ([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask) ) {26.148 + [self requestUngrab];26.149 + }26.150 +26.151 + if( flagsMask[keycode] == 0 ) {26.152 + input_event_keydown( NULL, keycode+1, 1 );26.153 + flagsMask[keycode] = 1;26.154 + } else {26.155 + input_event_keyup( NULL, keycode+1, 1 );26.156 + flagsMask[keycode] = 0;26.157 + }26.158 +}26.159 +- (void)emitMouseDownEvent: (NSEvent *)event button: (int)button26.160 +{26.161 + if( isGrabbed ) {26.162 + input_event_mousedown( button, 0, 0, FALSE );26.163 + } else {26.164 + NSPoint pt = [event locationInWindow];26.165 + int x = (int)pt.x;26.166 + int y = video_height - (int)pt.y;26.167 + gl_window_to_system_coords(&x,&y);26.168 + input_event_mousedown( button, x, y, TRUE );26.169 + }26.170 +}26.171 +- (void)emitMouseUpEvent: (NSEvent *)event button: (int)button26.172 +{26.173 + if( isGrabbed ) {26.174 + input_event_mouseup( button, 0, 0, FALSE );26.175 + } else {26.176 + NSPoint pt = [event locationInWindow];26.177 + int x = (int)pt.x;26.178 + int y = video_height - (int)pt.y;26.179 + gl_window_to_system_coords(&x,&y);26.180 + input_event_mouseup( button, x, y, TRUE );26.181 + }26.182 +}26.183 +- (void)emitMouseMoveEvent: (NSEvent *)event26.184 +{26.185 + if( isGrabbed ) {26.186 + input_event_mousemove( [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );26.187 + } else {26.188 + NSPoint pt = [event locationInWindow];26.189 + int x = (int)pt.x;26.190 + int y = video_height - (int)pt.y;26.191 + gl_window_to_system_coords(&x,&y);26.192 + input_event_mousemove( x, y, TRUE );26.193 + }26.194 +}26.195 +- (void)mouseExited: (NSEvent *)event26.196 +{26.197 + if( !isGrabbed ) {26.198 + input_event_mousemove( -1, -1, TRUE );26.199 + }26.200 +}26.201 +26.202 +- (void)mouseDown: (NSEvent *) event26.203 +{26.204 + // If using grab but not grabbed yet, the first click should be consumed26.205 + // by the grabber. In all other circumstances we process normally.26.206 + if( isGrabbed || ![self requestGrab] ) {26.207 + [self emitMouseDownEvent: event button: 0];26.208 + }26.209 +}26.210 +- (void)mouseUp: (NSEvent *)event26.211 +{26.212 + [self emitMouseUpEvent: event button: 0];26.213 +}26.214 +26.215 +- (void)rightMouseDown: (NSEvent *) event26.216 +{26.217 + [self emitMouseDownEvent: event button: 1];26.218 +}26.219 +- (void)rightMouseUp: (NSEvent *)event26.220 +{26.221 + [self emitMouseUpEvent: event button: 1];26.222 +}26.223 +- (void)otherMouseDown: (NSEvent *) event26.224 +{26.225 + [self emitMouseDownEvent: event button: [event buttonNumber]];26.226 +}26.227 +- (void)otherMouseUp: (NSEvent *) event26.228 +{26.229 + [self emitMouseUpEvent: event button: [event buttonNumber]];26.230 +}26.231 +- (void)mouseMoved: (NSEvent *) event26.232 +{26.233 + [self emitMouseMoveEvent: event];26.234 +}26.235 +- (void)mouseDragged: (NSEvent *) event26.236 +{26.237 + [self emitMouseMoveEvent: event];26.238 +}26.239 +- (void)rightMouseDragged: (NSEvent *) event26.240 +{26.241 + [self emitMouseMoveEvent: event];26.242 +}26.243 +- (void)otherMouseDragged: (NSEvent *) event26.244 +{26.245 + [self emitMouseMoveEvent: event];26.246 +}26.247 +26.248 +@end26.249 +26.250 +NSView *video_osx_create_drawable()26.251 +{26.252 + NSRect contentRect = {{0,0},{640,480}};26.253 + video_view = [[LxdreamOSXView alloc] initWithFrame: contentRect];26.254 + [video_view setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];26.255 + return video_view;26.256 +}26.257 +26.258 +static gboolean video_osx_init()26.259 +{26.260 + if( video_view == NULL ) {26.261 + return FALSE;26.262 + }26.263 + if( !video_nsgl_init_driver(video_view, &display_osx_driver) ) {26.264 + return FALSE;26.265 + }26.266 + pvr2_setup_gl_context();26.267 + return TRUE;26.268 +}26.269 +26.270 +static void video_osx_shutdown()26.271 +{26.272 +}26.273 +26.274 +static void video_osx_display_blank( uint32_t colour )26.275 +{26.276 +}26.277 +26.278 +static int mac_keymap_cmp(const void *a, const void *b)26.279 +{26.280 + const gchar *key = a;26.281 + const struct mac_keymap_struct *kb = b;26.282 + return strcasecmp(key, kb->name);26.283 +}26.284 +26.285 +static uint16_t video_osx_resolve_keysym( const gchar *keysym )26.286 +{26.287 + struct mac_keymap_struct *result = bsearch( keysym, mac_keysyms, mac_keysym_count, sizeof(struct mac_keymap_struct), mac_keymap_cmp );26.288 + if( result == NULL ) {26.289 + return 0;26.290 + } else {26.291 + return result->keycode + 1;26.292 + }26.293 +}26.294 +26.295 +static uint16_t video_osx_keycode_to_dckeysym(uint16_t keycode)26.296 +{26.297 + if( keycode < 1 || keycode > 128 ) {26.298 + return DCKB_NONE;26.299 + } else {26.300 + return mac_keycode_to_dckeysym[keycode-1];26.301 + }26.302 +}26.303 +26.304 +static gchar *video_osx_keycode_to_keysym(uint16_t keycode)26.305 +{26.306 + if( keycode < 1 || keycode > 128 ) {26.307 + return NULL;26.308 + } else {26.309 + return g_strdup(mac_keysyms_by_keycode[keycode-1]);26.310 + }26.311 +}26.312 \ No newline at end of file
27.1 --- a/src/paths.c Thu Jan 15 03:54:21 2009 +000027.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000027.3 @@ -1,66 +0,0 @@27.4 -/**27.5 - * $Id: cocoaui.c 863 2008-09-06 05:21:57Z nkeynes $27.6 - *27.7 - * Wrappers for system-dependent functions (mainly path differences)27.8 - *27.9 - * Copyright (c) 2008 Nathan Keynes.27.10 - *27.11 - * This program is free software; you can redistribute it and/or modify27.12 - * it under the terms of the GNU General Public License as published by27.13 - * the Free Software Foundation; either version 2 of the License, or27.14 - * (at your option) any later version.27.15 - *27.16 - * This program is distributed in the hope that it will be useful,27.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of27.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the27.19 - * GNU General Public License for more details.27.20 - */27.21 -27.22 -#include <string.h>27.23 -27.24 -#include "lxdream.h"27.25 -27.26 -/* Bundle builds need to use different paths from ordinary builds, since27.27 - * the message catalogs, default config, etc are all bundle-relative.27.28 - * Otherwise paths use the standard unix install paths27.29 - */27.30 -#ifdef OSX_BUNDLE27.31 -27.32 -#include <AppKit/AppKit.h>27.33 -27.34 -static char *bundle_resource_path = NULL;27.35 -27.36 -static char *get_bundle_resource_path()27.37 -{27.38 - if( bundle_resource_path == NULL ) {27.39 - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];27.40 - NSString *resourcePath = [[NSBundle mainBundle] resourcePath];27.41 - bundle_resource_path = strdup([resourcePath UTF8String]);27.42 - [pool release];27.43 - }27.44 - return bundle_resource_path;27.45 -}27.46 -27.47 -const char *get_sysconf_path()27.48 -{27.49 - return get_bundle_resource_path();27.50 -}27.51 -27.52 -const char *get_locale_path()27.53 -{27.54 - return get_bundle_resource_path();27.55 -}27.56 -27.57 -#else27.58 -27.59 -const char *get_sysconf_path()27.60 -{27.61 - return PACKAGE_CONF_DIR;27.62 -}27.63 -27.64 -const char *get_locale_path()27.65 -{27.66 - return PACKAGE_LOCALE_DIR;27.67 -}27.68 -27.69 -#endif
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000028.2 +++ b/src/paths_unix.c Thu Jan 15 04:15:11 2009 +000028.3 @@ -0,0 +1,32 @@28.4 +/**28.5 + * $Id: cocoaui.c 863 2008-09-06 05:21:57Z nkeynes $28.6 + *28.7 + * Wrappers for system-dependent functions (mainly path differences)28.8 + *28.9 + * Copyright (c) 2008 Nathan Keynes.28.10 + *28.11 + * This program is free software; you can redistribute it and/or modify28.12 + * it under the terms of the GNU General Public License as published by28.13 + * the Free Software Foundation; either version 2 of the License, or28.14 + * (at your option) any later version.28.15 + *28.16 + * This program is distributed in the hope that it will be useful,28.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of28.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the28.19 + * GNU General Public License for more details.28.20 + */28.21 +28.22 +#include <string.h>28.23 +28.24 +#include "lxdream.h"28.25 +28.26 +const char *get_sysconf_path()28.27 +{28.28 + return PACKAGE_CONF_DIR;28.29 +}28.30 +28.31 +const char *get_locale_path()28.32 +{28.33 + return PACKAGE_LOCALE_DIR;28.34 +}28.35 +
.