The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
authorRyan C. Gordon <icculus@icculus.org>
Thu, 08 Sep 2005 06:16:14 +0000
changeset 1133609c060fd2a2
parent 1132 a0d3514c04b2
child 1134 55a86cfe6277
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:


To: SDL Developers <sdl@libsdl.org>
From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se>
Date: Mon, 30 May 2005 23:29:04 +0200
Subject: [SDL] Mac OS X Video Drivers [patch]

I've updated/added the Carbon and X11 video drivers
to the Mac OS X port of SDL 1.2 (the CVS version),
and made the Cocoa driver and runtime *optional*.

The default is still Cocoa, and the "Quartz" driver.
But you can now also use "toolbox" for Carbon, and
"x11" for running with Apple's (or other) X11 server:

export SDL_VIDEODRIVER=x11
export SDL_VIDEO_GL_DRIVER=/usr/X11R6/lib/libGL.dylib

It also checks if the frameworks are available, by a:
#include <Carbon/Carbon.h> or #import <Cocoa/Cocoa.h>
(this should make it configure on plain Darwin as well?)


Here are the new configure targets:
--enable-video-cocoa use Cocoa/Quartz video driver default=yes
--enable-video-carbon use Carbon/QuickDraw video driver default=yes
--enable-video-x11 use X11 video driver default=no

./configure --enable-video-cocoa --enable-video-carbon
--enable-video-x11 \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib

The Carbon version is just an updated version of the old
SDL driver for Mac OS 9, and could probably be improved...
(but it does work, including the Carbon version of SDLmain)

If you disable cocoa, you can run with -framework Carbon only,
and the C version of SDL_main.c. And if you disable carbon too,
you can still use the X11 version which doesn't require SDLmain.

I updated the DrawSprocket version, but did not include it.
(no blitters or VRAM GWorlds etc. available on OS X anyway)
Besides for Mac OS 9, I don't think there's any use for it ?

And note that any performance on Mac OS X equals OpenGL anyway...
You can get "fair" software SDL results on captured CG displays,
but for decent frame rates you need to be using GL for rendering.


Finally, here is the patch itself:
http://www.algonet.se/~afb/SDL-12CVS-macvideo.patch

--anders

PS. It says "video", but as usual it applies to mouse/keyboard too.


------


To: A list for developers using the SDL library <sdl@libsdl.org>
From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se>
Date: Sun, 4 Sep 2005 10:02:15 +0200
Subject: [SDL] Updated Mac patch

Updated the previous Mac patch to disable Carbon by default.
Also "fixed" the SDL.spec again, so that it builds on Darwin.

http://www.algonet.se/~afb/SDL-1.2.9-mac.patch
Also applied fine to SDL12 CVS, when I tried it.
SDL.spec.in
configure.in
include/SDL_syswm.h
src/audio/macrom/SDL_romaudio.c
src/joystick/macos/SDL_sysjoystick.c
src/main/Makefile.am
src/main/macos/SDL_main.c
src/video/SDL_video.c
src/video/maccommon/SDL_lowvideo.h
src/video/maccommon/SDL_macevents.c
src/video/maccommon/SDL_macmouse.c
src/video/maccommon/SDL_macwm.c
src/video/macdsp/Makefile.am
src/video/macdsp/SDL_dspvideo.c
src/video/macrom/SDL_romvideo.c
     1.1 --- a/SDL.spec.in	Thu Aug 25 20:31:58 2005 +0000
     1.2 +++ b/SDL.spec.in	Thu Sep 08 06:16:14 2005 +0000
     1.3 @@ -1,18 +1,16 @@
     1.4 -%define name @PACKAGE@
     1.5 -%define version @VERSION@
     1.6 -%define release 1
     1.7 -
     1.8  Summary: Simple DirectMedia Layer
     1.9 -Name: %{name}
    1.10 -Version: %{version}
    1.11 -Release: %{release}
    1.12 -Source0: %{name}-%{version}.tar.gz
    1.13 +Name: @PACKAGE@
    1.14 +Version: @VERSION@
    1.15 +Release: 1
    1.16 +Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
    1.17  URL: http://www.libsdl.org/
    1.18 -Copyright: LGPL
    1.19 +License: LGPL
    1.20  Group: System Environment/Libraries
    1.21 -BuildRoot: /var/tmp/%{name}-buildroot
    1.22 +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
    1.23  Prefix: %{_prefix}
    1.24 +%ifos linux
    1.25  Provides: libSDL-1.1.so.0
    1.26 +%endif
    1.27  
    1.28  %description
    1.29  This is the Simple DirectMedia Layer, a generic API that provides low
    1.30 @@ -22,7 +20,7 @@
    1.31  %package devel
    1.32  Summary: Libraries, includes and more to develop SDL applications.
    1.33  Group: Development/Libraries
    1.34 -Requires: %{name}
    1.35 +Requires: %{name} = %{version}
    1.36  
    1.37  %description devel
    1.38  This is the Simple DirectMedia Layer, a generic API that provides low
    1.39 @@ -34,40 +32,62 @@
    1.40  
    1.41  
    1.42  %prep
    1.43 -rm -rf ${RPM_BUILD_ROOT}
    1.44 -
    1.45  %setup -q 
    1.46  
    1.47  %build
    1.48 +%ifos linux
    1.49  CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-svga --disable-video-ggi --disable-video-aalib --disable-debug --enable-dlopen --enable-esd-shared --enable-arts-shared
    1.50 +%else
    1.51 +%configure --disable-debug --enable-dlopen
    1.52 +%endif
    1.53  make
    1.54  
    1.55  %install
    1.56  rm -rf $RPM_BUILD_ROOT
    1.57 +%ifos linux
    1.58  make install prefix=$RPM_BUILD_ROOT/%{prefix}
    1.59  ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT/%{prefix}/lib/libSDL-1.1.so.0
    1.60 +%else
    1.61 +%makeinstall
    1.62 +%endif
    1.63  
    1.64  %clean
    1.65  rm -rf $RPM_BUILD_ROOT
    1.66  
    1.67 +%ifnos darwin
    1.68 +%define __defattr %defattr(-,root,root)
    1.69 +%define __soext so
    1.70 +%else
    1.71 +%define __defattr %defattr(-,root,wheel)
    1.72 +%define __soext dylib
    1.73 +%endif
    1.74 +
    1.75  %files
    1.76 -%defattr(-,root,root)
    1.77 +%{__defattr}
    1.78  %doc README-SDL.txt COPYING CREDITS BUGS
    1.79 -%{prefix}/lib/lib*.so.*
    1.80 +%ifnos darwin
    1.81 +%{_libdir}/lib*.%{__soext}.*
    1.82 +%else
    1.83 +%{_libdir}/lib*.*.%{__soext}
    1.84 +%endif
    1.85  
    1.86  %files devel
    1.87  %defattr(-,root,root)
    1.88  %doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
    1.89  %doc docs/index.html docs/html
    1.90 -%{prefix}/bin/*-config
    1.91 -%{prefix}/lib/lib*.a
    1.92 -%{prefix}/lib/lib*.la
    1.93 -%{prefix}/lib/lib*.so
    1.94 -%{prefix}/include/SDL/
    1.95 -%{prefix}/man/man3/*
    1.96 -%{prefix}/share/aclocal/*
    1.97 +%{_bindir}/*-config
    1.98 +%{_libdir}/lib*.a
    1.99 +%{_libdir}/lib*.la
   1.100 +%{_libdir}/lib*.%{__soext}
   1.101 +%dir %{_includedir}/SDL
   1.102 +%{_includedir}/SDL/*.h
   1.103 +%{_mandir}/man3/*
   1.104 +%{_datadir}/aclocal/*
   1.105  
   1.106  %changelog
   1.107 +* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
   1.108 +- Added support for Darwin, updated spec file
   1.109 +
   1.110  * Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
   1.111  - Re-integrated spec file into SDL distribution
   1.112  - 'name' and 'version' come from configure 
     2.1 --- a/configure.in	Thu Aug 25 20:31:58 2005 +0000
     2.2 +++ b/configure.in	Thu Sep 08 06:16:14 2005 +0000
     2.3 @@ -742,6 +742,28 @@
     2.4      fi
     2.5  }
     2.6  
     2.7 +
     2.8 +dnl Check for X11 on Mac OS X / Darwin
     2.9 +CheckMacX11()
    2.10 +{
    2.11 +    AC_ARG_ENABLE(video-x11,
    2.12 +[  --enable-video-x11      use X11 video driver [default=no]],
    2.13 +                  , enable_video_x11=no)
    2.14 +    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
    2.15 +        AC_PATH_X
    2.16 +        AC_PATH_XTRA
    2.17 +        if test x$have_x = xyes; then
    2.18 +            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
    2.19 +            if test x$ac_cv_func_shmat != xyes; then
    2.20 +                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
    2.21 +            fi
    2.22 +            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
    2.23 +            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
    2.24 +            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
    2.25 +        fi
    2.26 +    fi
    2.27 +}
    2.28 +
    2.29  dnl Find the X11 DGA 2.0 include and library directories
    2.30  CheckDGA()
    2.31  {
    2.32 @@ -1128,7 +1150,9 @@
    2.33          CFLAGS="$CFLAGS -DHAVE_OPENGL"
    2.34          case "$target" in
    2.35              *-*-darwin*)
    2.36 -                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
    2.37 +                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL"
    2.38 +                # The following is probably not available in Darwin:
    2.39 +                SYSTEM_LIBS="$SYSTEM_LIBS -framework AGL"
    2.40          esac
    2.41      fi
    2.42  }
    2.43 @@ -1635,15 +1659,34 @@
    2.44  dnl Set up the Mac toolbox video driver for Mac OS 7-9
    2.45  CheckTOOLBOX()
    2.46  {
    2.47 +    CFLAGS="$CFLAGS -DENABLE_TOOLBOX -DENABLE_DRAWSPROCKET"
    2.48      VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
    2.49      VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
    2.50      VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
    2.51      VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
    2.52 +    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
    2.53 +    VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
    2.54  }
    2.55  
    2.56 -dnl Set up the Mac toolbox video driver for Mac OS X
    2.57 +dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
    2.58  CheckCARBON()
    2.59  {
    2.60 +    AC_ARG_ENABLE(video-carbon,
    2.61 +[  --enable-video-carbon   use Carbon/QuickDraw video driver [default=no]],
    2.62 +                  , enable_video_carbon=no)
    2.63 +  if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
    2.64 +    AC_MSG_CHECKING(for Carbon framework)
    2.65 +    have_carbon=no
    2.66 +    if test x$have_carbon != xyes; then
    2.67 +        AC_TRY_COMPILE([
    2.68 +          #include <Carbon/Carbon.h>
    2.69 +        ],[
    2.70 +        ],[
    2.71 +        have_carbon=yes
    2.72 +        ])
    2.73 +    fi
    2.74 +    AC_MSG_RESULT($have_carbon)
    2.75 +    if test x$have_carbon = xyes; then
    2.76      # "MACOSX" is not an official definition, but it's commonly
    2.77      # accepted as a way to differentiate between what runs on X
    2.78      # and what runs on older Macs - while in theory "Carbon" defns
    2.79 @@ -1656,11 +1699,35 @@
    2.80      VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
    2.81      VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
    2.82      VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
    2.83 +    #VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
    2.84 +    #VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
    2.85 +    fi
    2.86 +  fi
    2.87  }
    2.88  
    2.89 -dnl Set up the Mac toolbox video driver for Mac OS X
    2.90 -CheckQUARTZ()
    2.91 +dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
    2.92 +CheckCOCOA()
    2.93  {
    2.94 +    AC_ARG_ENABLE(video-cocoa,
    2.95 +[  --enable-video-cocoa    use Cocoa/Quartz video driver [default=yes]],
    2.96 +                  , enable_video_cocoa=yes)
    2.97 +  if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
    2.98 +    old_CFLAGS="$CFLAGS"
    2.99 +    dnl work around that we don't have Objective-C support in autoconf
   2.100 +    CFLAGS="$CFLAGS -x objective-c"
   2.101 +    AC_MSG_CHECKING(for Cocoa framework)
   2.102 +    have_cocoa=no
   2.103 +    if test x$have_cocoa != xyes; then
   2.104 +        AC_TRY_COMPILE([
   2.105 +          #import <Cocoa/Cocoa.h>
   2.106 +        ],[
   2.107 +        ],[
   2.108 +        have_cocoa=yes
   2.109 +        ])
   2.110 +    fi
   2.111 +    AC_MSG_RESULT($have_cocoa)
   2.112 +    CFLAGS="$old_CFLAGS"
   2.113 +    if test x$have_cocoa = xyes; then
   2.114      # "MACOSX" is not an official definition, but it's commonly
   2.115      # accepted as a way to differentiate between what runs on X
   2.116      # and what runs on older Macs - while in theory "Carbon" defns
   2.117 @@ -1672,6 +1739,8 @@
   2.118        -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
   2.119      VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
   2.120      VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
   2.121 +    fi
   2.122 +  fi
   2.123  }
   2.124  
   2.125  dnl Check for the dlfcn.h interface for dynamically loading objects
   2.126 @@ -2581,13 +2650,15 @@
   2.127          SDL_LIBS="-lSDLmain $SDL_LIBS"
   2.128          ;;
   2.129      *-*-darwin* )
   2.130 -        # Strictly speaking, we want "Mac OS X", not "Darwin", which is
   2.131 +        # This could be either full "Mac OS X", or plain "Darwin" which is
   2.132          # just the OS X kernel sans upper layers like Carbon and Cocoa.
   2.133 -        # But config.guess comes back with "darwin", so go with the flow.
   2.134 +        # Next line is broken, and a few files below require Mac OS X (full)
   2.135          ARCH=macosx
   2.136          CheckDummyVideo
   2.137          CheckDiskAudio
   2.138 -        CheckQUARTZ
   2.139 +        CheckCOCOA
   2.140 +        CheckCARBON
   2.141 +        CheckMacX11
   2.142          CheckMacGL
   2.143          CheckPTHREAD
   2.144          CheckSIGACTION
   2.145 @@ -2625,8 +2696,16 @@
   2.146          fi
   2.147          # The MacOS X platform requires special setup.
   2.148          SDL_LIBS="-lSDLmain $SDL_LIBS"
   2.149 -        # The Cocoa backend still needs Carbon, and the YUV code QuickTime
   2.150 -        SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
   2.151 +        if test x$enable_video_cocoa = xyes; then
   2.152 +            SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa"
   2.153 +        fi
   2.154 +        if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
   2.155 +            # The Cocoa backend still needs Carbon, and the YUV code QuickTime
   2.156 +            SYSTEM_LIBS="$SYSTEM_LIBS -framework Carbon -framework QuickTime"
   2.157 +        fi
   2.158 +        #if test x$enable_video_carbon = xyes; then
   2.159 +        #    SYSTEM_LIBS="$SYSTEM_LIBS -framework DrawSprocket"
   2.160 +        #fi
   2.161          ;;
   2.162      *-*-mint*)
   2.163          ARCH=mint
   2.164 @@ -2746,6 +2825,8 @@
   2.165  AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
   2.166  AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
   2.167  AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
   2.168 +AM_CONDITIONAL(USE_COCOA, test x$enable_video_cocoa = xyes)
   2.169 +AM_CONDITIONAL(USE_CARBON, test x$enable_video_carbon = xyes)
   2.170  
   2.171  # Set conditional variables for shared and static library selection.
   2.172  # These are not used in any Makefile.am but in sdl-config.in.
   2.173 @@ -2773,7 +2854,13 @@
   2.174      SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
   2.175      ;;
   2.176    macosx)
   2.177 -    SHARED_SYSTEM_LIBS="-framework Cocoa"
   2.178 +    SHARED_SYSTEM_LIBS=""
   2.179 +    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
   2.180 +      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Cocoa"
   2.181 +    fi
   2.182 +    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
   2.183 +      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Carbon"
   2.184 +    fi
   2.185      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   2.186        SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
   2.187      fi
   2.188 @@ -2874,6 +2961,7 @@
   2.189  include/Makefile
   2.190  src/Makefile
   2.191  src/main/Makefile
   2.192 +src/main/macos/Makefile
   2.193  src/main/macosx/Makefile
   2.194  src/main/macosx/Info.plist
   2.195  src/audio/Makefile
     3.1 --- a/include/SDL_syswm.h	Thu Aug 25 20:31:58 2005 +0000
     3.2 +++ b/include/SDL_syswm.h	Thu Sep 08 06:16:14 2005 +0000
     3.3 @@ -48,14 +48,26 @@
     3.4  typedef struct SDL_SysWMinfo SDL_SysWMinfo;
     3.5  #else
     3.6  
     3.7 +#if defined(__APPLE__) && defined(__MACH__)
     3.8 +// conflicts with Quickdraw.h
     3.9 +#define Cursor X11Cursor
    3.10 +#endif
    3.11 +
    3.12  /* This is the structure for custom window manager events */
    3.13 -#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__) || defined(__NetBSD__)) && \
    3.14 +#if (defined(unix) || defined(__unix__) || defined(_AIX) || \
    3.15 +         defined(__OpenBSD__) || defined(__NetBSD__) || \
    3.16 +         (defined(__APPLE__) && defined(__MACH__))) && \
    3.17      (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX) && \
    3.18 -     !defined(__QNXNTO__))
    3.19 +         !defined(__QNXNTO__))
    3.20   /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
    3.21  #include <X11/Xlib.h>
    3.22  #include <X11/Xatom.h>
    3.23  
    3.24 +#if defined(__APPLE__) && defined(__MACH__)
    3.25 +// matches the re-define above
    3.26 +#undef Cursor
    3.27 +#endif
    3.28 +
    3.29  /* These are the various supported subsystems under UNIX */
    3.30  typedef enum {
    3.31  	SDL_SYSWM_X11
     4.1 --- a/src/audio/macrom/SDL_romaudio.c	Thu Aug 25 20:31:58 2005 +0000
     4.2 +++ b/src/audio/macrom/SDL_romaudio.c	Thu Sep 08 06:16:14 2005 +0000
     4.3 @@ -25,7 +25,9 @@
     4.4   "@(#) $Id$";
     4.5  #endif
     4.6  
     4.7 -#if TARGET_API_MAC_CARBON
     4.8 +#if defined(__APPLE__) && defined(__MACH__)
     4.9 +#  include <Carbon/Carbon.h>
    4.10 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
    4.11  #  include <Carbon.h>
    4.12  #else
    4.13  #  include <Sound.h> /* SoundManager interface */
    4.14 @@ -36,6 +38,12 @@
    4.15  #include <stdlib.h>
    4.16  #include <stdio.h>
    4.17  
    4.18 +#if !defined(NewSndCallBackUPP) && (UNIVERSAL_INTERFACES_VERSION < 0x0335)
    4.19 +#if !defined(NewSndCallBackProc) /* avoid circular redefinition... */
    4.20 +#define NewSndCallBackUPP NewSndCallBackProc
    4.21 +#endif
    4.22 +#endif
    4.23 +
    4.24  #include "SDL_endian.h"
    4.25  #include "SDL_audio.h"
    4.26  #include "SDL_audio_c.h"
    4.27 @@ -229,7 +237,7 @@
    4.28      
    4.29      /* initialize bufferCmd header */
    4.30      memset (&header, 0, sizeof(header));
    4.31 -    callback = NewSndCallBackUPP (callBackProc);
    4.32 +    callback = (SndCallBackUPP) NewSndCallBackUPP (callBackProc);
    4.33      sample_bits = spec->size / spec->samples / spec->channels * 8;
    4.34  
    4.35  #ifdef DEBUG_AUDIO
     5.1 --- a/src/joystick/macos/SDL_sysjoystick.c	Thu Aug 25 20:31:58 2005 +0000
     5.2 +++ b/src/joystick/macos/SDL_sysjoystick.c	Thu Sep 08 06:16:14 2005 +0000
     5.3 @@ -72,7 +72,9 @@
     5.4  {
     5.5      static ISpDeviceClass classes[4] = {
     5.6          kISpDeviceClass_Joystick,
     5.7 +    #if kISpDeviceClass_Gamepad
     5.8          kISpDeviceClass_Gamepad,
     5.9 +    #endif
    5.10          kISpDeviceClass_Wheel,
    5.11          0
    5.12      };
     6.1 --- a/src/main/Makefile.am	Thu Aug 25 20:31:58 2005 +0000
     6.2 +++ b/src/main/Makefile.am	Thu Sep 08 06:16:14 2005 +0000
     6.3 @@ -19,8 +19,14 @@
     6.4  MAINLIB_ARCH_SRCS = win32/SDL_win32_main.c
     6.5  else
     6.6  if TARGET_MACOSX
     6.7 +if USE_COCOA
     6.8  MAINLIB_ARCH_SRCS = macosx/SDLMain.m macosx/SDLMain.h
     6.9  else
    6.10 +if USE_CARBON
    6.11 +MAINLIB_ARCH_SRCS = macos/SDL_main.c
    6.12 +endif # USE_CARBON
    6.13 +endif # USE_COCOA
    6.14 +else
    6.15  if TARGET_QTOPIA
    6.16  MAINLIB_ARCH_SRCS = qtopia/SDL_qtopia_main.cc
    6.17  else
     7.1 --- a/src/main/macos/SDL_main.c	Thu Aug 25 20:31:58 2005 +0000
     7.2 +++ b/src/main/macos/SDL_main.c	Thu Sep 08 06:16:14 2005 +0000
     7.3 @@ -26,14 +26,16 @@
     7.4  #endif
     7.5  
     7.6  /* This file takes care of command line argument parsing, and stdio redirection
     7.7 -   in the MacOS environment.
     7.8 +   in the MacOS environment. (stdio/stderr is *not* directed for Mach-O builds)
     7.9   */
    7.10  
    7.11  #include <stdio.h>
    7.12  #include <stdlib.h>
    7.13  #include <string.h>
    7.14  #include <ctype.h>	
    7.15 -#if TARGET_API_MAC_CARBON
    7.16 +#if defined(__APPLE__) && defined(__MACH__)
    7.17 +#include <Carbon/Carbon.h>
    7.18 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
    7.19  #include <Carbon.h>
    7.20  #else
    7.21  #include <Dialogs.h>
    7.22 @@ -50,9 +52,11 @@
    7.23  #undef main
    7.24  #endif
    7.25  
    7.26 +#if !(defined(__APPLE__) && defined(__MACH__))
    7.27  /* The standard output files */
    7.28  #define STDOUT_FILE	"stdout.txt"
    7.29  #define STDERR_FILE	"stderr.txt"
    7.30 +#endif
    7.31  
    7.32  #if !defined(__MWERKS__) && !TARGET_API_MAC_CARBON
    7.33  	/* In MPW, the qd global has been removed from the libraries */
    7.34 @@ -79,6 +83,8 @@
    7.35  	return(false);
    7.36  }
    7.37  
    7.38 +#if !(defined(__APPLE__) && defined(__MACH__))
    7.39 +
    7.40  /* Parse a command line buffer into arguments */
    7.41  static int ParseCommandLine(char *cmdline, char **argv)
    7.42  {
    7.43 @@ -158,6 +164,8 @@
    7.44  	}
    7.45  }
    7.46  
    7.47 +#endif //!(defined(__APPLE__) && defined(__MACH__))
    7.48 +
    7.49  static int getCurrentAppName (StrFileName name) {
    7.50  	
    7.51      ProcessSerialNumber process;
    7.52 @@ -207,7 +215,7 @@
    7.53      prefs_name[0] = app_name[0] + strlen (SUFFIX);
    7.54     
    7.55      /* Make the file spec for prefs file */
    7.56 -    if ( noErr != FSMakeFSSpec (volume_ref_number, directory_id, prefs_name, prefs_fsp) )
    7.57 +    if ( noErr != FSMakeFSSpec (volume_ref_number, directory_id, prefs_name, prefs_fsp) ) {
    7.58          if ( !create )
    7.59              return 0;
    7.60          else {
    7.61 @@ -216,12 +224,12 @@
    7.62              prefs_fsp->parID   = directory_id;
    7.63              prefs_fsp->vRefNum = volume_ref_number;
    7.64                  
    7.65 -            FSpCreateResFile (prefs_fsp, '????', 'pref', 0);
    7.66 +            FSpCreateResFile (prefs_fsp, 0x3f3f3f3f, 'pref', 0); // '????' parsed as trigraph
    7.67              
    7.68              if ( noErr != ResError () )
    7.69                  return 0;
    7.70          }
    7.71 -      
    7.72 +     }
    7.73      return 1;
    7.74  }
    7.75  
    7.76 @@ -233,7 +241,7 @@
    7.77  
    7.78  	if (prefs_handle != NULL) {
    7.79  		int offset = 0;
    7.80 -		int j      = 0;
    7.81 +//		int j      = 0;
    7.82  		
    7.83  		HLock(prefs_handle);
    7.84  		
    7.85 @@ -349,7 +357,9 @@
    7.86  int main(int argc, char *argv[])
    7.87  {
    7.88  
    7.89 +#if !(defined(__APPLE__) && defined(__MACH__))
    7.90  #pragma unused(argc, argv)
    7.91 +#endif
    7.92  	
    7.93  #define DEFAULT_ARGS "\p"                /* pascal string for default args */
    7.94  #define DEFAULT_VIDEO_DRIVER "\ptoolbox" /* pascal string for default video driver name */	
    7.95 @@ -360,11 +370,13 @@
    7.96  
    7.97      PrefsRecord prefs = { DEFAULT_ARGS, DEFAULT_VIDEO_DRIVER, DEFAULT_OUTPUT_TO_FILE }; 
    7.98  	
    7.99 +#if !(defined(__APPLE__) && defined(__MACH__))
   7.100  	int     nargs;
   7.101  	char   **args;
   7.102  	char   *commandLine;
   7.103  	
   7.104  	StrFileName  appNameText;
   7.105 +#endif
   7.106  	int     videodriver     = VIDEO_ID_TOOLBOX;
   7.107      int     settingsChanged = 0;
   7.108      
   7.109 @@ -399,12 +411,18 @@
   7.110  	    short     itemHit;
   7.111  	
   7.112  		errorDialog = GetNewDialog (1001, nil, (WindowPtr)-1);
   7.113 +		if (errorDialog == NULL)
   7.114 +		    return -1;
   7.115  		DrawDialog (errorDialog);
   7.116  		
   7.117  		GetDialogItem (errorDialog, kErr_Text, &dummyType, &dummyHandle, &dummyRect);
   7.118  		SetDialogItemText (dummyHandle, "\pError Initializing SDL");
   7.119  		
   7.120 +#if TARGET_API_MAC_CARBON
   7.121 +		SetPort (GetDialogPort(errorDialog));
   7.122 +#else
   7.123  		SetPort (errorDialog);
   7.124 +#endif
   7.125  		do {
   7.126  			ModalDialog (nil, &itemHit);
   7.127  		} while (itemHit != kErr_OK);
   7.128 @@ -442,23 +460,40 @@
   7.129          Rect	  dummyRect;
   7.130          Handle    dummyHandle;
   7.131          short     itemHit;
   7.132 -
   7.133 +   #if TARGET_API_MAC_CARBON
   7.134 +        ControlRef control;
   7.135 +   #endif
   7.136 +        
   7.137          /* Assume that they will change settings, rather than do exhaustive check */
   7.138          settingsChanged = 1;
   7.139          
   7.140          /* Create dialog and display it */
   7.141 -        commandDialog = GetNewDialog (1000, nil, (DialogPtr)-1);
   7.142 +        commandDialog = GetNewDialog (1000, nil, (WindowPtr)-1);
   7.143 +    #if TARGET_API_MAC_CARBON
   7.144 +        SetPort ( GetDialogPort(commandDialog) );
   7.145 +    #else
   7.146          SetPort (commandDialog);
   7.147 -            
   7.148 +     #endif
   7.149 +           
   7.150          /* Setup controls */
   7.151 +    #if TARGET_API_MAC_CARBON
   7.152 +        GetDialogItemAsControl(commandDialog, kCL_File, &control);
   7.153 +        SetControlValue (control, prefs.output_to_file);
   7.154 +    #else
   7.155          GetDialogItem   (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
   7.156          SetControlValue ((ControlHandle)dummyHandle, prefs.output_to_file );
   7.157 +    #endif
   7.158  
   7.159          GetDialogItem     (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect);
   7.160          SetDialogItemText (dummyHandle, prefs.command_line);
   7.161  
   7.162 +    #if TARGET_API_MAC_CARBON
   7.163 +        GetDialogItemAsControl(commandDialog, kCL_Video, &control);
   7.164 +        SetControlValue (control, videodriver);
   7.165 +   #else
   7.166          GetDialogItem   (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
   7.167          SetControlValue ((ControlRef)dummyHandle, videodriver);
   7.168 +     #endif
   7.169  
   7.170          SetDialogDefaultItem (commandDialog, kCL_OK);
   7.171          SetDialogCancelItem  (commandDialog, kCL_Cancel);
   7.172 @@ -469,8 +504,13 @@
   7.173              
   7.174              /* Toggle command-line output checkbox */	
   7.175          	if ( itemHit == kCL_File ) {
   7.176 +        #if TARGET_API_MAC_CARBON
   7.177 +        		GetDialogItemAsControl(commandDialog, kCL_File, &control);
   7.178 +        		SetControlValue (control, !GetControlValue(control));
   7.179 +        #else
   7.180          		GetDialogItem(commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
   7.181          		SetControlValue((ControlHandle)dummyHandle, !GetControlValue((ControlHandle)dummyHandle) );
   7.182 +        #endif
   7.183          	}
   7.184  
   7.185          } while (itemHit != kCL_OK && itemHit != kCL_Cancel);
   7.186 @@ -479,11 +519,21 @@
   7.187          GetDialogItem     (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect); /* MJS */
   7.188          GetDialogItemText (dummyHandle, prefs.command_line);
   7.189  
   7.190 +    #if TARGET_API_MAC_CARBON
   7.191 +        GetDialogItemAsControl(commandDialog, kCL_File, &control);
   7.192 +        prefs.output_to_file = GetControlValue(control);
   7.193 +	#else
   7.194          GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */
   7.195          prefs.output_to_file = GetControlValue ((ControlHandle)dummyHandle);
   7.196 + 	#endif
   7.197  
   7.198 +    #if TARGET_API_MAC_CARBON
   7.199 +        GetDialogItemAsControl(commandDialog, kCL_Video, &control);
   7.200 +        videodriver = GetControlValue(control);
   7.201 +    #else
   7.202          GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect);
   7.203          videodriver = GetControlValue ((ControlRef)dummyHandle);
   7.204 +     #endif
   7.205  
   7.206          DisposeDialog (commandDialog);
   7.207  
   7.208 @@ -504,6 +554,7 @@
   7.209  	      break;
   7.210  	}
   7.211  
   7.212 +#if !(defined(__APPLE__) && defined(__MACH__))
   7.213      /* Redirect standard I/O to files */
   7.214  	if ( prefs.output_to_file ) {
   7.215  		freopen (STDOUT_FILE, "w", stdout);
   7.216 @@ -512,6 +563,7 @@
   7.217  		fclose (stdout);
   7.218  		fclose (stderr);
   7.219  	}
   7.220 +#endif
   7.221     
   7.222      if (settingsChanged) {
   7.223          /* Save the prefs, even if they might not have changed (but probably did) */
   7.224 @@ -519,6 +571,8 @@
   7.225              fprintf (stderr, "WARNING: Could not save preferences!\n");
   7.226      }
   7.227     
   7.228 +#if !(defined(__APPLE__) && defined(__MACH__))
   7.229 +    appNameText[0] = 0;
   7.230      getCurrentAppName (appNameText); /* check for error here ? */
   7.231  
   7.232      commandLine = (char*) malloc (appNameText[0] + prefs.command_line[0] + 2);
   7.233 @@ -553,6 +607,9 @@
   7.234     
   7.235     	/* Remove useless stdout.txt and stderr.txt */
   7.236     	cleanup_output ();
   7.237 +#else // defined(__APPLE__) && defined(__MACH__)
   7.238 +	SDL_main(argc, argv);
   7.239 +#endif
   7.240     	
   7.241  	/* Exit cleanly, calling atexit() functions */
   7.242  	exit (0);    
     8.1 --- a/src/video/SDL_video.c	Thu Aug 25 20:31:58 2005 +0000
     8.2 +++ b/src/video/SDL_video.c	Thu Sep 08 06:16:14 2005 +0000
     8.3 @@ -45,6 +45,9 @@
     8.4  
     8.5  /* Available video drivers */
     8.6  static VideoBootStrap *bootstrap[] = {
     8.7 +#ifdef ENABLE_QUARTZ
     8.8 +	&QZ_bootstrap,
     8.9 +#endif
    8.10  #ifdef ENABLE_X11
    8.11  	&X11_bootstrap,
    8.12  #endif
    8.13 @@ -93,9 +96,6 @@
    8.14  #ifdef ENABLE_DRAWSPROCKET
    8.15  	&DSp_bootstrap,
    8.16  #endif
    8.17 -#ifdef ENABLE_QUARTZ
    8.18 -	&QZ_bootstrap,
    8.19 -#endif
    8.20  #ifdef ENABLE_CYBERGRAPHICS
    8.21  	&CGX_bootstrap,
    8.22  #endif
     9.1 --- a/src/video/maccommon/SDL_lowvideo.h	Thu Aug 25 20:31:58 2005 +0000
     9.2 +++ b/src/video/maccommon/SDL_lowvideo.h	Thu Sep 08 06:16:14 2005 +0000
     9.3 @@ -28,7 +28,9 @@
     9.4  #ifndef _SDL_lowvideo_h
     9.5  #define _SDL_lowvideo_h
     9.6  
     9.7 -#if TARGET_API_MAC_CARBON
     9.8 +#if defined(__APPLE__) && defined(__MACH__)
     9.9 +#include <Carbon/Carbon.h>
    9.10 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
    9.11  #include <Carbon.h>
    9.12  #else
    9.13  #include <Quickdraw.h>
    10.1 --- a/src/video/maccommon/SDL_macevents.c	Thu Aug 25 20:31:58 2005 +0000
    10.2 +++ b/src/video/maccommon/SDL_macevents.c	Thu Sep 08 06:16:14 2005 +0000
    10.3 @@ -27,7 +27,9 @@
    10.4  
    10.5  #include <stdio.h>
    10.6  
    10.7 -#if TARGET_API_MAC_CARBON
    10.8 +#if defined(__APPLE__) && defined(__MACH__)
    10.9 +#include <Carbon/Carbon.h>
   10.10 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
   10.11  #include <Carbon.h>
   10.12  #else
   10.13  #include <Script.h>
   10.14 @@ -734,10 +736,12 @@
   10.15  #if !TARGET_API_MAC_CARBON
   10.16  /* Since we don't initialize QuickDraw, we need to get a pointer to qd */
   10.17  QDGlobals *theQD = NULL;
   10.18 +#endif
   10.19  
   10.20  /* Exported to the macmain code */
   10.21  void SDL_InitQuickDraw(struct QDGlobals *the_qd)
   10.22  {
   10.23 +#if !TARGET_API_MAC_CARBON
   10.24  	theQD = the_qd;
   10.25 +#endif
   10.26  }
   10.27 -#endif
    11.1 --- a/src/video/maccommon/SDL_macmouse.c	Thu Aug 25 20:31:58 2005 +0000
    11.2 +++ b/src/video/maccommon/SDL_macmouse.c	Thu Sep 08 06:16:14 2005 +0000
    11.3 @@ -27,7 +27,9 @@
    11.4  
    11.5  #include <stdlib.h>
    11.6  #include <stdio.h>
    11.7 -#if TARGET_API_MAC_CARBON
    11.8 +#if defined(__APPLE__) && defined(__MACH__)
    11.9 +#include <Carbon/Carbon.h>
   11.10 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
   11.11  #include <Carbon.h>
   11.12  #else
   11.13  #include <Quickdraw.h>
    12.1 --- a/src/video/maccommon/SDL_macwm.c	Thu Aug 25 20:31:58 2005 +0000
    12.2 +++ b/src/video/maccommon/SDL_macwm.c	Thu Sep 08 06:16:14 2005 +0000
    12.3 @@ -28,7 +28,9 @@
    12.4  #include <stdlib.h>
    12.5  #include <string.h>
    12.6  
    12.7 -#if TARGET_API_MAC_CARBON
    12.8 +#if defined(__APPLE__) && defined(__MACH__)
    12.9 +#include <Carbon/Carbon.h>
   12.10 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
   12.11  #include <Carbon.h>
   12.12  #else
   12.13  #include <Windows.h>
    13.1 --- a/src/video/macdsp/Makefile.am	Thu Aug 25 20:31:58 2005 +0000
    13.2 +++ b/src/video/macdsp/Makefile.am	Thu Sep 08 06:16:14 2005 +0000
    13.3 @@ -1,8 +1,8 @@
    13.4  
    13.5  ## Makefile.am for SDL using the Mac DrawSprocket video driver
    13.6  
    13.7 -noinst_LTLIBRARIES = libvideo_dsp.la
    13.8 -libvideo_dsp_la_SOURCES = $(DSP_SRCS)
    13.9 +noinst_LTLIBRARIES = libvideo_macdsp.la
   13.10 +libvideo_macdsp_la_SOURCES = $(DSP_SRCS)
   13.11  
   13.12  # The SDL Mac DrawSprocket driver sources
   13.13  DSP_SRCS = 			\
    14.1 --- a/src/video/macdsp/SDL_dspvideo.c	Thu Aug 25 20:31:58 2005 +0000
    14.2 +++ b/src/video/macdsp/SDL_dspvideo.c	Thu Sep 08 06:16:14 2005 +0000
    14.3 @@ -66,7 +66,7 @@
    14.4    System requirements (* denotes optional):
    14.5    
    14.6    1. DrawSprocket 1.7.3
    14.7 -  2. *MacOS 9 or later for hardware accelerated blit / fill
    14.8 +  2. *MacOS 9 or later (but *not* Mac OS X) for hardware accelerated blit / fill
    14.9    3. *May also require certain graphics hardware for (2). I trust that all Apple OEM
   14.10       hardware will work. Third party accelerators may work if they have QuickDraw
   14.11       acceleration in the drivers and the drivers have been updated for OS 9. The current
   14.12 @@ -130,14 +130,19 @@
   14.13  #include <stdio.h>
   14.14  #include <stdlib.h>
   14.15  
   14.16 -#if TARGET_API_MAC_CARBON
   14.17 +#if defined(__APPLE__) && defined(__MACH__)
   14.18 +#include <Carbon/Carbon.h>
   14.19 +#include <DrawSprocket/DrawSprocket.h>
   14.20 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
   14.21  #include <Carbon.h>
   14.22 +#include <DrawSprocket.h>
   14.23  #else
   14.24  #include <LowMem.h>
   14.25  #include <Gestalt.h>
   14.26  #include <Devices.h>
   14.27  #include <DiskInit.h>
   14.28  #include <QDOffscreen.h>
   14.29 +#include <DrawSprocket.h>
   14.30  #endif
   14.31  
   14.32  #include "SDL_video.h"
   14.33 @@ -145,6 +150,7 @@
   14.34  #include "SDL_error.h"
   14.35  #include "SDL_syswm.h"
   14.36  #include "SDL_sysvideo.h"
   14.37 +#include "SDL_pixels_c.h"
   14.38  #include "SDL_dspvideo.h"
   14.39  #include "SDL_macgl_c.h"
   14.40  #include "SDL_macwm_c.h"
   14.41 @@ -221,8 +227,12 @@
   14.42  static int DSp_Available(void)
   14.43  {
   14.44  	/* Check for DrawSprocket */
   14.45 +#if ! TARGET_API_MAC_OSX
   14.46  	/* This check is only meaningful if you weak-link DrawSprocketLib */  
   14.47  	return ((Ptr)DSpStartup != (Ptr)kUnresolvedCFragSymbolAddress);
   14.48 +#else
   14.49 +	return 1; // DrawSprocket.framework doesn't have it all, but it's there
   14.50 +#endif
   14.51  }
   14.52  
   14.53  static void DSp_DeleteDevice(SDL_VideoDevice *device)
   14.54 @@ -430,6 +440,7 @@
   14.55      
   14.56      SetRect (&bounds, 0, 0, 320, 240);
   14.57      
   14.58 +#if useDistantHdwrMem && useLocalHdwrMem
   14.59      err = NewGWorld (&offscreen, vformat->BitsPerPixel, &bounds, NULL, SDL_Display, useDistantHdwrMem | noNewDevice);
   14.60      if (err == noErr) {
   14.61        dsp_vram_available = SDL_TRUE;
   14.62 @@ -441,6 +452,7 @@
   14.63        DisposeGWorld (offscreen);
   14.64        dsp_agp_available = SDL_TRUE;
   14.65      }
   14.66 +#endif
   14.67    }
   14.68  }
   14.69  
   14.70 @@ -508,8 +520,9 @@
   14.71  
   14.72  static int DSp_VideoInit(_THIS, SDL_PixelFormat *vformat)
   14.73  {
   14.74 +	NumVersion dsp_version;
   14.75  	
   14.76 -	NumVersion dsp_version = DSpGetVersion ();
   14.77 +	dsp_version = DSpGetVersion ();
   14.78  	
   14.79  	if (  (dsp_version.majorRev == 1 && dsp_version.minorAndBugRev < 0x73) ||
   14.80  	      (dsp_version.majorRev < 1)  ) {                          
   14.81 @@ -615,16 +628,16 @@
   14.82  /* Various screen update functions available */
   14.83  static void DSp_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
   14.84  
   14.85 +#if ! TARGET_API_MAC_OSX
   14.86 +
   14.87  static volatile unsigned int retrace_count = 0; /* -dw- need volatile because it updates asychronously */
   14.88  
   14.89 -#if ! TARGET_API_MAC_OSX
   14.90  Boolean DSp_VBLProc ( DSpContextReference context, void *ref_con )
   14.91  {
   14.92  	retrace_count++;
   14.93  	
   14.94  	return 1; /* Darrell, is this right? */
   14.95  }
   14.96 -#endif
   14.97  
   14.98  static void DSp_SetHWError (OSStatus err, int is_agp)
   14.99  {
  14.100 @@ -650,6 +663,7 @@
  14.101  	sprintf(message, fmt, mem);
  14.102  	SDL_SetError(message);
  14.103  }
  14.104 +#endif // TARGET_API_MAC_OSX
  14.105  
  14.106  /* put up a dialog to verify display change */
  14.107  static int DSp_ConfirmSwitch () {
  14.108 @@ -671,7 +685,11 @@
  14.109    if (dialog == NULL)
  14.110  	 return (0);
  14.111    
  14.112 -  SetPort (dialog);
  14.113 +#if TARGET_API_CARBON
  14.114 +  SetPort (GetDialogPort(dialog));
  14.115 +#else
  14.116 +  SetPort ((WindowPtr) dialog);
  14.117 +#endif
  14.118    
  14.119    SetDialogDefaultItem (dialog, bCancel);
  14.120    SetDialogCancelItem  (dialog, bCancel);
  14.121 @@ -693,7 +711,8 @@
  14.122  
  14.123     } while ( item != bCancel && item != bOK && err != noErr);
  14.124  
  14.125 -  DisposeWindow (dialog);
  14.126 +
  14.127 +  DisposeDialog (dialog);
  14.128    SetPort (savePort);
  14.129    
  14.130    SetEventMask(everyEvent - autoKeyMask);
  14.131 @@ -740,9 +759,11 @@
  14.132  	SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
  14.133  {
  14.134  	
  14.135 -	DisplayIDType        display_id;
  14.136 +#if !TARGET_API_MAC_OSX
  14.137 +    DisplayIDType        display_id;
  14.138 +	Fixed freq;
  14.139 +#endif
  14.140  	DSpContextAttributes attrib;
  14.141 -	Fixed freq;
  14.142  	OSStatus err;
  14.143  	UInt32 rmask = 0, gmask = 0, bmask = 0;
  14.144  		
  14.145 @@ -924,7 +945,11 @@
  14.146  	   
  14.147  	   /* Set window color to black to avoid white flash*/
  14.148  	   GetPort (&save_port);
  14.149 +#if TARGET_API_MAC_CARBON
  14.150 +		SetPort (GetWindowPort(SDL_Window));
  14.151 +#else
  14.152  	   SetPort (SDL_Window);
  14.153 +#endif
  14.154  	      RGBForeColor (&rgb);
  14.155  	      PaintRect    (&rect);	
  14.156  	   SetPort (save_port);
  14.157 @@ -1031,6 +1056,7 @@
  14.158  		
  14.159  	SetRect (&bounds, 0, 0, width, height);
  14.160     
  14.161 + #if useDistantHdwrMem && useLocalHdwrMem
  14.162      if (dsp_vram_available) {
  14.163  	   /* try VRAM */
  14.164     	  err = NewGWorld (port, depth, &bounds, 0 , SDL_Display, useDistantHdwrMem | noNewDevice );
  14.165 @@ -1049,6 +1075,7 @@
  14.166        else   
  14.167           return (0);     
  14.168       }  
  14.169 +#endif
  14.170                    
  14.171     return (-1);  
  14.172  }
  14.173 @@ -1210,8 +1237,10 @@
  14.174  		CGrafPtr dsp_front_buffer, save_port;
  14.175  		Rect rect;
  14.176  		
  14.177 +    #if ! TARGET_API_MAC_OSX
  14.178  		unsigned int old_count;
  14.179 -		
  14.180 +	#endif
  14.181 +    	
  14.182  		/* pseudo page flipping for VRAM back buffer*/ 
  14.183  		DSpContext_GetFrontBuffer (dsp_context, &dsp_front_buffer);
  14.184  		SetRect (&rect, 0, 0, surface->w-1, surface->h-1);  	
    15.1 --- a/src/video/macrom/SDL_romvideo.c	Thu Aug 25 20:31:58 2005 +0000
    15.2 +++ b/src/video/macrom/SDL_romvideo.c	Thu Sep 08 06:16:14 2005 +0000
    15.3 @@ -28,13 +28,18 @@
    15.4  #include <stdio.h>
    15.5  #include <stdlib.h>
    15.6  
    15.7 -#if TARGET_API_MAC_CARBON
    15.8 +#if defined(__APPLE__) && defined(__MACH__)
    15.9 +#include <Carbon/Carbon.h>
   15.10 +#if USE_QUICKTIME
   15.11 +#include <QuickTime/Movies.h>
   15.12 +#endif
   15.13 +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
   15.14  #include <Carbon.h>
   15.15  /* The fullscreen code requires the QuickTime framework, and the window
   15.16     is still at the back on MacOS X, which is where this code is needed.
   15.17   */
   15.18  #if USE_QUICKTIME
   15.19 -#include <QuickTime/Movies.h>
   15.20 +#include <Movies.h>
   15.21  #endif
   15.22  #else
   15.23  #include <LowMem.h>