// // // OSX GLEssentials // // Copied from the Apple GLEssentials // // #import "FullscreenWindow.h" @implementation FullscreenWindow - (id)init { // Create a screen-sized window on the display you want to take over // Initialize the window making it size of the screen and borderless NSRect screenRect = [[NSScreen mainScreen] frame]; if(self = [super initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]){ self.level = NSMainMenuWindowLevel + 1; // Set the window level to be above the menu bar to cover everything else self.opaque = YES; // Set opaque self.hidesOnDeactivate = YES; // Hide this when user switches to another window (or app) } return self; } - (BOOL)canBecomeKeyWindow { // Return yes so that this borderless window can receive input return YES; } - (void)keyDown:(NSEvent *)event { // Implement keyDown since controller will not get [ESC] key event which // the controller uses to kill fullscreen [self.windowController keyDown:event]; } @end