Fullscreen transparent background
Fullscreen transparent background
- Subject: Fullscreen transparent background
- From: Thomas Rasch <email@hidden>
- Date: Sat, 16 Nov 2002 14:49:02 +0100
Hello all,
I played a little with the fullscreen tutorial I found on
cocoadevcentral (my modified version is below) and ran into following
problems:
Having a transparent background doesn't work when I capture the display
with CGDisplayCapture yet it works fine when I comment it out, so why
would I need it? What does it?
The second problem is that the dock (and probably other applications)
still react to the mouse, although they don't react to mouse clicks
(i.e. when I move the mouse across the dock, it magnifies, but I can't
start applications). Is there a way to prevent this? And, third
question, how does the dock react to mouseOver Events (what methods
could it use)?
Thanks,
Thomas
@implementation TestController
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
int windowLevel;
NSRect screenRect;
// Capture the main display
// if (CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess) {
// NSLog( @"Couldn't capture the main display!" );
// Note: you'll probably want to display a proper error dialog
here
// }
// Get the shielding window level
windowLevel = CGShieldingWindowLevel();
// Get the screen rect of our main display
screenRect = [[NSScreen mainScreen] frame];
// Put up a new window
testBackgroundWindow = [[TestBackgroundWindow alloc]
initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO
screen:[NSScreen mainScreen]];
[testBackgroundWindow setLevel:windowLevel];
[testBackgroundWindow makeKeyAndOrderFront:nil];
[testContentPanel setFrame:screenRect display:YES];
[testBackgroundWindow setContentView:[testContentPanel
contentView]];
}
@end
@implementation TestBackgroundWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned
int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
screen:(NSScreen *)aScreen {
NSWindow* result = [super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO screen:aScreen];
[result setBackgroundColor:[NSColor clearColor]];
// [result setBackgroundColor: [NSColor colorWithCalibratedRed:0.0
green:0.0 blue:0.0 alpha:0.7]];
[result setOpaque:NO];
[result setHasShadow:NO];
return result;
}
- (BOOL)canBecomeKeyWindow
{
return YES;
}
- (BOOL)isOpaque
{
return NO;
}
@end
@implementation TestContentView
-(void)drawRect:(NSRect)rect
{
[[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.7]
set];
NSRectFill([self frame]);
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.