From 6fa258860e0dd0989112278fba17c4405285972f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Sep 2014 12:42:22 +0000 Subject: [PATCH] Fix wxOSX build with < 10.9 SDK after r77511. We need to guard the use of 10.9+ symbols such as NSActivityOptions at compile-time too and not only at run-time. See #16413, closes #16529. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/power.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/power.mm b/src/osx/cocoa/power.mm index 0bfd8c24f7..1b2d6d7251 100644 --- a/src/osx/cocoa/power.mm +++ b/src/osx/cocoa/power.mm @@ -36,6 +36,7 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) if( reason.IsEmpty()) cfreason = wxString("User Activity"); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 if ( UMAGetSystemVersion() >= 0x1090 ) { // Use NSProcessInfo for 10.9 and newer @@ -55,7 +56,9 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) return true; } } - else if ( !g_pmAssertionID ) + else +#endif + if ( !g_pmAssertionID ) { // Use power manager API for < 10.9 systems IOReturn success = IOPMAssertionCreateWithName @@ -72,6 +75,7 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) else if ( g_powerResourceSystemRefCount == 0 ) { // Release power assertion +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 if ( UMAGetSystemVersion() >= 0x1090 ) { // Use NSProcessInfo for 10.9 and newer @@ -84,7 +88,9 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) return true; } } - else if ( g_pmAssertionID ) + else +#endif + if ( g_pmAssertionID ) { // Use power manager API for < 10.9 systems IOReturn success = IOPMAssertionRelease(g_pmAssertionID);