Re: Empty window appears when going fullscreen in awakeFromNib
Re: Empty window appears when going fullscreen in awakeFromNib
- Subject: Re: Empty window appears when going fullscreen in awakeFromNib
- From: Adam Gerson <email@hidden>
- Date: Sat, 7 Feb 2009 17:47:59 -0500
Hey John,
Does this help? I am hiding the dock elsewhere with SetSystemUIMode.
// Calculate the size to make the new screen.
NSRect fullScreenRect = [[[NSScreen screens] objectAtIndex:0] frame];
// Uses the menu bar screen. -mainWindow has problems.
fullScreenRect.size.height -= [[NSApp mainMenu] menuBarHeight];
// Open the full-screen window.
_fullScreenWindow = [[FullScreenWindow alloc] initWithContentRect:fullScreenRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO];
if(_fullScreenWindow != nil) {
[_fullScreenWindow setContentView:[[self window] contentView]];
[_fullScreenWindow makeKeyAndOrderFront:nil];
// Hide (but don't close) the small-screen window.
[[self window] orderOut:nil];
}
On Wed, Feb 4, 2009 at 5:51 AM, Jonathan Selander <email@hidden> wrote:
> I have a program that goes into fullscreen like this:
>
> - (IBAction) goFullScreen:(id)sender
> {
> // bort med dock och menubar, motverka tvångsavluta, alt+tab och
> utloggning
> SetSystemUIMode(kUIModeAllHidden, kUIOptionDisableAppleMenu |
> kUIOptionDisableForceQuit |
> kUIOptionDisableProcessSwitch |
> kUIOptionDisableSessionTerminate);
>
> NSScreen *screen = [[contentView window] screen];
> NSWindow *window = [[NSWindow alloc] initWithContentRect:[screen
>
> frame]
>
> styleMask:NSBorderlessWindowMask
>
> backing:NSBackingStoreBuffered
>
> defer:NO
>
> screen:screen];
> [contentView retain];
> [contentView removeFromSuperview];
> [window setContentView:contentView];
> [contentView release];
> [window makeKeyAndOrderFront:sender];
> [NSCursor setHiddenUntilMouseMoves:YES];
>
> [fullScreenButton removeFromSuperview];
> [mainWindow close];
>
> [self _reloadRenderers];
> }
>
> This works fine if I bind a button to call the function after the program
> has loaded, but I need it to enter fullscreen when the application is
> launched, and when i do that an empty window is put in front (I think it's
> mainWindow). How can I prevent this from happening when calling this
> function when the application
> launches?_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden