1 //-----------------------------------------------------------------------------
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // macOS framework bindings
9 //-----------------------------------------------------------------------------
11 #import "util_darwin.h"
13 #import <Foundation/NSString.h>
14 #import <Foundation/NSProcessInfo.h>
16 static id activity = nil;
18 //OS X Version 10.10 is defined in OS X 10.10 and later
19 #if defined(MAC_OS_X_VERSION_10_10)
20 void disableAppNap(const char* reason) {
22 //NSLog(@"disableAppNap: %@", @(reason));
23 activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityBackground reason:@(reason)];
30 //NSLog(@"enableAppNap");
31 [[NSProcessInfo processInfo] endActivity:activity];
38 void disableAppNap(const char* reason) { }
39 void enableAppNap() { }