Re: Full screen and popup menu
Re: Full screen and popup menu
- Subject: Re: Full screen and popup menu
- From: Glenn Andreas <email@hidden>
- Date: Thu, 23 Sep 2004 17:09:31 -0500
Hi,
I have an application which uses the following code to create a full
screen window:
int windowLevel;
NSRect screenRect;
if (CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess) {
NSLog( @"Couldn't capture the main display!" );
fullScreen = NO;
}else{
window = [[NSWindow alloc]
initWithContentRect:NSMakeRect(100,100,800,600)
styleMask:NSBorderlessWindowMask
backing:(NSBackingStoreType)NSBackingStoreBuffered defer:YES];
windowLevel = CGShieldingWindowLevel();
//windowLevel = NSStatusWindowLevel; // <--------
------------------------
screenRect = [[NSScreen mainScreen] frame];
[window setLevel:windowLevel];
[window makeKeyAndOrderFront:nil];
[window setFrame:screenRect display:YES];
[window setAcceptsMouseMovedEvents:YES];
fullScreen = YES;
}
[window setContentView:controlView];
[window orderFront:self];
This works fine except for one thing. The window contains a popup
button. But the popup menu is not displayed because the level of the
menu is behind the window level.
So when I change the window level to be below the popup level, the
menu should display in front of the window, right?
But when I uncomment
//windowLevel = NSStatusWindowLevel; // <-------- ------------------------
I get a black screen. I even get a black screen if I use
NSScreenSaverWindowLevel.
Any ideas?
Yes. When you do CGDisplayCapture a shielding window is created
automatically - this is the black window you see, and it is at the
CGSheildingWindowLevel. If you put your window below that
(NSStatusWindowLevel or NSScreenSaverWindowLevel), it won't be seen,
just your popup menus weren't seen.
In generally, trying to display a system UI on a captured device is
filled with bad Mojo (especially when you combine it with resolution
swithing, trying to avoid icon rearrangement, etc...). There has
been a long discussion of this on the game programmer list in the
past couple of weeks (which, if the archives were working, you could
search).
--
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden