From 0acf2a02e8b99d15b939cdb7c4f150997c4cbfab Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 1 Dec 2010 12:23:16 -0800 Subject: [PATCH] Removed support for 10.3.9 Fixed building on Mac OS X 10.5 --- include/SDL_platform.h | 18 +- src/audio/macosx/SDL_coreaudio.c | 2 +- src/joystick/darwin/10.3.9-FIX/IOHIDLib.h | 874 ---------------------- src/joystick/darwin/SDL_sysjoystick.c | 4 - src/joystick/darwin/SDL_sysjoystick_c.h | 4 - src/video/cocoa/SDL_cocoaclipboard.m | 6 +- src/video/cocoa/SDL_cocoaevents.m | 2 - src/video/cocoa/SDL_cocoakeyboard.m | 12 +- src/video/cocoa/SDL_cocoamodes.m | 4 +- src/video/cocoa/SDL_cocoaopengl.m | 12 +- src/video/cocoa/SDL_cocoashape.m | 2 + src/video/cocoa/SDL_cocoavideo.h | 2 +- src/video/cocoa/SDL_cocoawindow.h | 2 +- src/video/cocoa/SDL_cocoawindow.m | 4 + 14 files changed, 33 insertions(+), 915 deletions(-) delete mode 100644 src/joystick/darwin/10.3.9-FIX/IOHIDLib.h diff --git a/include/SDL_platform.h b/include/SDL_platform.h index 90eed561c..13bdc0d74 100644 --- a/include/SDL_platform.h +++ b/include/SDL_platform.h @@ -74,8 +74,16 @@ #if defined(__APPLE__) /* lets us know what version of Mac OS X we're compiling on */ #include "AvailabilityMacros.h" -#ifdef MAC_OS_X_VERSION_10_3 -#include "TargetConditionals.h" /* this header is in 10.3 or later */ +#include "TargetConditionals.h" +#ifndef MAC_OS_X_VERSION_10_4 +#define MAC_OS_X_VERSION_10_4 1040 +#endif +#ifndef MAC_OS_X_VERSION_10_5 +#define MAC_OS_X_VERSION_10_5 1050 +#endif +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif #if TARGET_OS_IPHONE /* if compiling for iPhone */ #undef __IPHONEOS__ @@ -86,12 +94,6 @@ #undef __MACOSX__ #define __MACOSX__ 1 #endif /* TARGET_OS_IPHONE */ -#else -/* if earlier verion of Mac OS X than version 10.3 */ -#undef __MACOSX__ -#define __MACOSX__ 1 -#endif - #endif /* defined(__APPLE__) */ #if defined(__NetBSD__) diff --git a/src/audio/macosx/SDL_coreaudio.c b/src/audio/macosx/SDL_coreaudio.c index 7d453a9cd..8b56c670b 100644 --- a/src/audio/macosx/SDL_coreaudio.c +++ b/src/audio/macosx/SDL_coreaudio.c @@ -24,7 +24,7 @@ #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 #include #endif diff --git a/src/joystick/darwin/10.3.9-FIX/IOHIDLib.h b/src/joystick/darwin/10.3.9-FIX/IOHIDLib.h deleted file mode 100644 index 836a71ec3..000000000 --- a/src/joystick/darwin/10.3.9-FIX/IOHIDLib.h +++ /dev/null @@ -1,874 +0,0 @@ -/* *INDENT-OFF* */ -/* - * - * @APPLE_LICENSE_HEADER_START@ - * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _IOKIT_HID_IOHIDLIB_H_ -#define _IOKIT_HID_IOHIDLIB_H_ - -#include - -__BEGIN_DECLS -#include -#if COREFOUNDATION_CFPLUGINCOM_SEPARATE -#include -#endif - -#include -#include - -#include - -struct IOHIDEventStruct -{ - IOHIDElementType type; - IOHIDElementCookie elementCookie; - SInt32 value; - AbsoluteTime timestamp; - UInt32 longValueSize; - void * longValue; -}; -typedef struct IOHIDEventStruct IOHIDEventStruct; - -/* FA12FA38-6F1A-11D4-BA0C-0005028F18D5 */ -#define kIOHIDDeviceUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0xFA, 0x12, 0xFA, 0x38, 0x6F, 0x1A, 0x11, 0xD4, \ - 0xBA, 0x0C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) - -/* 13AA9C44-6F1B-11D4-907C-0005028F18D5 */ -#define kIOHIDDeviceFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0x13, 0xAA, 0x9C, 0x44, 0x6F, 0x1B, 0x11, 0xD4, \ - 0x90, 0x7C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) - -/* 78BD420C-6F14-11D4-9474-0005028F18D5 */ -/*! @defined kIOHIDDeviceInterfaceID - @discussion Interface ID for the IOHIDDeviceInterface. Corresponds to an - available HID device. */ -#define kIOHIDDeviceInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0x78, 0xBD, 0x42, 0x0C, 0x6F, 0x14, 0x11, 0xD4, \ - 0x94, 0x74, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) - -/* 7D0B510E-16D5-11D7-9E9B-000393992E38 */ -/*! @defined kIOHIDDeviceInterfaceID121 - @discussion Interface ID for the IOHIDDeviceInterface121. Corresponds to - an available HID device that includes methods from - IOHIDDeviceInterface. This interface is available on - IOHIDLib 1.2.1 and Mac OS X 10.2.3 or later.*/ -#define kIOHIDDeviceInterfaceID121 CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0x7d, 0xb, 0x51, 0xe, 0x16, 0xd5, 0x11, 0xd7, \ - 0x9e, 0x9b, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38) - -/* B70ABF31-16D5-11D7-AB35-000393992E38 */ -/*! @defined kIOHIDDeviceInterfaceID122 - @discussion Interface ID for the IOHIDDeviceInterface122. Corresponds to - an available HID device that includes methods from - IOHIDDeviceInterface and IOHIDDeviceInterface121. This - interface is available on IOHIDLib 1.2.2 and Mac OS X 10.3 - or later.*/ -#define kIOHIDDeviceInterfaceID122 CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0xb7, 0xa, 0xbf, 0x31, 0x16, 0xd5, 0x11, 0xd7, \ - 0xab, 0x35, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38) - -/* 8138629E-6F14-11D4-970E-0005028F18D5 */ -/*! @defined kIOHIDQueueInterfaceID - @discussion Interface ID for the kIOHIDQueueInterfaceID. Corresponds to a - queue for a specific HID device. */ -#define kIOHIDQueueInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0x81, 0x38, 0x62, 0x9E, 0x6F, 0x14, 0x11, 0xD4, \ - 0x97, 0x0E, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) - -/* 80CDCC00-755D-11D4-8E0F-0005028F18D5 */ -/*! @defined kIOHIDOutputTransactionInterfaceID - @discussion Interface ID for the kIOHIDOutputTransactionInterfaceID. - Corresponds to an output transaction for one or more report IDs - on a specific device. */ -#define kIOHIDOutputTransactionInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL,\ - 0x80, 0xCD, 0xCC, 0x00, 0x75, 0x5D, 0x11, 0xD4, \ - 0x80, 0xEF, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) - -/*! @typedef IOHIDCallbackFunction - @discussion Type and arguments of callout C function that is used when a - completion routine is called, see - IOHIDLib.h:setRemovalCallback(). - @param target void * pointer to your data, often a pointer to an object. - @param result Completion result of desired operation. - @param refcon void * pointer to more data. - @param sender Interface instance sending the completion routine. -*/ -typedef void (*IOHIDCallbackFunction) - (void * target, IOReturn result, void * refcon, void * sender); - -/*! @typedef IOHIDElementCallbackFunction - @discussion Type and arguments of callout C function that is used when a - completion routine is called, see IOHIDLib.h:setElementValue(). - @param target void * pointer to your data, often a pointer to an object. - @param result Completion result of desired operation. - @param refcon void * pointer to more data. - @param sender Interface instance sending the completion routine. - @param elementCookie Element within interface instance sending completion. -*/ -typedef void (*IOHIDElementCallbackFunction) - (void * target, - IOReturn result, - void * refcon, - void * sender, - IOHIDElementCookie elementCookie); - -/*! @typedef IOHIDReportCallbackFunction - @discussion Type and arguments of callout C function that is used when a - completion routine is called, see IOHIDLib.h:setReport(). - @param target void * pointer to your data, often a pointer to an object. - @param result Completion result of desired operation. - @param refcon void * pointer to more data. - @param sender Interface instance sending the completion routine. - @param bufferSize Size of the buffer received upon completion. -*/ -typedef void (*IOHIDReportCallbackFunction) - (void * target, - IOReturn result, - void * refcon, - void * sender, - UInt32 bufferSize); - - -/* Forward declarations of the queue and output transaction interfaces */ -struct IOHIDQueueInterface; -struct IOHIDOutputTransactionInterface; -typedef struct IOHIDQueueInterface IOHIDQueueInterface; -typedef struct IOHIDOutputTransactionInterface IOHIDOutputTransactionInterface; - -// -// IOHIDDeviceInterface Functions available in version 1.0 (10.0) and higher of Mac OS X -// -#define IOHIDDEVICEINTERFACE_FUNCS_100 \ - IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ - mach_port_t (*getAsyncPort)(void * self); \ - IOReturn (*open)(void * self, UInt32 flags); \ - IOReturn (*close)(void * self); \ - IOReturn (*setRemovalCallback)(void * self, IOHIDCallbackFunction removalCallback, \ - void * removalTarget, void * removalRefcon); \ - IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * valueEvent); \ - IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \ - IOHIDElementCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon); \ - IOReturn (*queryElementValue)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \ - IOHIDElementCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon); \ - IOReturn (*startAllQueues)(void * self); \ - IOReturn (*stopAllQueues)(void * self); \ - IOHIDQueueInterface ** (*allocQueue) (void *self); \ - IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self) - -// -// IOHIDDeviceInterface Functions available in version 1.2.1 (10.2.3) and higher of Mac OS X -// -#define IOHIDDEVICEINTERFACE_FUNCS_121 \ - IOReturn (*setReport)(void * self, IOHIDReportType reportType, UInt32 reportID, \ - void * reportBuffer, UInt32 reportBufferSize, \ - UInt32 timeoutMS, IOHIDReportCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon); \ - IOReturn (*getReport)(void * self, IOHIDReportType reportType, \ - UInt32 reportID, void * reportBuffer, \ - UInt32 * reportBufferSize, UInt32 timeoutMS, \ - IOHIDReportCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon) - -// -// IOHIDDeviceInterface Functions available in version 1.2.2 (10.3) and higher of Mac OS X -// -#define IOHIDDEVICEINTERFACE_FUNCS_122 \ - IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, \ - CFArrayRef * elements); \ - IOReturn (*setInterruptReportHandlerCallback)(void * self, void * reportBuffer, \ - UInt32 reportBufferSize, \ - IOHIDReportCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon) - -typedef struct IOHIDDeviceInterface -{ - IUNKNOWN_C_GUTS; - IOHIDDEVICEINTERFACE_FUNCS_100; - IOHIDDEVICEINTERFACE_FUNCS_121; -} IOHIDDeviceInterface; - -typedef struct IOHIDDeviceInterface121 -{ - IUNKNOWN_C_GUTS; - IOHIDDEVICEINTERFACE_FUNCS_100; - IOHIDDEVICEINTERFACE_FUNCS_121; -} IOHIDDeviceInterface121; - -typedef struct IOHIDDeviceInterface122 -{ - IUNKNOWN_C_GUTS; - IOHIDDEVICEINTERFACE_FUNCS_100; - IOHIDDEVICEINTERFACE_FUNCS_121; - IOHIDDEVICEINTERFACE_FUNCS_122; -} IOHIDDeviceInterface122; - - -// -// IOHIDQueueInterface Functions available in version 1.0 (10.0) and higher of Mac OS X -// -#define IOHIDQUEUEINTERFACE_FUNCS_100 \ - IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ - mach_port_t (*getAsyncPort)(void * self); \ - IOReturn (*create)(void * self, UInt32 flags, UInt32 depth); \ - IOReturn (*dispose)(void * self); \ - IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie, UInt32 flags);\ - IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \ - Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \ - IOReturn (*start)(void * self); \ - IOReturn (*stop)(void * self); \ - IOReturn (*getNextEvent)(void * self, IOHIDEventStruct * event, \ - AbsoluteTime maxTime, UInt32 timeoutMS); \ - IOReturn (*setEventCallout)(void * self, IOHIDCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon); \ - IOReturn (*getEventCallout)(void * self, IOHIDCallbackFunction * outCallback, \ - void ** outCallbackTarget, void ** outCallbackRefcon) - -struct IOHIDQueueInterface -{ - IUNKNOWN_C_GUTS; - IOHIDQUEUEINTERFACE_FUNCS_100; -}; - -// -// IOHIDOutputTransactionInterface Functions available in version 1.2 (10.2) and higher of Mac OS X -// -#define IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120 \ - IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ - mach_port_t (*getAsyncPort)(void * self); \ - IOReturn (*create)(void * self); \ - IOReturn (*dispose)(void * self); \ - IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie); \ - IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \ - Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \ - IOReturn (*setElementDefault)(void *self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * valueEvent); \ - IOReturn (*getElementDefault)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * outValueEvent); \ - IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * valueEvent); \ - IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \ - IOHIDEventStruct * outValueEvent); \ - IOReturn (*commit)(void * self, UInt32 timeoutMS, IOHIDCallbackFunction callback, \ - void * callbackTarget, void * callbackRefcon); \ - IOReturn (*clear)(void * self) - -struct IOHIDOutputTransactionInterface -{ - IUNKNOWN_C_GUTS; - IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120; -}; - - -// -// BEGIN READABLE STRUCTURE DEFINITIONS -// -// This portion of uncompiled code provides a more reader friendly representation of -// the CFPlugin methods defined above. - -#if 0 -/*! @class IOHIDDeviceInterface - @discussion CFPlugin object subclass which provides the primary interface to - HID devices. -*/ -typedef struct IOHIDDeviceInterface -{ - - IUNKNOWN_C_GUTS; - -/*! @function createAsyncEventSource - @abstract Creates async eventsource. - @discussion This method will create an async mach port, if one - has not already been created. - @param source Reference to CFRunLoopSourceRef that is created. - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncEventSource)(void * self, - CFRunLoopSourceRef * source); - -/*! @function getAsyncEventSource - @abstract Gets the created async event source. - @result Returns a CFRunLoopSourceRef. -*/ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); - -/*! @function createAsyncPort - @abstract Creates an async port. - @discussion The port must be created before any callbacks can be used. - @param port Reference to mach port that is created. - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); - -/*! @function getAsyncPort - @abstract Gets the current async port. - @result Returns a mach_port_t. -*/ - mach_port_t (*getAsyncPort)(void * self); - -/*! @function open - @abstract Opens the device. - @param flags Flags to be passed down to the user client. - @result Returns an IOReturn code. -*/ - IOReturn (*open)(void * self, UInt32 flags); - -/*! @function close - @abstract Closes the device. - @result Returns an IOReturn code. -*/ - IOReturn (*close)(void * self); - -/*! @function setRemovalCallback - @abstract Sets callback to be used when device is removed. - @param removalCallback Called when the device is removed. - @param removeTarget Passed to the callback. - @param removalRefcon Passed to the callback. - @result Returns an IOReturn code. -*/ - IOReturn (*setRemovalCallback)(void * self, - IOHIDCallbackFunction removalCallback, - void * removalTarget, - void * removalRefcon); - -/*! @function getElementValue - @abstract Obtains the most recent value of an element. - @discussion This call is most useful for interrupt driven elements, - such as input type elements. Since feature type element values - need to be polled from the device, it is recommended to use the - queryElementValue method to obtain the current value. The - timestamp field in the event details the last time the element - value was altered. - @param elementCookie The element of interest. - @param valueEvent The event that will be filled. If a long value is - present, it is up to the caller to deallocate it. - @result Returns an IOReturn code. -*/ - IOReturn (*getElementValue)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * valueEvent); - -/*! @function setElementValue - @abstract Sets an element value on the device. - @discussion This call is most useful for feature type elements. It is - recommended to use IOOutputTransaction for output type elements. - @param elementCookie The element of interest. - @param valueEvent The event that will be filled. If a long value is - present, it will be copied. - @param timeoutMS UNSUPPORTED. - @param callback UNSUPPORTED. - @param callbackTarget UNSUPPORTED. - @param callbackRefcon UNSUPPORTED. - @result Returns an IOReturn code. -*/ - IOReturn (*setElementValue)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * valueEvent, - UInt32 timeoutMS, - IOHIDElementCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -/*! @function queryElementValue - @abstract Obtains the current value of an element. - @discussion This call is most useful for feature type elements. This - method will poll the device for the current element value. - @param elementCookie The element of interest. - @param valueEvent The event that will be filled. If a long value is - present, it is up to the caller to deallocate it. - @param timeoutMS UNSUPPORTED. - @param callback UNSUPPORTED. - @param callbackTarget UNSUPPORTED. - @param callbackRefcon UNSUPPORTED. - @result Returns an IOReturn code. -*/ - IOReturn (*queryElementValue)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * valueEvent, - UInt32 timeoutMS, - IOHIDElementCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -/*! @function startAllQueues - @abstract Starts data delivery on all queues for this device. - @result Returns an IOReturn code. -*/ - IOReturn (*startAllQueues)(void * self); - -/*! @function stopAllQueues - @abstract Stops data delivery on all queues for this device. - @result Returns an IOReturn code. -*/ - IOReturn (*stopAllQueues)(void * self); - -/*! @function allocQueue - @abstract Wrapper to return instances of the IOHIDQueueInterface. - @result Returns the created IOHIDQueueInterface. -*/ - IOHIDQueueInterface ** (*allocQueue) (void *self); - -/*! @function allocOutputTransaction - @abstract Wrapper to return instances of the IOHIDOutputTransactionInterface. - @result Returns the created IOHIDOutputTransactionInterface. -*/ - IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self); - -} IOHIDDeviceInterface; - -/*! @class IOHIDDeviceInterface121 - @discussion CFPlugin object subclass which provides the primary interface to - HID devices. This class is a subclass of IOHIDDeviceInterface. -*/ -typedef struct IOHIDDeviceInterface121 -{ - - IUNKNOWN_C_GUTS; - IOHIDDEVICEINTERFACE_FUNCS_100; - -/*! @function setReport - @abstract Sends a report to the device. - @param reportType The report type. - @param reportID The report id. - @param reportBuffer Pointer to a preallocated buffer. - @param reportBufferSize Size of the reportBuffer in bytes. - @param timeoutMS - @param callback If null, this method will behave synchronously. - @param callbackTarget The callback target passed to the callback. - @param callbackRefcon The callback refcon passed to the callback. - @result Returns an IOReturn code. -*/ - IOReturn (*setReport) (void * self, - IOHIDReportType reportType, - UInt32 reportID, - void * reportBuffer, - UInt32 reportBufferSize, - UInt32 timeoutMS, - IOHIDReportCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -/*! @function getReport - @abstract Obtains a report from the device. - @param reportType The report type. - @param reportID The report ID. - @param reportBuffer Pointer to a preallocated buffer. - @param reportBufferSize Size of the reportBuffer in bytes. - When finished, will contain the actual size of the report. - @param timeoutMS - @param callback If null, this method will behave synchronously. - @param callbackTarget The callback target passed to the callback. - @param callbackRefcon The callback refcon passed to the callback. - @result Returns an IOReturn code. -*/ - IOReturn (*getReport) (void * self, - IOHIDReportType reportType, - UInt32 reportID, - void * reportBuffer, - UInt32 * reportBufferSize, - UInt32 timeoutMS, - IOHIDReportCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -}IOHIDDeviceInterface121; - -/*! @class IOHIDDeviceInterface122 - @discussion CFPlugin object subclass which provides the primary interface to - HID devices. This class is a subclass of IOHIDDeviceInterface121. -*/ -typedef struct IOHIDDeviceInterface122 -{ - - IUNKNOWN_C_GUTS; - IOHIDDEVICEINTERFACE_FUNCS_100; - IOHIDDEVICEINTERFACE_FUNCS_121; - -/*! @function copyMatchingElements - @abstract Obtains specific elements defined by the device. - @discussion Using keys defined in IOHIDKeys.h for elements, create a - matching dictonary containing items that you wish to search for. - A null array indicates that no elements matching that criteria - were found. Each item in the array is a reference to the same - dictionary item that represents each element in the I/O Registry. - It is up to the caller to release the returned array of elements. - @param matchingDict Dictionary containg key/value pairs to match on. Pass - a null value to match on all elements. - @param elements Pointer to a CFArrayRef that will be returned by this - method. It is up to the caller to release it when finished. - @result Returns an IOReturn code. -*/ - IOReturn (*copyMatchingElements)(void * self, - CFDictionaryRef matchingDict, - CFArrayRef * elements); - -/*! @function setInterruptReportHandlerCallback - @abstract Sets the report handler callout to be called when the data - is received from the Interrupt-In pipe. - @discussion In order for this to work correctly, you must call - createAsyncPort and createAsyncEventSource. - @param reportBuffer Pointer to a preallocated buffer. - @param reportBufferSize Size of the reportBuffer in bytes. - @param callback If non-NULL, is a callback to be called when data - is received from the device. - @param callbackTarget The callback target passed to the callback - @param callbackRefcon The callback refcon passed to the callback. - @result Returns an IOReturn code. -*/ - IOReturn (*setInterruptReportHandlerCallback)( - void * self, - void * reportBuffer, - UInt32 reportBufferSize, - IOHIDReportCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -}IOHIDDeviceInterface122; - -/*! @class IOHIDQueueInterface - @discussion CFPlugin object subclass which provides an interface for input - queues from HID devices. Created by an IOHIDDeviceInterface - object. -*/ -typedef struct IOHIDQueueInterface -{ - - IUNKNOWN_C_GUTS; - -/*! @function createAsyncEventSource - @abstract Creates an async event source. - @discussion This will be used with setEventCallout. - @param source The newly created event source. - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncEventSource)(void * self, - CFRunLoopSourceRef * source); - -/*! @function getAsyncEventSource - @abstract Obtains the current event source. - @result Returns a CFRunLoopSourceRef. -*/ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); - -/*! @function createAsyncPort - @abstract Creates an async port. - @discussion This will be used with createAsyncEventSource. - @param port The newly created async port. - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); - -/*! @function getAsyncPort - @abstract Obtains the current async port. - @result Returns a mach_port_t. -*/ - mach_port_t (*getAsyncPort)(void * self); - -/*! @function create - @abstract Creates the current queue. - @param flags - @param depth The maximum number of elements in the queue - before the oldest elements in the queue begin to be lost. - @result Returns an IOReturn code. -*/ - IOReturn (*create)(void * self, - UInt32 flags, - UInt32 depth); - -/*! @function create - @abstract Disposes of the current queue. - @result Returns an IOReturn code. -*/ - IOReturn (*dispose)(void * self); - -/*! @function addElement - @abstract Adds an element to the queue. - @discussion If the element has already been added to queue, - an error will be returned. - @param elementCookie The element of interest. - @param flags - @result Returns an IOReturn code. -*/ - IOReturn (*addElement)(void * self, - IOHIDElementCookie elementCookie, - UInt32 flags); - -/*! @function removeElement - @abstract Removes an element from the queue. - @discussion If the element has not been added to queue, - an error will be returned. - @param elementCookie The element of interest. - @result Returns an IOReturn code. -*/ - IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); - -/*! @function hasElement - @abstract Checks whether an element has been added to - the queue. - @discussion Will return true if present, otherwise will return false. - @param elementCookie The element of interest. - @result Returns a Boolean value. -*/ - Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); - -/*! @function start - @abstract Starts event delivery to the queue. - @result Returns an IOReturn code. -*/ - IOReturn (*start)(void * self); - -/*! @function stop - @abstract Stops event delivery to the queue. - @result Returns an IOReturn code. -*/ - IOReturn (*stop)(void * self); - -/*! @function getNextEvent - @abstract Reads next event from the queue. - @param event The event that will be filled. If a long value is - present, it is up to the caller to deallocate it. - @param maxtime UNSUPPORTED. If non-zero, limits read events to - those that occured on or before maxTime. - @param timoutMS UNSUPPORTED. The timeout in milliseconds, a zero - timeout will cause this call to be non-blocking (returning - queue empty) if there is a NULL callback, and blocking forever - until the queue is non-empty if there is a valid callback. - @result Returns an IOReturn code. -*/ - IOReturn (*getNextEvent)(void * self, - IOHIDEventStruct * event, - AbsoluteTime maxTime, - UInt32 timeoutMS); - -/*! @function setEventCallout - @abstract Sets the event callout to be called when the queue - transitions to non-empty. - @discussion In order for this to work correctly, you must call - createAsyncPort and createAsyncEventSource. - @param callback if non-NULL is a callback to be called when data - is inserted to the queue - @param callbackTarget The callback target passed to the callback - @param callbackRefcon The callback refcon passed to the callback. - @result Returns an IOReturn code. -*/ - IOReturn (*setEventCallout)(void * self, - IOHIDCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -/*! @function getEventCallout - @abstract Gets the event callout. - @discussion This callback will be called the queue transitions - to non-empty. - @param callback if non-NULL is a callback to be called when data - is inserted to the queue - @param callbackTarget The callback target passed to the callback - @param callbackRefcon The callback refcon passed to the callback - @result Returns an IOReturn code. -*/ - IOReturn (*getEventCallout)(void * self, - IOHIDCallbackFunction * outCallback, - void ** outCallbackTarget, - void ** outCallbackRefcon); -} IOHIDQueueInterface; - -/*! @class IOHIDOutputTransactionInterface - @discussion CFPlugin object subclass which privides interface for output - transactions to HID devices. Created by a IOHIDDeviceInterface - object. */ - -typedef struct IOHIDOutputTransactionInterface -{ - IUNKNOWN_C_GUTS; - -/*! @function createAsyncEventSource - @abstract Creates an async event source. - @discussion This will be used with setEventCallout. - @param source The newly created event source - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncEventSource)(void * self, - CFRunLoopSourceRef * source); - -/*! @function getAsyncEventSource - @abstract Obtains the current event source. - @result Returns a CFRunLoopSourceRef. -*/ - CFRunLoopSourceRef (*getAsyncEventSource)(void * self); - -/*! @function createAsyncPort - @abstract Creates an async port. - @discussion This will be used with createAsyncEventSource. - @param port The newly created async port. - @result Returns an IOReturn code. -*/ - IOReturn (*createAsyncPort)(void * self, mach_port_t * port); - -/*! @function getAsyncPort - @abstract Obtains the current async port. - @result Returns a mach_port_t. -*/ - mach_port_t (*getAsyncPort)(void * self); - -/*! @function create - @abstract Creates the current transaction. - @discussion This method will free any memory that has been - allocated for this transaction. - @result Returns an IOReturn code. -*/ - IOReturn (*create)(void * self); - -/*! @function dispose - @abstract Disposes of the current transaction. - @discussion The transaction will have to be recreated, in order - to perform any operations on the transaction. - @result Returns an IOReturn code. -*/ - IOReturn (*dispose)(void * self); - -/*! @function addElement - @abstract Adds an element to the transaction. - @discussion If the element has already been added to transaction, - an error will be returned. - @param elementCookie The element of interest. - @result Returns an IOReturn code. -*/ - IOReturn (*addElement) (void * self, IOHIDElementCookie elementCookie); - -/*! @function removeElement - @abstract Removes an element from the transaction. - @discussion If the element has not been added to transaction, - an error will be returned. - @param elementCookie The element of interest. - @result Returns an IOReturn code. -*/ - IOReturn (*removeElement) (void * self, IOHIDElementCookie elementCookie); - -/*! @function hasElement - @abstract Checks whether an element has been added to - the transaction. - @discussion Will return true if present, otherwise will return false. - @param elementCookie The element of interest. - @result Returns a Boolean value. -*/ - Boolean (*hasElement) (void * self, IOHIDElementCookie elementCookie); - -/*! @function setElementDefault - @abstract Sets the default value of an element in a - transaction. - @discussion An error will be returned if the element has not been - added to the transaction. - @param elementCookie The element of interest. - @param valueEvent The event that will be filled. If a long value is - present, it will be copied. - @result Returns an IOReturn code. -*/ - IOReturn (*setElementDefault)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * valueEvent); - -/*! @function getElementDefault - @abstract Obtains the default value of an element in a - transaction. - @discussion An error will be returned if the element has not been - added to the transaction. - @param elementCookie The element of interest. - @param outValueEvent The event that will be filled. If a long value is - present, it is up to the caller to deallocate it. - @result Returns an IOReturn code. -*/ - IOReturn (*getElementDefault)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * outValueEvent); - -/*! @function setElementValue - @abstract Sets the value of an element in a transaction. - @discussion An error will be returned if the element has not been - added to the transaction. - @param elementCookie The element of interest. - @param valueEvent The event that will be filled. If a long value is - present, it will be copied. - @result Returns an IOReturn code. -*/ - IOReturn (*setElementValue)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * valueEvent); - -/*! @function getElementValue - @abstract Obtains the value of an element in a transaction. - @discussion An error will be returned if the element has not been - added to the transaction. - @param elementCookie The element of interest. - @param outValueEvent The event that will be filled. If a long value is - present, it is up to the caller to deallocate it. - @result Returns an IOReturn code. -*/ - IOReturn (*getElementValue)(void * self, - IOHIDElementCookie elementCookie, - IOHIDEventStruct * outValueEvent); - -/*! @function commit - @abstract Commits the transaction. - @discussion Transaction element values, if set, will be sent to the - device. Otherwise, the default element value will be used. If - neither are set, that element will be omitted from the commit. - After a transaction is committed, transaction element values - will be cleared. Default values will be preserved. - @param timeoutMS UNSUPPORTED - @param callback UNSUPPORTED - @param callbackTarget UNSUPPORTED - @param callbackRefcon UNSUPPORTED - @result Returns an IOReturn code. -*/ - IOReturn (*commit)(void * self, - UInt32 timeoutMS, - IOHIDCallbackFunction callback, - void * callbackTarget, - void * callbackRefcon); - -/*! @function clear - @abstract Clears the transaction. - @discussion Transaction element values will cleared. Default - values will be preserved. - @result Returns an IOReturn code. -*/ - IOReturn (*clear)(void * self); -} IOHIDOutputTransactionInterface; - -#endif - -__END_DECLS - -#endif /* !_IOKIT_HID_IOHIDLIB_H_ */ diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index 04c1a1acb..824917f2d 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -39,11 +39,7 @@ /* The header was moved here in Mac OS X 10.1 */ #include #endif -#if MAC_OS_X_VERSION_MIN_REQUIRED == 1030 -#include "10.3.9-FIX/IOHIDLib.h" -#else #include -#endif #include #include #include /* for NewPtrClear, DisposePtr */ diff --git a/src/joystick/darwin/SDL_sysjoystick_c.h b/src/joystick/darwin/SDL_sysjoystick_c.h index d413f3366..6e978458f 100644 --- a/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/src/joystick/darwin/SDL_sysjoystick_c.h @@ -24,11 +24,7 @@ #ifndef SDL_JOYSTICK_IOKIT_H -#if MAC_OS_X_VERSION_MIN_REQUIRED == 1030 -#include "10.3.9-FIX/IOHIDLib.h" -#else #include -#endif #include diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 26f6aeed2..f70e002f1 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -27,9 +27,7 @@ static NSString * GetTextFormat(_THIS) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - return NSStringPboardType; -#else +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; if (data->osversion >= 0x1060) { @@ -37,6 +35,8 @@ } else { return NSStringPboardType; } +#else + return NSStringPboardType; #endif } diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 6a40b886f..3c1055101 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -36,11 +36,9 @@ #endif /* setAppleMenu disappeared from the headers in 10.4 */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @interface NSApplication(NSAppleMenu) - (void)setAppleMenu:(NSMenu *)menu; @end -#endif @implementation NSApplication(SDL) - (void)setRunning diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 13756cc3c..0d7c400ad 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -171,7 +171,11 @@ - (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange } /* Needs long instead of NSInteger for compilation on Mac OS X 10.4 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - (long) conversationIdentifier +#else +- (NSInteger) conversationIdentifier +#endif { return (long) self; } @@ -478,7 +482,7 @@ - (NSArray *) validAttributesForMarkedText static void UpdateKeymap(SDL_VideoData *data) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 TISInputSourceRef key_layout; #else KeyboardLayoutRef key_layout; @@ -489,7 +493,7 @@ - (NSArray *) validAttributesForMarkedText SDLKey keymap[SDL_NUM_SCANCODES]; /* See if the keymap needs to be updated */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 key_layout = TISCopyCurrentKeyboardLayoutInputSource(); #else KLGetCurrentKeyboardLayout(&key_layout); @@ -502,7 +506,7 @@ - (NSArray *) validAttributesForMarkedText SDL_GetDefaultKeymap(keymap); /* Try Unicode data first (preferred as of Mac OS X 10.5) */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData); if (uchrDataRef) chr_data = CFDataGetBytePtr(uchrDataRef); @@ -544,7 +548,7 @@ - (NSArray *) validAttributesForMarkedText return; } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 cleanup: CFRelease(key_layout); #else diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 4b120a68e..2b6d09a08 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -23,7 +23,7 @@ #include "SDL_cocoavideo.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 /* Add methods to get at private members of NSScreen. Since there is a bug in Apple's screen switching code @@ -290,7 +290,7 @@ - (void) setFrame:(NSRect)frame; [[NSApp mainWindow] makeKeyAndOrderFront: nil]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 /* There is a bug in Cocoa where NSScreen doesn't synchronize with CGDirectDisplay, so the main screen's frame is wrong. diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 41ab75d98..c2f6b44f1 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -36,16 +36,6 @@ #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" -/* This is implemented in Mac OS X 10.3 and above */ -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 -@implementation NSOpenGLContext(CGLContextAccess) -- (CGLContextObj)CGLContextObj; -{ - return _contextAuxiliary; -} -@end -#endif /* < 10.3 */ - int Cocoa_GL_LoadLibrary(_THIS, const char *path) { @@ -180,7 +170,7 @@ - (CGLContextObj)CGLContextObj; #endif { - long cache_max = 64; + GLint cache_max = 64; CGLContextObj ctx = [context CGLContextObj]; CGLSetParameter (ctx, GLI_SUBMIT_FUNC_CACHE_MAX, &cache_max); CGLSetParameter (ctx, GLI_ARRAY_FUNC_CACHE_MAX, &cache_max); diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 78ee73a10..4ee560183 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/src/video/cocoa/SDL_cocoashape.m @@ -29,7 +29,9 @@ Cocoa_CreateShaper(SDL_Window* window) { SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; [windata->nswindow setOpaque:NO]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 [windata->nswindow setStyleMask:NSBorderlessWindowMask]; +#endif SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 890624bfb..6344f8b08 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -40,7 +40,7 @@ #include "SDL_cocoaopengl.h" #include "SDL_cocoawindow.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 #if __LP64__ typedef long NSInteger; typedef unsigned long NSUInteger; diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index 574642bd5..0744f983f 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -29,7 +29,7 @@ typedef struct SDL_WindowData SDL_WindowData; /* *INDENT-OFF* */ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 @interface Cocoa_WindowListener : NSResponder { #else @interface Cocoa_WindowListener : NSResponder { diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index d81d9c543..06f6acf8d 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -61,7 +61,9 @@ - (void)listen:(SDL_WindowData *)data [center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp]; [_data->nswindow setAcceptsMouseMovedEvents:YES]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 [[_data->nswindow contentView] setAcceptsTouchEvents:YES]; +#endif } - (void)close @@ -293,6 +295,7 @@ - (void)touchesCancelledWithEvent:(NSEvent *) theEvent - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 NSSet *touches = 0; NSEnumerator *enumerator; NSTouch *touch; @@ -354,6 +357,7 @@ - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event touch = (NSTouch*)[enumerator nextObject]; } +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 */ } @end