You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
11 years ago
|
//
|
||
|
//
|
||
11 years ago
|
// OSX GLEssentials
|
||
11 years ago
|
//
|
||
|
// Copied from the Apple GLEssentials
|
||
|
//
|
||
|
//
|
||
|
|
||
11 years ago
|
#import "FullscreenWindow.h"
|
||
11 years ago
|
|
||
11 years ago
|
@implementation FullscreenWindow
|
||
11 years ago
|
|
||
|
- (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
|