-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplatform_darwin.m
35 lines (27 loc) · 969 Bytes
/
platform_darwin.m
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
#import <Cocoa/Cocoa.h>
@interface Platform: NSObject
+ (void)windowDidBecomeKey:(NSNotification *)aNotification;
@end
@implementation Platform
+ (void)windowDidBecomeKey:(NSNotification *)aNotification
{
NSWindow *aWindow = aNotification.object;
[[aWindow standardWindowButton:NSWindowZoomButton] setHidden:YES];
if (@available(macOS 10.14, *)) {
aWindow.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
}
}
@end
void platform_darwin_setup(void)
{
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:[Platform class]
selector:@selector(windowDidBecomeKey:)
name:NSWindowDidBecomeKeyNotification
object:nil];
}
void platform_darwin_after_file_dialog(void)
{
NSWindow *firstWindow = [[NSApp windows] firstObject];
[firstWindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:NSApp waitUntilDone:NO];
}