Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)applicationDidFinishLaunching:(NSNotification *)notification
- {
- self.windows = [NSMutableArray new];
- #ifndef DEBUG
- for (NSScreen *screen in [NSScreen screens]) {
- NSWindow *blockingWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, [screen frame].size.width, [screen frame].size.height)
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:YES
- screen:screen];
- blockingWindow.alphaValue = 0.75;
- blockingWindow.backgroundColor = [NSColor blackColor];
- blockingWindow.level = kCGPopUpMenuWindowLevel + 100;
- [blockingWindow makeKeyAndOrderFront:self];
- [self.windows addObject:blockingWindow];
- }
- // Capture displays (really black it out)
- if (CGCaptureAllDisplays() != kCGErrorSuccess) {
- NSLog(@"Couldn't capture displays!");
- // Note: you'll probably want to display a proper error dialog here
- }
- #endif
- // Create the usage agreement window
- NSRect rect = [agreementView bounds];
- unsigned int stylemask = NSBorderlessWindowMask;
- agreementWindow = [[UsageAgreementWindow alloc] initWithContentRect:rect
- styleMask:stylemask
- backing:NSBackingStoreBuffered
- defer:NO ];
- [agreementWindow setLevel:CGShieldingWindowLevel()];
- [agreementWindow setHasShadow:YES];
- [agreementWindow center];
- [agreementWindow makeKeyAndOrderFront:nil];
- [NSApp activateIgnoringOtherApps:YES];
- }
- - (void)applicationWillTerminate:(NSNotification *)notification
- {
- CGReleaseAllDisplays();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement