I want to have a window which is like QuickTime X window. An all opaque window with rounded corners.
I've obtained it implementing a custom borderless NSWindow
with:
[window setOpaque:NO];
[window setBackgroundColor: [NSColor clearColor]];
and a custom NSView
with:
- (void)drawRect:(NSRect)rect
{
NSBezierPath* thePath = [NSBezierPath bezierPath];
[thePath appendBezierPathWithRoundedRect:rect xRadius:radius yRadius:radius];
[thePath fill];
}
It works as expected but the window becomes noticeably slow when it gets resized fast.
I've identified that this slowdown is given by -setOpaque:NO
; if I remove that line, the window can be resized fast again but corners are obviously no more rounded.
Is there a way to avoid using -setOpaque:NO
and still be able to have rounded corners? Maybe one can have a window which is all opaque except for the corners?
The view is a NSOpenGLView
so I can leverage on OpenGL if it may helps.