• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fullscreen on secondary displays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fullscreen on secondary displays


  • Subject: Fullscreen on secondary displays
  • From: "Dennis Munsie" <email@hidden>
  • Date: Tue, 13 May 2008 13:11:40 -0400

Hello everyone,

I have an app right now that I've added a fullscreen mode to.  RIght
now it works for fullscreen when I go to fullscreen on the main
display.  If I attempt to do this on the secondary display, I get a
blank screen.

I think one problem is probably the way I am identifying which screen
to use -- I use [NSWindow screen] to find where my current window is
and use that to capture the screen and place a new fullscreen window
over it.  One potential problem I see is when the window spans across
two displays -- how do I reasonably choose which screen to display it
on?  What screen does [NSWindow screen] return?

So to recap -- this code currently works correctly in the case when
the _mainWindow is on the primary display.  The code does not work
correctly when it is on a secondary display.  And I haven't tested the
case where the code spans displays -- I am assuming that it just flat
out doesn't work :)

here is the code from my enterFullscreen method -- mostly pulled from
sample code off developer.apple.com:

-(void)enterFullscreen
{
	NSScreen *windowScreen = [_mainWindow screen];
	NSDictionary *screenInfo = [windowScreen deviceDescription];
	NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"];

	// capture the screen
	CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue];
	CGDisplayErr err = CGDisplayCapture(displayID);
	if(err == CGDisplayNoErr) {
		if(!_fullscreenWindow) {
            // Create the full-screen window.
            NSRect winRect = [windowScreen frame];
            _fullscreenWindow = [[NSWindow alloc]
initWithContentRect:winRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO screen:windowScreen];

            // Establish the window attributes.
            [_fullscreenWindow setReleasedWhenClosed:NO];
            [_fullscreenWindow setDisplaysWhenScreenProfileChanges:YES];
            [_fullscreenWindow setDelegate:self];
        }

		// move our view over to the fullscreen window
		[_mainWindow setContentView:nil];
		[_fullscreenWindow setContentView:_mainView];
		[_mainWindow setNeedsDisplay:YES];

        // The window has to be above the level of the shield window.
        int32_t     shieldLevel = CGShieldingWindowLevel();
        [_fullscreenWindow setLevel:shieldLevel];

        // Show the window.
        [_fullscreenWindow makeKeyAndOrderFront:self];

		_fullscreenFlag = YES;
	}
}

Sorry about the formatting -- it got a bit messed up when i pasted it
into gmail.

Thanks!
dennis
_______________________________________________

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

  • Follow-Ups:
    • Re: Fullscreen on secondary displays
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: OT: Looking for Cocoa contractor for project
  • Next by Date: Changing NSPrintPanel UI in 10.5
  • Previous by thread: OT: Looking for Cocoa contractor for project
  • Next by thread: Re: Fullscreen on secondary displays
  • Index(es):
    • Date
    • Thread