-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonPolyfill.h
132 lines (92 loc) · 2.39 KB
/
CommonPolyfill.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
Copyright (c) 2015-2021 hkrn All rights reserved
This file is part of emapp component and it's licensed under Mozilla Public License. see LICENSE.md for more details.
*/
#import <AppKit/AppKit.h>
#ifndef NDEBUG
#define nanoem_objc_log(...) NSLog(__VA_ARGS__)
#else
#define nanoem_objc_log(...)
#endif
#define nanoem_objc_domain(name) @"com.github.nanoem." #name
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1100
@interface
NSFileWrapper (MacOSX_1090_polyfill)
@property (readonly, nonatomic) BOOL regularFile;
@property (readonly, nonatomic) BOOL symbolicLink;
@end
@implementation
NSFileWrapper (MacOSX_1090_polyfill)
- (BOOL)regularFile
{
return [[self.fileAttributes objectForKey:NSFileType] isEqualToString:NSFileTypeRegular];
}
- (BOOL)directory
{
return [[self.fileAttributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory];
}
- (BOOL)symbolicLink
{
return [[self.fileAttributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink];
}
@end
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
static NSString *NSWindowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification";
static NSUInteger NSWindowCollectionBehaviorFullScreenPrimary = 0;
static const NSUInteger NSAutosaveInPlaceOperation = 4;
@interface
NSWindow (MacOSX_1060_polyfill)
@property (readonly, nonatomic) CGFloat backingScaleFactor;
@property (assign, nonatomic) BOOL restorable;
@end
@interface
NSView (MacOSX_1060_polyfill)
@property (assign, nonatomic) BOOL wantsBestResolutionOpenGLSurface;
@end
@interface
NSEvent (MacOSX_1060_polyfill)
@property (readonly, nonatomic) BOOL hasPreciseScrollingDeltas;
@property (readonly, nonatomic) CGFloat scrollingDeltaX;
@property (readonly, nonatomic) CGFloat scrollingDeltaY;
@end
@implementation
NSWindow (MacOSX_1060_polyfill)
- (CGFloat)backingScaleFactor
{
return 1.0f;
}
- (BOOL)restorable
{
return NO;
}
- (void)setRestorable:(BOOL)value
{
}
@end
@implementation
NSView (MacOSX_1060_polyfill)
- (BOOL)wantsBestResolutionOpenGLSurface
{
return NO;
}
- (void)setWantsBestResolutionOpenGLSurface:(BOOL)value
{
}
@end
@implementation
NSEvent (MacOSX_1060_polyfill)
- (BOOL)hasPreciseScrollingDeltas
{
return NO;
}
- (CGFloat)scrollingDeltaX
{
return 0.0f;
}
- (CGFloat)scrollingDeltaY
{
return 0.0f;
}
@end
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1100 */