-- (IBAction)goFullScreen:(id)sender
-{
- // Get the screen information.
- NSScreen* mainScreen = [fPreviewWindow screen];
- NSDictionary* screenInfo = [mainScreen deviceDescription];
- NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"];
- // Capture the screen.
- CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue];
- CGDisplayErr err = CGDisplayCapture(displayID);
-
- if (err == CGDisplayNoErr)
- {
-
- /* make sure we are set to a still preview and not scaled to screen */
- scaleToScreen = NO;
- [self pictureSliderChanged:nil];
-
- // Create the full-screen window.
- //NSRect winRect = [mainScreen frame];
- //fPictureViewArea
- NSRect winRect = [fPictureViewArea frame];
-
- fFullScreenWindow = [[NSWindow alloc] initWithContentRect:winRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO
- screen:mainScreen];
-
- // Establish the window attributes.
- [fFullScreenWindow setReleasedWhenClosed:NO];
- [fFullScreenWindow setDisplaysWhenScreenProfileChanges:YES];
- [fFullScreenWindow setDelegate:self];
-
- /* insert a view into the new window */
- [fFullScreenWindow setContentView:fPictureViewArea];
- [fPictureViewArea setNeedsDisplay:YES];
-
- /* Better to center the window using the screen's frame
- * and the windows origin. Note that we should take into
- * account the auto sizing and alignment that occurs in
- * setViewSize each time the preview changes.
- * Note: by using [fFullScreenWindow screen] (instead of
- * [NSScreen mainScreen]) in referencing the screen
- * coordinates, the full screen window will show up on
- * whichever display was being used in windowed mode
- * on multi-display systems
- */
-
- NSSize screenSize = [[fFullScreenWindow screen] frame].size;
- NSSize windowSize = [fFullScreenWindow frame].size;
- NSPoint windowOrigin = [fFullScreenWindow frame].origin;
-
- /* Adjust our origin y (vertical) based on the screen height */
- windowOrigin.y += (screenSize.height - windowSize.height) / 2.0;
- windowOrigin.x += (screenSize.width - windowSize.width) / 2.0;
-
- [fFullScreenWindow setFrameOrigin:windowOrigin];
-
- /* lets kill the timer for now */
- [self stopReceivingLibhbNotifications];
-
- /* We need to retain the fPreviewWindow */
- [fPreviewWindow retain];
-
- [self setWindow:fFullScreenWindow];
-
- // The window has to be above the level of the shield window.
- int32_t shieldLevel = CGShieldingWindowLevel();
-
- [fFullScreenWindow setLevel:shieldLevel];
-
- // Show the window.
- [fFullScreenWindow makeKeyAndOrderFront:self];
-
-
- /* Change the name of fFullScreenToggleButton appropriately */
- [fFullScreenToggleButton setTitle: @"Windowed"];
-
- /* Lets fire the timer back up for the hud controls, etc. */
- [self startReceivingLibhbNotifications];
-
- isFullScreen = YES;
- [fScaleToScreenToggleButton setHidden:NO];
-
- /* make sure we are set to a still preview */
- [self pictureSliderChanged:nil];
-
- [fFullScreenWindow setAcceptsMouseMovedEvents:YES];
-
-
- hudTimerSeconds = 0;
- [self startHudTimer];
- }
-}