Giles
Giles

Reputation: 1657

How Do I Run Full-Screen Across Multiple Screens in OSX

I am making a Cocoa application that presents a slide show of videos and images. If there are multiple screens connected (to a Mac Mini for example) I want different content to be shown on each screen. Each NSWindow should be full screen on each NSScreen.

When developing this on OSX 10.8 I set each NSWindow frame to a NSScreen frame with NSBorderlessWindowMask. I did not explicitly use NSApplicationPresentationFullScreen on NSApplication, I used NSApplicationPresentationHideDock and NSApplicationPresentationAutoHideMenuBar.

There seem to be some problems with this approach. Some OSX events seem to force the Menu Bar into view and permanently shift the windows down.

Is there a better approach to this now that OSX Mavericks has updated full screen support? Can I open an NSApplication in true fullscreen mode and force a separate NSWindow to each NSScreen?

Thank you.

Upvotes: 1

Views: 870

Answers (1)

Thomas Zoechling
Thomas Zoechling

Reputation: 34263

You could instantiate one NSWindow per screen and switch them to fullscreen:

[self.windowA setFrame:[[[NSScreen screens] firstObject] visibleFrame] display:NO];
[self.windowB setFrame:[[[NSScreen screens] lastObject] visibleFrame] display:NO];
[self.windowA toggleFullScreen:nil];
[self.windowB toggleFullScreen:nil];

Upvotes: 3

Related Questions