]> git.zerfleddert.de Git - proxmark3-svn/blame - client/util_darwin.m
fix ATR length (#790)
[proxmark3-svn] / client / util_darwin.m
CommitLineData
2a537311
A
1//-----------------------------------------------------------------------------
2// (c) 2018 AntiCat
3//
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
6// the license.
7//-----------------------------------------------------------------------------
8// macOS framework bindings
9//-----------------------------------------------------------------------------
10
11#import "util_darwin.h"
12
13#import <Foundation/NSString.h>
14#import <Foundation/NSProcessInfo.h>
b742ab8c 15#import <AppKit/NSApplication.h>
2a537311
A
16
17static id activity = nil;
18
19//OS X Version 10.10 is defined in OS X 10.10 and later
20#if defined(MAC_OS_X_VERSION_10_10)
21void disableAppNap(const char* reason) {
22 if(activity == nil) {
23 //NSLog(@"disableAppNap: %@", @(reason));
24 activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityBackground reason:@(reason)];
25 [activity retain];
26 }
27}
28
29void enableAppNap() {
30 if(activity != nil) {
31 //NSLog(@"enableAppNap");
32 [[NSProcessInfo processInfo] endActivity:activity];
33 [activity release];
34 activity = nil;
35 }
36}
37
38#else
39void disableAppNap(const char* reason) { }
40void enableAppNap() { }
41#endif
b742ab8c
A
42
43//OS X Version 10.6 is defined in OS X 10.6 and later
44#if defined(MAC_OS_X_VERSION_10_6)
45void makeUnfocusable() {
46 [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
47}
48
49void makeFocusable() {
50 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
51}
52#else
53void makeUnfocusable() { }
54void makeFocusable() { }
55#endif
Impressum, Datenschutz