X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb5246bead0df931f25bd73c9a03c356b180fcd1..a8d2fb31cbf09dcc4683c9566ff4bc89580f268c:/src/mac/carbon/utils.cpp?ds=inline diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 1aff6d1778..b3756d3fa3 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -735,8 +735,10 @@ void wxMacWakeUp() if ( isSame ) { #if TARGET_CARBON - static wxMacCarbonEvent s_wakeupEvent ; OSStatus err = noErr ; +#if 0 + // lead sometimes to race conditions, although all calls used should be thread safe ... + static wxMacCarbonEvent s_wakeupEvent ; if ( !s_wakeupEvent.IsValid() ) { err = s_wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), @@ -744,12 +746,20 @@ void wxMacWakeUp() } if ( err == noErr ) { + if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) ) return ; s_wakeupEvent.SetCurrentTime() ; err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent, - kEventPriorityHigh); + kEventPriorityHigh ); } +#else + wxMacCarbonEvent wakeupEvent ; + wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), + kEventAttributeNone ) ; + err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, + kEventPriorityHigh ); +#endif #else PostEvent( nullEvent , 0 ) ; #endif @@ -1537,23 +1547,34 @@ CMProfileRef wxMacOpenGenericProfile(void) return it whenever this function is called. */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 +#define kCGColorSpaceGenericRGB CFSTR("kCGColorSpaceGenericRGB") +#endif + CGColorSpaceRef wxMacGetGenericRGBColorSpace() { - static CGColorSpaceRef genericRGBColorSpace = NULL; - - if (genericRGBColorSpace == NULL) - { - CMProfileRef genericRGBProfile = wxMacOpenGenericProfile(); + static wxMacCFRefHolder genericRGBColorSpace ; - if (genericRGBProfile) + if (genericRGBColorSpace == NULL) + { + if ( UMAGetSystemVersion() >= 0x1040 ) { - genericRGBColorSpace = CGColorSpaceCreateWithPlatformColorSpace(genericRGBProfile); - wxASSERT_MSG( genericRGBColorSpace != NULL, wxT("couldn't create the generic RGB color space") ) ; - - // we opened the profile so it is up to us to close it - CMCloseProfile(genericRGBProfile); + genericRGBColorSpace.Set( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ) ) ; } - } + else + { + CMProfileRef genericRGBProfile = wxMacOpenGenericProfile(); + + if (genericRGBProfile) + { + genericRGBColorSpace.Set( CGColorSpaceCreateWithPlatformColorSpace(genericRGBProfile) ) ; + wxASSERT_MSG( genericRGBColorSpace != NULL, wxT("couldn't create the generic RGB color space") ) ; + + // we opened the profile so it is up to us to close it + CMCloseProfile(genericRGBProfile); + } + } + } return genericRGBColorSpace; } #endif