Skip to content

Instantly share code, notes, and snippets.

@fernyb
Created December 3, 2010 06:15
Show Gist options
  • Save fernyb/726647 to your computer and use it in GitHub Desktop.
Save fernyb/726647 to your computer and use it in GitHub Desktop.
Borderless NSWindow
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation
{
[super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:bufferingType
defer:deferCreation];
[self setBackgroundColor:[NSColor clearColor]];
[self setOpaque:NO];
[self setAllowsConcurrentViewDrawing:YES];
[self setAcceptsMouseMovedEvents:YES];
[self setHasShadow:NO];
[self setLevel:NSFloatingWindowLevel];
CGFloat pointX = ([[NSScreen mainScreen] frame].size.width - [self frame].size.width) - 20;
CGFloat pointY = ([[NSScreen mainScreen] frame].size.height - [self frame].size.height) - 30;
[self setFrameOrigin:NSMakePoint(pointX, pointY)];
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment