Date: Tue, 21 Aug 2001 03:50:01 +0200
authorSam Lantinga <slouken@libsdl.org>
Tue, 21 Aug 2001 07:19:59 +0000
changeset 1584382c38dfbee
parent 157 de04f423389a
child 159 9841293e9e86
Date: Tue, 21 Aug 2001 03:50:01 +0200
From: Max Horn <max@quendi.de>
Subject: New patch for OS X

Attached a .patch file for SDL/OSX with some nice bug fixes / enhancments.

* fixes the activation issues, which also caused the window to be
always drawn like an inactive. The close/minimize widgets now are
animated properly, too.

* the menu items are automatically adjusted to use the app name
instead of just "SDL App". I did this so that we really can use one
central SDLMain.nib file, w/o requiring developers to make a copy of
it and adjust it.

* libSDLMain now contains the proper cocoa code, not as before the
carbon code. This means apps no longer have to carry a copy of
SDLMain.m/SDLMain.h

* revamped configure.in to properly build a Cocoa/Quartz SDL lib, not
a Carbon based SDL lib
configure.in
src/main/Makefile.am
src/main/macosx/SDLMain.h
src/main/macosx/SDLMain.m
src/video/quartz/SDL_QuartzEvents.m
src/video/quartz/SDL_QuartzVideo.h
src/video/quartz/SDL_QuartzVideo.m
src/video/quartz/SDL_QuartzWM.m
     1.1 --- a/configure.in	Mon Aug 20 04:41:49 2001 +0000
     1.2 +++ b/configure.in	Tue Aug 21 07:19:59 2001 +0000
     1.3 @@ -63,10 +63,6 @@
     1.4      *-*-linux*)
     1.5          AC_PROG_CXX
     1.6          ;;
     1.7 -    *-*-darwin*)
     1.8 -        OBJC="???"
     1.9 -        AC_SUBST(OBJC)
    1.10 -        ;;
    1.11  esac
    1.12  AC_PROG_INSTALL
    1.13  AC_FUNC_ALLOCA
    1.14 @@ -1192,6 +1188,21 @@
    1.15      VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
    1.16  }
    1.17  
    1.18 +dnl Set up the Mac toolbox video driver for Mac OS X
    1.19 +CheckQUARTZ()
    1.20 +{
    1.21 +    # "MACOSX" is not an official definition, but it's commonly
    1.22 +    # accepted as a way to differentiate between what runs on X
    1.23 +    # and what runs on older Macs - while in theory "Carbon" defns
    1.24 +    # are consistent between the two, in practice Carbon is still
    1.25 +    # changing. -sts Aug 2000
    1.26 +    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
    1.27 +      -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
    1.28 +      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_MAC_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
    1.29 +    VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
    1.30 +    VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
    1.31 +}
    1.32 +
    1.33  dnl Set up the kernel statistics library for Solaris
    1.34  CheckKSTAT()
    1.35  {
    1.36 @@ -1994,17 +2005,17 @@
    1.37          ;;
    1.38      *-*-darwin* )
    1.39          # Strictly speaking, we want "Mac OS X", not "Darwin", which is
    1.40 -        # just the OS X kernel sans upper layers like Carbon.  But
    1.41 -        # config.guess comes back with "darwin", so go with the flow.
    1.42 -        ARCH=macos
    1.43 +        # just the OS X kernel sans upper layers like Carbon and Cocoa.
    1.44 +        # But config.guess comes back with "darwin", so go with the flow.
    1.45 +        ARCH=macosx
    1.46          CheckDummyVideo
    1.47          CheckDiskAudio
    1.48 -        CheckCARBON
    1.49 +        CheckQUARTZ
    1.50          CheckMacGL
    1.51          CheckPTHREAD
    1.52          # Set up files for the main() stub
    1.53 -        # COPY_ARCH_SRC(src/main, macos, SDL_main.c)
    1.54 -        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
    1.55 +        COPY_ARCH_SRC(src/main, macosx, SDLmain.m)
    1.56 +        COPY_ARCH_SRC(src/main, macosx, SDLmain.h)
    1.57          # Set up files for the audio library
    1.58          if test x$enable_audio = xyes; then
    1.59              AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
    1.60 @@ -2040,8 +2051,8 @@
    1.61              COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
    1.62          fi
    1.63          # The MacOS X platform requires special setup
    1.64 -        SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework"
    1.65 -        SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon"
    1.66 +        SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework -F/System/Library/Frameworks/Cocoa.framework"
    1.67 +        SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon -framework Cocoa"
    1.68          ;;
    1.69      *)
    1.70          AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
    1.71 @@ -2061,6 +2072,7 @@
    1.72  AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
    1.73  AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
    1.74  AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
    1.75 +AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
    1.76  
    1.77  # Set conditional variables for shared and static library selection.
    1.78  # These are not used in any Makefile.am but in sdl-config.in.
    1.79 @@ -2122,6 +2134,18 @@
    1.80  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
    1.81  CXXFLAGS="$CFLAGS"
    1.82  
    1.83 +
    1.84 +# Check for darwin at the very end and set up the Objective C compiler
    1.85 +# We do this here so that we get the full CFLAGS into OBJCFLAGS
    1.86 +case "$target" in
    1.87 +    *-*-darwin*)
    1.88 +        OBJC="cc"
    1.89 +        OBJCFLAGS="$CFLAGS"
    1.90 +        AC_SUBST(OBJC)
    1.91 +        AC_SUBST(OBJCFLAGS)
    1.92 +        ;;
    1.93 +esac
    1.94 +
    1.95  # Finally create all the generated files
    1.96  dnl Important: Any directory that you want to be in the distcheck should
    1.97  dnl            have a file listed here, so that configure generates the
     2.1 --- a/src/main/Makefile.am	Mon Aug 20 04:41:49 2001 +0000
     2.2 +++ b/src/main/Makefile.am	Tue Aug 21 07:19:59 2001 +0000
     2.3 @@ -10,7 +10,11 @@
     2.4  # Build a separate library containing the main() entry point.
     2.5  lib_LIBRARIES = libSDLmain.a
     2.6  
     2.7 +if TARGET_MACOSX
     2.8 +MAINLIB_ARCH_SRCS = SDLmain.m SDLmain.h
     2.9 +else
    2.10  MAINLIB_ARCH_SRCS = SDL_main.c
    2.11 +endif
    2.12  
    2.13  libSDLmain_a_SOURCES = $(MAINLIB_ARCH_SRCS)
    2.14  
     3.1 --- a/src/main/macosx/SDLMain.h	Mon Aug 20 04:41:49 2001 +0000
     3.2 +++ b/src/main/macosx/SDLMain.h	Tue Aug 21 07:19:59 2001 +0000
     3.3 @@ -1,7 +1,14 @@
     3.4 +/*   SDLMain.h - main entry point for our Cocoa-ized SDL app
     3.5 +       Darrell Walisser - dwaliss1@purdue.edu
     3.6 +
     3.7 +    Feel free to customize this file to suit your needs
     3.8 +*/
     3.9 +
    3.10  #import <Cocoa/Cocoa.h>
    3.11  
    3.12  @interface SDLMain : NSObject
    3.13  {
    3.14  }
    3.15  - (IBAction)quit:(id)sender;
    3.16 +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
    3.17  @end
     4.1 --- a/src/main/macosx/SDLMain.m	Mon Aug 20 04:41:49 2001 +0000
     4.2 +++ b/src/main/macosx/SDLMain.m	Tue Aug 21 07:19:59 2001 +0000
     4.3 @@ -11,6 +11,12 @@
     4.4  
     4.5  static int    gArgc;
     4.6  static char  **gArgv;
     4.7 +static NSString *gAppName = 0;
     4.8 +
     4.9 +@interface NSString (ReplaceSubString)
    4.10 +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
    4.11 +@end
    4.12 +
    4.13  
    4.14  /* The main class of the application, the application's delegate */
    4.15  @implementation SDLMain
    4.16 @@ -18,9 +24,9 @@
    4.17  /* Invoked from the Quit menu item */
    4.18  - (void) quit:(id)sender
    4.19  {
    4.20 -    	SDL_Event event;
    4.21 -	event.type = SDL_QUIT;
    4.22 -	SDL_PushEvent(&event);
    4.23 +    SDL_Event event;
    4.24 +    event.type = SDL_QUIT;
    4.25 +    SDL_PushEvent(&event);
    4.26  }
    4.27  
    4.28  /* Set the working directory to the .app's parent directory */
    4.29 @@ -29,7 +35,7 @@
    4.30      char parentdir[MAXPATHLEN];
    4.31      char *c;
    4.32      
    4.33 -    strncpy ( parentdir, gArgv[0], MAXPATHLEN );
    4.34 +    strncpy ( parentdir, gArgv[0], sizeof(parentdir) );
    4.35      c = (char*) parentdir;
    4.36      
    4.37      while (*c != '\0')     /* go to end */
    4.38 @@ -38,10 +44,35 @@
    4.39      while (*c != '/')      /* back up to parent */
    4.40          c--;
    4.41      
    4.42 -    *c = '\0';             /* cut off last part (binary name) */
    4.43 +    *c++ = '\0';             /* cut off last part (binary name) */
    4.44      
    4.45      assert ( chdir (parentdir) == 0 );   /* chdir to the binary app's parent */
    4.46      assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
    4.47 +    
    4.48 +    gAppName = [ NSString stringWithCString: c ];
    4.49 +}
    4.50 +
    4.51 +/* Fix menu to contain the real app name instead of "SDL App" */
    4.52 +- (void) fixMenu:(NSMenu *)aMenu
    4.53 +{
    4.54 +    NSRange aRange;
    4.55 +    NSEnumerator *enumerator;
    4.56 +    NSMenuItem *menuItem;
    4.57 +
    4.58 +    aRange = [[aMenu title] rangeOfString:@"SDL App"];
    4.59 +    if (aRange.length != 0)
    4.60 +        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:gAppName]];
    4.61 +
    4.62 +    enumerator = [[aMenu itemArray] objectEnumerator];
    4.63 +    while ((menuItem = [enumerator nextObject]))
    4.64 +    {
    4.65 +        aRange = [[menuItem title] rangeOfString:@"SDL App"];
    4.66 +        if (aRange.length != 0)
    4.67 +            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:gAppName]];
    4.68 +        if ([menuItem hasSubmenu])
    4.69 +            [self fixMenu: [menuItem submenu]];
    4.70 +    }
    4.71 +    [ aMenu sizeToFit ];
    4.72  }
    4.73  
    4.74  /* Called when the internal event loop has just started running */
    4.75 @@ -52,6 +83,9 @@
    4.76      /* Set the working directory to the .app's parent directory */
    4.77      [ self setupWorkingDirectory ];
    4.78  
    4.79 +    /* Set the main menu to contain the real app name instead of "SDL App" */
    4.80 +    [ self fixMenu: [ NSApp mainMenu ] ];
    4.81 +
    4.82      /* Hand off to main application code */
    4.83      status = SDL_main (gArgc, gArgv);
    4.84  
    4.85 @@ -60,6 +94,47 @@
    4.86  }
    4.87  @end
    4.88  
    4.89 +
    4.90 +@implementation NSString (ReplaceSubString)
    4.91 +
    4.92 +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
    4.93 +{
    4.94 +    unsigned int bufferSize;
    4.95 +    unsigned int selfLen = [self length];
    4.96 +    unsigned int aStringLen = [aString length];
    4.97 +    unichar *buffer;
    4.98 +    NSRange localRange;
    4.99 +    NSString *result;
   4.100 +
   4.101 +    bufferSize = selfLen + aStringLen - aRange.length;
   4.102 +    buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   4.103 +    
   4.104 +    // Get first part into buffer
   4.105 +    localRange.location = 0;
   4.106 +    localRange.length = aRange.location;
   4.107 +    [self getCharacters:buffer range:localRange];
   4.108 +    
   4.109 +    // Get middle part into buffer
   4.110 +    localRange.location = 0;
   4.111 +    localRange.length = aStringLen;
   4.112 +    [aString getCharacters:(buffer+aRange.location) range:localRange];
   4.113 +     
   4.114 +    // Get last part into buffer
   4.115 +    localRange.location = aRange.location + aRange.length;
   4.116 +    localRange.length = selfLen - localRange.location;
   4.117 +    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   4.118 +    
   4.119 +    // Build output string
   4.120 +    result = [NSString stringWithCharacters:buffer length:bufferSize];
   4.121 +    
   4.122 +    NSDeallocateMemoryPages(buffer, bufferSize);
   4.123 +    
   4.124 +    return result;
   4.125 +}
   4.126 +
   4.127 +@end
   4.128 +
   4.129 +
   4.130  #ifdef main
   4.131  #  undef main
   4.132  #endif
     5.1 --- a/src/video/quartz/SDL_QuartzEvents.m	Mon Aug 20 04:41:49 2001 +0000
     5.2 +++ b/src/video/quartz/SDL_QuartzEvents.m	Tue Aug 21 07:19:59 2001 +0000
     5.3 @@ -223,7 +223,7 @@
     5.4  }
     5.5  
     5.6  static void QZ_PumpEvents (_THIS)
     5.7 -{ 
     5.8 +{
     5.9      NSDate *distantPast;
    5.10      NSEvent *event;
    5.11      NSRect winRect;
    5.12 @@ -247,27 +247,29 @@
    5.13      
    5.14          if (event != nil) {
    5.15              unsigned int type;
    5.16 +            BOOL isForGameWin;
    5.17  
    5.18 -            #define DO_MOUSE_DOWN(button, sendToWindow)                      \
    5.19 +            #define DO_MOUSE_DOWN(button, sendToWindow) do {                 \
    5.20                  if ( inForeground ) {                                        \
    5.21                      if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) ||       \
    5.22                           NSPointInRect([event locationInWindow], winRect) )  \
    5.23                          SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);  \
    5.24 -                    else if (sendToWindow)                                   \
    5.25 -                            [ window sendEvent:event ];                      \
    5.26                  }                                                            \
    5.27                  else {                                                       \
    5.28                      QZ_DoActivate (this);                                    \
    5.29 -                }       
    5.30 -            
    5.31 -            #define DO_MOUSE_UP(button, sendToWindow)                        \
    5.32 +                }                                                            \
    5.33 +                [ NSApp sendEvent:event ];                                   \
    5.34 +                } while(0)
    5.35 +                
    5.36 +            #define DO_MOUSE_UP(button, sendToWindow) do {                   \
    5.37                  if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) ||           \
    5.38                       !NSPointInRect([event locationInWindow], titleBarRect) )\
    5.39                      SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);     \
    5.40 -                if (sendToWindow)                                            \
    5.41 -                    [ window sendEvent:event ]
    5.42 -                    
    5.43 +                [ NSApp sendEvent:event ];                                   \
    5.44 +                } while(0)
    5.45 +
    5.46              type = [ event type ];
    5.47 +            isForGameWin = (qz_window == [ event window ]);
    5.48              switch (type) {
    5.49              
    5.50              case NSLeftMouseDown:  
    5.51 @@ -351,8 +353,8 @@
    5.52              case NSFlagsChanged:
    5.53                  QZ_DoModifiers( [ event modifierFlags ] );
    5.54                  break;
    5.55 -            case NSMouseEntered: break;
    5.56 -            case NSMouseExited: break;
    5.57 +//            case NSMouseEntered: break;
    5.58 +//            case NSMouseExited: break;
    5.59              case NSAppKitDefined:
    5.60                  switch ( [ event subtype ] ) {
    5.61                  case NSApplicationActivatedEventType:
    5.62 @@ -361,14 +363,14 @@
    5.63                  case NSApplicationDeactivatedEventType:
    5.64                      QZ_DoDeactivate (this);
    5.65                      break;
    5.66 -                case NSWindowMovedEventType:
    5.67 -                    [ window sendEvent:event ];
    5.68 -                    break;
    5.69                  }
    5.70 +                [ NSApp sendEvent:event ];
    5.71                  break;
    5.72 -            case NSApplicationDefined: break;
    5.73 -            case NSPeriodic: break;
    5.74 -            case NSCursorUpdate: break;
    5.75 +//            case NSApplicationDefined: break;
    5.76 +//            case NSPeriodic: break;
    5.77 +//            case NSCursorUpdate: break;
    5.78 +            default:
    5.79 +                [ NSApp sendEvent:event ];
    5.80              }
    5.81          }
    5.82        } while (event != nil);
     6.1 --- a/src/video/quartz/SDL_QuartzVideo.h	Mon Aug 20 04:41:49 2001 +0000
     6.2 +++ b/src/video/quartz/SDL_QuartzVideo.h	Tue Aug 21 07:19:59 2001 +0000
     6.3 @@ -44,10 +44,6 @@
     6.4          - Launch times are slow, maybe prebinding will help
     6.5          - Direct framebuffer access has some artifacts, maybe a driver issue
     6.6          - Cursor in 8 bit modes is screwy
     6.7 -        - Modifier + mouse-down maps alternate mouse button, but if modifier is released
     6.8 -           before mouse button, corresponding mouse-up event is not generated.
     6.9 -        - Clicking in content activates app, but doesn't generate the activate event,
    6.10 -          and subsequent switches generate no activate/deactivate events! (OS Bug I hope)
    6.11  */
    6.12  
    6.13  #include <ApplicationServices/ApplicationServices.h>
    6.14 @@ -107,7 +103,7 @@
    6.15  #define device_bpp (this->hidden->bpp)
    6.16  #define mode_flags (this->hidden->flags)
    6.17  #define video_set (this->hidden->video_is_set)
    6.18 -#define window (this->hidden->window)
    6.19 +#define qz_window (this->hidden->window)
    6.20  #define windowView (this->hidden->view)
    6.21  
    6.22  /* Interface for hardware fill not (yet) in the public API */
     7.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Mon Aug 20 04:41:49 2001 +0000
     7.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Tue Aug 21 07:19:59 2001 +0000
     7.3 @@ -267,9 +267,9 @@
     7.4              UnlockPortBits ( [ windowView qdPort ] );
     7.5              [ windowView release  ];
     7.6          }
     7.7 -        [ window setContentView:nil ];
     7.8 -        [ window setDelegate:nil ];
     7.9 -        [ window close ];
    7.10 +        [ qz_window setContentView:nil ];
    7.11 +        [ qz_window setDelegate:nil ];
    7.12 +        [ qz_window close ];
    7.13      }
    7.14      
    7.15      /* Set pixels to null (so other code doesn't try to free it) */
    7.16 @@ -408,9 +408,9 @@
    7.17      }
    7.18  
    7.19      /* Manually create a window, avoids having a nib file resource */
    7.20 -    window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect 
    7.21 +    qz_window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect 
    7.22          styleMask:style backing:NSBackingStoreBuffered defer:NO ];
    7.23 -    if (window == nil) {
    7.24 +    if (qz_window == nil) {
    7.25          SDL_SetError ("Could not create the Cocoa window");
    7.26          return NULL;
    7.27      }
    7.28 @@ -419,12 +419,12 @@
    7.29      current->w = width;
    7.30      current->h = height;
    7.31      
    7.32 -    [ window setReleasedWhenClosed:YES ];
    7.33 +    [ qz_window setReleasedWhenClosed:YES ];
    7.34      QZ_SetCaption(this, this->wm_title, this->wm_icon);
    7.35 -    [ window setAcceptsMouseMovedEvents:YES ];
    7.36 -    [ window setViewsNeedDisplay:NO ];
    7.37 -    [ window center ];
    7.38 -    [ window setDelegate:
    7.39 +    [ qz_window setAcceptsMouseMovedEvents:YES ];
    7.40 +    [ qz_window setViewsNeedDisplay:NO ];
    7.41 +    [ qz_window center ];
    7.42 +    [ qz_window setDelegate:
    7.43          [ [ [ SDL_QuartzWindowDelegate alloc ] init ] autorelease ] ];
    7.44      
    7.45      /* For OpenGL, we set the content view to a NSOpenGLView */
    7.46 @@ -434,17 +434,17 @@
    7.47              return NULL;
    7.48          }
    7.49          
    7.50 -        [ gl_context setView: [ window contentView ] ];
    7.51 +        [ gl_context setView: [ qz_window contentView ] ];
    7.52          [ gl_context makeCurrentContext];
    7.53 -        [ window orderFront:nil ];
    7.54 +        [ qz_window makeKeyAndOrderFront:nil ];
    7.55          current->flags |= SDL_OPENGL;
    7.56      }
    7.57      /* For 2D, we set the content view to a NSQuickDrawView */
    7.58      else {
    7.59      
    7.60          windowView = [ [ NSQuickDrawView alloc ] init ];
    7.61 -        [ window setContentView:windowView ];
    7.62 -        [ window orderFront:nil ];    
    7.63 +        [ qz_window setContentView:windowView ];
    7.64 +        [ qz_window makeKeyAndOrderFront:nil ];    
    7.65          
    7.66          LockPortBits ( [ windowView qdPort ] );
    7.67          current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ windowView qdPort ] ) );
     8.1 --- a/src/video/quartz/SDL_QuartzWM.m	Mon Aug 20 04:41:49 2001 +0000
     8.2 +++ b/src/video/quartz/SDL_QuartzWM.m	Tue Aug 21 07:19:59 2001 +0000
     8.3 @@ -96,7 +96,7 @@
     8.4          /* Convert to absolute screen coordinates */
     8.5          NSPoint base, screen;
     8.6          base = NSMakePoint (p.x, p.y);
     8.7 -        screen = [ window convertBaseToScreen:base ];
     8.8 +        screen = [ qz_window convertBaseToScreen:base ];
     8.9          p.x = screen.x;
    8.10          p.y = device_height - screen.y;
    8.11          CGDisplayMoveCursorToPoint (display_id, p);
    8.12 @@ -122,16 +122,16 @@
    8.13  
    8.14  static void QZ_SetCaption    (_THIS, const char *title, const char *icon) {
    8.15  
    8.16 -    if ( window != nil ) {
    8.17 +    if ( qz_window != nil ) {
    8.18          NSString *string;
    8.19          if ( title != NULL ) {
    8.20              string = [ [ NSString alloc ] initWithCString:title ];
    8.21 -            [ window setTitle:string ];
    8.22 +            [ qz_window setTitle:string ];
    8.23              [ string release ];
    8.24          }
    8.25          if ( icon != NULL ) {
    8.26              string = [ [ NSString alloc ] initWithCString:icon ];
    8.27 -            [ window setMiniwindowTitle:string ];
    8.28 +            [ qz_window setMiniwindowTitle:string ];
    8.29              [ string release ];
    8.30          }
    8.31      }
    8.32 @@ -144,19 +144,19 @@
    8.33  static int  QZ_IconifyWindow (_THIS) { 
    8.34  
    8.35      /* Bug! minimize erases the framebuffer */
    8.36 -    if ( ! [ window isMiniaturized ] ) {
    8.37 -        [ window miniaturize:nil ];
    8.38 +    if ( ! [ qz_window isMiniaturized ] ) {
    8.39 +        [ qz_window miniaturize:nil ];
    8.40          return 1;
    8.41      }
    8.42      else {
    8.43 -        SDL_SetError ("window already iconified");
    8.44 +        SDL_SetError ("qz_window already iconified");
    8.45          return 0;
    8.46      }
    8.47  }
    8.48  
    8.49  /*
    8.50  static int  QZ_GetWMInfo  (_THIS, SDL_SysWMinfo *info) { 
    8.51 -    info->nsWindowPtr = window;
    8.52 +    info->nsWindowPtr = qz_window;
    8.53      return 0; 
    8.54  }*/
    8.55