OS X Compile Solution (pre-10.6)

OK, as I promised, I grabbed the tip and attempted a compile. This was on a 10.6 box, but with everything set to generate ONLY for the 10.4 SDK. This same thing should work for the 10.5 SDK. Does it make a good library? I have no idea, I only got it to compile.

The problem: The “touch” interface is 10.6 only.

The solution:

(Note: line numbers of approximate because they moved after I added lines, obviously – check the code.)=======================================================================================================================

Duplicated the “Deployment_for_official_releases_using_10.4SDK_and_10.6SDK” to create
Deployment_using_10.4SDK

Made these changes to target:
Architecture to 32 bit universal
(this eliminated the 10.6 calls as they are 64 bit intel – getting the 64 bit build back is just a little bit more work but I skipped it for now)
Added SDL_OSX_DISABLE_TOUCH=1 to preprocessor macros for my new target
(obviously) set project to this target.

Then I added some ifndefs in two pieces of code:

In the file “SDL_cocoawindow.h”:

around line 67:

#ifndef SDL_OSX_DISABLE_TOUCH
-(void) touchesBeganWithEvent:(NSEvent *) theEvent;
-(void) touchesMovedWithEvent:(NSEvent *) theEvent;
-(void) touchesEndedWithEvent:(NSEvent *) theEvent;
-(void) touchesCancelledWithEvent:(NSEvent *) theEvent;
#endif

around line 81:

#ifndef SDL_OSX_DISABLE_TOUCH
-(void) handleTouches:(cocoaTouchType)type withEvent:(NSEvent*) event;
#endif

In the file SDL_cocoawindow.m

around line 65:

#ifndef SDL_OSX_DISABLE_TOUCH
[[_data->nswindow contentView] setAcceptsTouchEvents:YES];
#endif

around line 277:

#ifndef SDL_OSX_DISABLE_TOUCH

  • (void)touchesBeganWithEvent:(NSEvent *) theEvent
    {
    [self handleTouches:COCOA_TOUCH_DOWN withEvent:theEvent];
    }



… (go down to around 364, at the end of the handleTouches function)

    touch = (NSTouch*)[enumerator nextObject];
}

}

#endif

@end

=======================================================================================================================

This allows it to compile and build.

NOW: Why is it including X11 files in the compile? Is this necessary? If so, why? If not, this also needs to be cleaned up.

NEXT: What to do about the touch interface? Should there be a 10.6 only and 10.4 compile? This might be the best way to handle this, but it’s not my project so I’m only laying that out there.

[>] Brian