/* OSGLUOSX.c Copyright (C) 2009 Philip Cummins, Richard F. Bannister, Paul C. Pratt You can redistribute this file and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. You should have received a copy of the license along with this file; see the file COPYING. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.*/ /* Operating System GLUe for macintosh OS X All operating system dependent code for the Macintosh platform should go here. This code is descended from Richard F. Bannister's Macintosh port of vMac, by Philip Cummins. The main entry point 'main' is at the end of this file.*/ #include "CNFGRAPI.h"#include "SYSDEPNS.h"#include "ENDIANAC.h" #include "MYOSGLUE.h" /* --- adapting to API/ABI version differences --- */ /* if UsingCarbonLib, instead of native Macho, then some APIs are missing*/#ifndef UsingCarbonLib#define UsingCarbonLib 0#endif LOCALVAR CFBundleRef AppServBunRef; LOCALVAR blnr DidApplicationServicesBun = falseblnr; LOCALFUNC blnr HaveApplicationServicesBun(void){ if (! DidApplicationServicesBun) { AppServBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.ApplicationServices")); DidApplicationServicesBun = trueblnr; } return (AppServBunRef != NULL);} #if MayFullScreen || UsingCarbonLib LOCALVAR CFBundleRef HIToolboxBunRef; LOCALVAR blnr DidHIToolboxBunRef = falseblnr; LOCALFUNC blnr HaveHIToolboxBunRef(void){ if (! DidHIToolboxBunRef) { HIToolboxBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.HIToolbox")); DidHIToolboxBunRef = trueblnr; } return (HIToolboxBunRef != NULL);} #endif LOCALVAR CFBundleRef AGLBunRef; LOCALVAR blnr DidAGLBunRef = falseblnr; LOCALFUNC blnr HaveAGLBunRef(void){ if (! DidAGLBunRef) { AGLBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.agl")); DidAGLBunRef = trueblnr; } return (AGLBunRef != NULL);} #if MayFullScreen /* SetSystemUIModeProcPtr API always not available */ typedef UInt32 MySystemUIMode;typedef OptionBits MySystemUIOptions; enum { MykUIModeNormal = 0, MykUIModeAllHidden = 3}; enum { MykUIOptionAutoShowMenuBar = 1 << 0, MykUIOptionDisableAppleMenu = 1 << 2, MykUIOptionDisableProcessSwitch = 1 << 3, MykUIOptionDisableForceQuit = 1 << 4, MykUIOptionDisableSessionTerminate = 1 << 5, MykUIOptionDisableHide = 1 << 6}; typedef OSStatus (*SetSystemUIModeProcPtr) (MySystemUIMode inMode, MySystemUIOptions inOptions);LOCALVAR SetSystemUIModeProcPtr MySetSystemUIMode = NULL;LOCALVAR blnr DidSetSystemUIMode = falseblnr; LOCALFUNC blnr HaveMySetSystemUIMode(void){ if (! DidSetSystemUIMode) { if (HaveHIToolboxBunRef()) { MySetSystemUIMode = (SetSystemUIModeProcPtr) CFBundleGetFunctionPointerForName( HIToolboxBunRef, CFSTR("SetSystemUIMode")); } DidSetSystemUIMode = trueblnr; } return (MySetSystemUIMode != NULL);} #endif /* In 10.1 or later */ typedef OSStatus (*LSCopyDisplayNameForRefProcPtr) (const FSRef *inRef, CFStringRef *outDisplayName);LOCALVAR LSCopyDisplayNameForRefProcPtr MyLSCopyDisplayNameForRef = NULL;LOCALVAR blnr DidLSCopyDisplayNameForRef = falseblnr; LOCALFUNC blnr HaveMyLSCopyDisplayNameForRef(void){ if (! DidLSCopyDisplayNameForRef) { if (HaveApplicationServicesBun()) { MyLSCopyDisplayNameForRef = (LSCopyDisplayNameForRefProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("LSCopyDisplayNameForRef")); } DidLSCopyDisplayNameForRef = trueblnr; } return (MyLSCopyDisplayNameForRef != NULL);} /* In 10.5 or later */ typedef GLboolean (*aglSetWindowRefProcPtr) (AGLContext ctx, WindowRef window);LOCALVAR aglSetWindowRefProcPtr MyaglSetWindowRef = NULL;LOCALVAR blnr DidaglSetWindowRef = falseblnr; LOCALFUNC blnr HaveMyaglSetWindowRef(void){ if (! DidaglSetWindowRef) { if (HaveAGLBunRef()) { MyaglSetWindowRef = (aglSetWindowRefProcPtr) CFBundleGetFunctionPointerForName( AGLBunRef, CFSTR("aglSetWindowRef")); } DidaglSetWindowRef = trueblnr; } return (MyaglSetWindowRef != NULL);} /* Deprecated as of 10.5 */ typedef CGrafPtr My_AGLDrawable;typedef GLboolean (*aglSetDrawableProcPtr) (AGLContext ctx, My_AGLDrawable draw);LOCALVAR aglSetDrawableProcPtr MyaglSetDrawable = NULL;LOCALVAR blnr DidaglSetDrawable = falseblnr; LOCALFUNC blnr HaveMyaglSetDrawable(void){ if (! DidaglSetDrawable) { if (HaveAGLBunRef()) { MyaglSetDrawable = (aglSetDrawableProcPtr) CFBundleGetFunctionPointerForName( AGLBunRef, CFSTR("aglSetDrawable")); } DidaglSetDrawable = trueblnr; } return (MyaglSetDrawable != NULL);} /* routines not in carbon lib */ #if UsingCarbonLib typedef CGDisplayErr(*CGGetActiveDisplayListProcPtr) ( CGDisplayCount maxDisplays, CGDirectDisplayID * activeDspys, CGDisplayCount * dspyCnt);LOCALVAR CGGetActiveDisplayListProcPtr MyCGGetActiveDisplayList = NULL;LOCALVAR blnr DidCGGetActiveDisplayList = falseblnr; LOCALFUNC blnr HaveMyCGGetActiveDisplayList(void){ if (! DidCGGetActiveDisplayList) { if (HaveApplicationServicesBun()) { MyCGGetActiveDisplayList = (CGGetActiveDisplayListProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGGetActiveDisplayList")); } DidCGGetActiveDisplayList = trueblnr; } return (MyCGGetActiveDisplayList != NULL);} #else #define HaveMyCGGetActiveDisplayList() trueblnr#define MyCGGetActiveDisplayList CGGetActiveDisplayList #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGRect(*CGDisplayBoundsProcPtr) (CGDirectDisplayID display);LOCALVAR CGDisplayBoundsProcPtr MyCGDisplayBounds = NULL;LOCALVAR blnr DidCGDisplayBounds = falseblnr; LOCALFUNC blnr HaveMyCGDisplayBounds(void){ if (! DidCGDisplayBounds) { if (HaveApplicationServicesBun()) { MyCGDisplayBounds = (CGDisplayBoundsProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayBounds")); } DidCGDisplayBounds = trueblnr; } return (MyCGDisplayBounds != NULL);} #else #define HaveMyCGDisplayBounds() trueblnr#define MyCGDisplayBounds CGDisplayBounds #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef size_t(*CGDisplayPixelsWideProcPtr) (CGDirectDisplayID display);LOCALVAR CGDisplayPixelsWideProcPtr MyCGDisplayPixelsWide = NULL;LOCALVAR blnr DidCGDisplayPixelsWide = falseblnr; LOCALFUNC blnr HaveMyCGDisplayPixelsWide(void){ if (! DidCGDisplayPixelsWide) { if (HaveApplicationServicesBun()) { MyCGDisplayPixelsWide = (CGDisplayPixelsWideProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayPixelsWide")); } DidCGDisplayPixelsWide = trueblnr; } return (MyCGDisplayPixelsWide != NULL);} #else #define HaveMyCGDisplayPixelsWide() trueblnr#define MyCGDisplayPixelsWide CGDisplayPixelsWide #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef size_t(*CGDisplayPixelsHighProcPtr) (CGDirectDisplayID display);LOCALVAR CGDisplayPixelsHighProcPtr MyCGDisplayPixelsHigh = NULL;LOCALVAR blnr DidCGDisplayPixelsHigh = falseblnr; LOCALFUNC blnr HaveMyCGDisplayPixelsHigh(void){ if (! DidCGDisplayPixelsHigh) { if (HaveApplicationServicesBun()) { MyCGDisplayPixelsHigh = (CGDisplayPixelsHighProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayPixelsHigh")); } DidCGDisplayPixelsHigh = trueblnr; } return (MyCGDisplayPixelsHigh != NULL);} #else #define HaveMyCGDisplayPixelsHigh() trueblnr#define MyCGDisplayPixelsHigh CGDisplayPixelsHigh #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGDisplayErr(*CGDisplayHideCursorProcPtr) (CGDirectDisplayID display);LOCALVAR CGDisplayHideCursorProcPtr MyCGDisplayHideCursor = NULL;LOCALVAR blnr DidCGDisplayHideCursor = falseblnr; LOCALFUNC blnr HaveMyCGDisplayHideCursor(void){ if (! DidCGDisplayHideCursor) { if (HaveApplicationServicesBun()) { MyCGDisplayHideCursor = (CGDisplayHideCursorProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayHideCursor")); } DidCGDisplayHideCursor = trueblnr; } return (MyCGDisplayHideCursor != NULL);} #else #define HaveMyCGDisplayHideCursor() trueblnr#define MyCGDisplayHideCursor CGDisplayHideCursor #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGDisplayErr(*CGDisplayShowCursorProcPtr) (CGDirectDisplayID display);LOCALVAR CGDisplayShowCursorProcPtr MyCGDisplayShowCursor = NULL;LOCALVAR blnr DidCGDisplayShowCursor = falseblnr; LOCALFUNC blnr HaveMyCGDisplayShowCursor(void){ if (! DidCGDisplayShowCursor) { if (HaveApplicationServicesBun()) { MyCGDisplayShowCursor = (CGDisplayShowCursorProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayShowCursor")); } DidCGDisplayShowCursor = trueblnr; } return (MyCGDisplayShowCursor != NULL);} #else #define HaveMyCGDisplayShowCursor() trueblnr#define MyCGDisplayShowCursor CGDisplayShowCursor #endif /* ! UsingCarbonLib */ #if 0 typedef CGDisplayErr (*CGDisplayMoveCursorToPointProcPtr) (CGDirectDisplayID display, CGPoint point);LOCALVAR CGDisplayMoveCursorToPointProcPtr MyCGDisplayMoveCursorToPoint = NULL;LOCALVAR blnr DidCGDisplayMoveCursorToPoint = falseblnr; LOCALFUNC blnr HaveMyCGDisplayMoveCursorToPoint(void){ if (! DidCGDisplayMoveCursorToPoint) { if (HaveApplicationServicesBun()) { MyCGDisplayMoveCursorToPoint = (CGDisplayMoveCursorToPointProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayMoveCursorToPoint")); } DidCGDisplayMoveCursorToPoint = trueblnr; } return (MyCGDisplayMoveCursorToPoint != NULL);} #endif /* 0 */ #if UsingCarbonLib typedef CGEventErr(*CGWarpMouseCursorPositionProcPtr) (CGPoint newCursorPosition);LOCALVAR CGWarpMouseCursorPositionProcPtr MyCGWarpMouseCursorPosition = NULL;LOCALVAR blnr DidCGWarpMouseCursorPosition = falseblnr; LOCALFUNC blnr HaveMyCGWarpMouseCursorPosition(void){ if (! DidCGWarpMouseCursorPosition) { if (HaveApplicationServicesBun()) { MyCGWarpMouseCursorPosition = (CGWarpMouseCursorPositionProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGWarpMouseCursorPosition")); } DidCGWarpMouseCursorPosition = trueblnr; } return (MyCGWarpMouseCursorPosition != NULL);} #else #define HaveMyCGWarpMouseCursorPosition() trueblnr#define MyCGWarpMouseCursorPosition CGWarpMouseCursorPosition #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGEventErr(*CGSetLocalEventsSuppressionIntervalProcPtr) (CFTimeInterval seconds);LOCALVAR CGSetLocalEventsSuppressionIntervalProcPtr MyCGSetLocalEventsSuppressionInterval = NULL;LOCALVAR blnr DidCGSetLocalEventsSuppressionInterval = falseblnr; LOCALFUNC blnr HaveMyCGSetLocalEventsSuppressionInterval(void){ if (! DidCGSetLocalEventsSuppressionInterval) { if (HaveApplicationServicesBun()) { MyCGSetLocalEventsSuppressionInterval = (CGSetLocalEventsSuppressionIntervalProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGSetLocalEventsSuppressionInterval")); } DidCGSetLocalEventsSuppressionInterval = trueblnr; } return (MyCGSetLocalEventsSuppressionInterval != NULL);} #else #define HaveMyCGSetLocalEventsSuppressionInterval() trueblnr#define MyCGSetLocalEventsSuppressionInterval \ CGSetLocalEventsSuppressionInterval #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef OSStatus (*CreateStandardAlertProcPtr) ( AlertType alertType, CFStringRef error, CFStringRef explanation, const AlertStdCFStringAlertParamRec * param, DialogRef * outAlert);LOCALVAR CreateStandardAlertProcPtr MyCreateStandardAlert = NULL;LOCALVAR blnr DidCreateStandardAlert = falseblnr; LOCALFUNC blnr HaveMyCreateStandardAlert(void){ if (! DidCreateStandardAlert) { if (HaveHIToolboxBunRef()) { MyCreateStandardAlert = (CreateStandardAlertProcPtr) CFBundleGetFunctionPointerForName( HIToolboxBunRef, CFSTR("CreateStandardAlert")); } DidCreateStandardAlert = trueblnr; } return (MyCreateStandardAlert != NULL);} #else #define HaveMyCreateStandardAlert() trueblnr#define MyCreateStandardAlert CreateStandardAlert #endif /* ! UsingCarbonLib */ Lines 1–500 of 5564. Load more
/* OSGLUOSX.c Copyright (C) 2009 Philip Cummins, Richard F. Bannister, Paul C. Pratt You can redistribute this file and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. You should have received a copy of the license along with this file; see the file COPYING. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /* Operating System GLUe for macintosh OS X All operating system dependent code for the Macintosh platform should go here. This code is descended from Richard F. Bannister's Macintosh port of vMac, by Philip Cummins. The main entry point 'main' is at the end of this file. */ #include "CNFGRAPI.h" #include "SYSDEPNS.h" #include "ENDIANAC.h" #include "MYOSGLUE.h" /* --- adapting to API/ABI version differences --- */ /* if UsingCarbonLib, instead of native Macho, then some APIs are missing */ #ifndef UsingCarbonLib #define UsingCarbonLib 0 #endif LOCALVAR CFBundleRef AppServBunRef; LOCALVAR blnr DidApplicationServicesBun = falseblnr; LOCALFUNC blnr HaveApplicationServicesBun(void) { if (! DidApplicationServicesBun) { AppServBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.ApplicationServices")); DidApplicationServicesBun = trueblnr; } return (AppServBunRef != NULL); } #if MayFullScreen || UsingCarbonLib LOCALVAR CFBundleRef HIToolboxBunRef; LOCALVAR blnr DidHIToolboxBunRef = falseblnr; LOCALFUNC blnr HaveHIToolboxBunRef(void) { if (! DidHIToolboxBunRef) { HIToolboxBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.HIToolbox")); DidHIToolboxBunRef = trueblnr; } return (HIToolboxBunRef != NULL); } #endif LOCALVAR CFBundleRef AGLBunRef; LOCALVAR blnr DidAGLBunRef = falseblnr; LOCALFUNC blnr HaveAGLBunRef(void) { if (! DidAGLBunRef) { AGLBunRef = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.agl")); DidAGLBunRef = trueblnr; } return (AGLBunRef != NULL); } #if MayFullScreen /* SetSystemUIModeProcPtr API always not available */ typedef UInt32 MySystemUIMode; typedef OptionBits MySystemUIOptions; enum { MykUIModeNormal = 0, MykUIModeAllHidden = 3 }; enum { MykUIOptionAutoShowMenuBar = 1 << 0, MykUIOptionDisableAppleMenu = 1 << 2, MykUIOptionDisableProcessSwitch = 1 << 3, MykUIOptionDisableForceQuit = 1 << 4, MykUIOptionDisableSessionTerminate = 1 << 5, MykUIOptionDisableHide = 1 << 6 }; typedef OSStatus (*SetSystemUIModeProcPtr) (MySystemUIMode inMode, MySystemUIOptions inOptions); LOCALVAR SetSystemUIModeProcPtr MySetSystemUIMode = NULL; LOCALVAR blnr DidSetSystemUIMode = falseblnr; LOCALFUNC blnr HaveMySetSystemUIMode(void) { if (! DidSetSystemUIMode) { if (HaveHIToolboxBunRef()) { MySetSystemUIMode = (SetSystemUIModeProcPtr) CFBundleGetFunctionPointerForName( HIToolboxBunRef, CFSTR("SetSystemUIMode")); } DidSetSystemUIMode = trueblnr; } return (MySetSystemUIMode != NULL); } #endif /* In 10.1 or later */ typedef OSStatus (*LSCopyDisplayNameForRefProcPtr) (const FSRef *inRef, CFStringRef *outDisplayName); LOCALVAR LSCopyDisplayNameForRefProcPtr MyLSCopyDisplayNameForRef = NULL; LOCALVAR blnr DidLSCopyDisplayNameForRef = falseblnr; LOCALFUNC blnr HaveMyLSCopyDisplayNameForRef(void) { if (! DidLSCopyDisplayNameForRef) { if (HaveApplicationServicesBun()) { MyLSCopyDisplayNameForRef = (LSCopyDisplayNameForRefProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("LSCopyDisplayNameForRef")); } DidLSCopyDisplayNameForRef = trueblnr; } return (MyLSCopyDisplayNameForRef != NULL); } /* In 10.5 or later */ typedef GLboolean (*aglSetWindowRefProcPtr) (AGLContext ctx, WindowRef window); LOCALVAR aglSetWindowRefProcPtr MyaglSetWindowRef = NULL; LOCALVAR blnr DidaglSetWindowRef = falseblnr; LOCALFUNC blnr HaveMyaglSetWindowRef(void) { if (! DidaglSetWindowRef) { if (HaveAGLBunRef()) { MyaglSetWindowRef = (aglSetWindowRefProcPtr) CFBundleGetFunctionPointerForName( AGLBunRef, CFSTR("aglSetWindowRef")); } DidaglSetWindowRef = trueblnr; } return (MyaglSetWindowRef != NULL); } /* Deprecated as of 10.5 */ typedef CGrafPtr My_AGLDrawable; typedef GLboolean (*aglSetDrawableProcPtr) (AGLContext ctx, My_AGLDrawable draw); LOCALVAR aglSetDrawableProcPtr MyaglSetDrawable = NULL; LOCALVAR blnr DidaglSetDrawable = falseblnr; LOCALFUNC blnr HaveMyaglSetDrawable(void) { if (! DidaglSetDrawable) { if (HaveAGLBunRef()) { MyaglSetDrawable = (aglSetDrawableProcPtr) CFBundleGetFunctionPointerForName( AGLBunRef, CFSTR("aglSetDrawable")); } DidaglSetDrawable = trueblnr; } return (MyaglSetDrawable != NULL); } /* routines not in carbon lib */ #if UsingCarbonLib typedef CGDisplayErr (*CGGetActiveDisplayListProcPtr) ( CGDisplayCount maxDisplays, CGDirectDisplayID * activeDspys, CGDisplayCount * dspyCnt); LOCALVAR CGGetActiveDisplayListProcPtr MyCGGetActiveDisplayList = NULL; LOCALVAR blnr DidCGGetActiveDisplayList = falseblnr; LOCALFUNC blnr HaveMyCGGetActiveDisplayList(void) { if (! DidCGGetActiveDisplayList) { if (HaveApplicationServicesBun()) { MyCGGetActiveDisplayList = (CGGetActiveDisplayListProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGGetActiveDisplayList")); } DidCGGetActiveDisplayList = trueblnr; } return (MyCGGetActiveDisplayList != NULL); } #else #define HaveMyCGGetActiveDisplayList() trueblnr #define MyCGGetActiveDisplayList CGGetActiveDisplayList #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGRect (*CGDisplayBoundsProcPtr) (CGDirectDisplayID display); LOCALVAR CGDisplayBoundsProcPtr MyCGDisplayBounds = NULL; LOCALVAR blnr DidCGDisplayBounds = falseblnr; LOCALFUNC blnr HaveMyCGDisplayBounds(void) { if (! DidCGDisplayBounds) { if (HaveApplicationServicesBun()) { MyCGDisplayBounds = (CGDisplayBoundsProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayBounds")); } DidCGDisplayBounds = trueblnr; } return (MyCGDisplayBounds != NULL); } #else #define HaveMyCGDisplayBounds() trueblnr #define MyCGDisplayBounds CGDisplayBounds #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef size_t (*CGDisplayPixelsWideProcPtr) (CGDirectDisplayID display); LOCALVAR CGDisplayPixelsWideProcPtr MyCGDisplayPixelsWide = NULL; LOCALVAR blnr DidCGDisplayPixelsWide = falseblnr; LOCALFUNC blnr HaveMyCGDisplayPixelsWide(void) { if (! DidCGDisplayPixelsWide) { if (HaveApplicationServicesBun()) { MyCGDisplayPixelsWide = (CGDisplayPixelsWideProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayPixelsWide")); } DidCGDisplayPixelsWide = trueblnr; } return (MyCGDisplayPixelsWide != NULL); } #else #define HaveMyCGDisplayPixelsWide() trueblnr #define MyCGDisplayPixelsWide CGDisplayPixelsWide #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef size_t (*CGDisplayPixelsHighProcPtr) (CGDirectDisplayID display); LOCALVAR CGDisplayPixelsHighProcPtr MyCGDisplayPixelsHigh = NULL; LOCALVAR blnr DidCGDisplayPixelsHigh = falseblnr; LOCALFUNC blnr HaveMyCGDisplayPixelsHigh(void) { if (! DidCGDisplayPixelsHigh) { if (HaveApplicationServicesBun()) { MyCGDisplayPixelsHigh = (CGDisplayPixelsHighProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayPixelsHigh")); } DidCGDisplayPixelsHigh = trueblnr; } return (MyCGDisplayPixelsHigh != NULL); } #else #define HaveMyCGDisplayPixelsHigh() trueblnr #define MyCGDisplayPixelsHigh CGDisplayPixelsHigh #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGDisplayErr (*CGDisplayHideCursorProcPtr) (CGDirectDisplayID display); LOCALVAR CGDisplayHideCursorProcPtr MyCGDisplayHideCursor = NULL; LOCALVAR blnr DidCGDisplayHideCursor = falseblnr; LOCALFUNC blnr HaveMyCGDisplayHideCursor(void) { if (! DidCGDisplayHideCursor) { if (HaveApplicationServicesBun()) { MyCGDisplayHideCursor = (CGDisplayHideCursorProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayHideCursor")); } DidCGDisplayHideCursor = trueblnr; } return (MyCGDisplayHideCursor != NULL); } #else #define HaveMyCGDisplayHideCursor() trueblnr #define MyCGDisplayHideCursor CGDisplayHideCursor #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGDisplayErr (*CGDisplayShowCursorProcPtr) (CGDirectDisplayID display); LOCALVAR CGDisplayShowCursorProcPtr MyCGDisplayShowCursor = NULL; LOCALVAR blnr DidCGDisplayShowCursor = falseblnr; LOCALFUNC blnr HaveMyCGDisplayShowCursor(void) { if (! DidCGDisplayShowCursor) { if (HaveApplicationServicesBun()) { MyCGDisplayShowCursor = (CGDisplayShowCursorProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayShowCursor")); } DidCGDisplayShowCursor = trueblnr; } return (MyCGDisplayShowCursor != NULL); } #else #define HaveMyCGDisplayShowCursor() trueblnr #define MyCGDisplayShowCursor CGDisplayShowCursor #endif /* ! UsingCarbonLib */ #if 0 typedef CGDisplayErr (*CGDisplayMoveCursorToPointProcPtr) (CGDirectDisplayID display, CGPoint point); LOCALVAR CGDisplayMoveCursorToPointProcPtr MyCGDisplayMoveCursorToPoint = NULL; LOCALVAR blnr DidCGDisplayMoveCursorToPoint = falseblnr; LOCALFUNC blnr HaveMyCGDisplayMoveCursorToPoint(void) { if (! DidCGDisplayMoveCursorToPoint) { if (HaveApplicationServicesBun()) { MyCGDisplayMoveCursorToPoint = (CGDisplayMoveCursorToPointProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGDisplayMoveCursorToPoint")); } DidCGDisplayMoveCursorToPoint = trueblnr; } return (MyCGDisplayMoveCursorToPoint != NULL); } #endif /* 0 */ #if UsingCarbonLib typedef CGEventErr (*CGWarpMouseCursorPositionProcPtr) (CGPoint newCursorPosition); LOCALVAR CGWarpMouseCursorPositionProcPtr MyCGWarpMouseCursorPosition = NULL; LOCALVAR blnr DidCGWarpMouseCursorPosition = falseblnr; LOCALFUNC blnr HaveMyCGWarpMouseCursorPosition(void) { if (! DidCGWarpMouseCursorPosition) { if (HaveApplicationServicesBun()) { MyCGWarpMouseCursorPosition = (CGWarpMouseCursorPositionProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGWarpMouseCursorPosition")); } DidCGWarpMouseCursorPosition = trueblnr; } return (MyCGWarpMouseCursorPosition != NULL); } #else #define HaveMyCGWarpMouseCursorPosition() trueblnr #define MyCGWarpMouseCursorPosition CGWarpMouseCursorPosition #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef CGEventErr (*CGSetLocalEventsSuppressionIntervalProcPtr) (CFTimeInterval seconds); LOCALVAR CGSetLocalEventsSuppressionIntervalProcPtr MyCGSetLocalEventsSuppressionInterval = NULL; LOCALVAR blnr DidCGSetLocalEventsSuppressionInterval = falseblnr; LOCALFUNC blnr HaveMyCGSetLocalEventsSuppressionInterval(void) { if (! DidCGSetLocalEventsSuppressionInterval) { if (HaveApplicationServicesBun()) { MyCGSetLocalEventsSuppressionInterval = (CGSetLocalEventsSuppressionIntervalProcPtr) CFBundleGetFunctionPointerForName( AppServBunRef, CFSTR("CGSetLocalEventsSuppressionInterval")); } DidCGSetLocalEventsSuppressionInterval = trueblnr; } return (MyCGSetLocalEventsSuppressionInterval != NULL); } #else #define HaveMyCGSetLocalEventsSuppressionInterval() trueblnr #define MyCGSetLocalEventsSuppressionInterval \ CGSetLocalEventsSuppressionInterval #endif /* ! UsingCarbonLib */ #if UsingCarbonLib typedef OSStatus (*CreateStandardAlertProcPtr) ( AlertType alertType, CFStringRef error, CFStringRef explanation, const AlertStdCFStringAlertParamRec * param, DialogRef * outAlert ); LOCALVAR CreateStandardAlertProcPtr MyCreateStandardAlert = NULL; LOCALVAR blnr DidCreateStandardAlert = falseblnr; LOCALFUNC blnr HaveMyCreateStandardAlert(void) { if (! DidCreateStandardAlert) { if (HaveHIToolboxBunRef()) { MyCreateStandardAlert = (CreateStandardAlertProcPtr) CFBundleGetFunctionPointerForName( HIToolboxBunRef, CFSTR("CreateStandardAlert")); } DidCreateStandardAlert = trueblnr; } return (MyCreateStandardAlert != NULL); } #else #define HaveMyCreateStandardAlert() trueblnr #define MyCreateStandardAlert CreateStandardAlert #endif /* ! UsingCarbonLib */