From 3df2e48a60f84740a9c22dd3796ef18a40df10cc Mon Sep 17 00:00:00 2001 From: dynaflash Date: Fri, 13 Feb 2009 05:26:29 +0000 Subject: MacGui: Picture Preview - fix full screen mode on multi-display systems. - Full Screen mode now applies to whichever screen the preview window is on in windowed mode on multi-display systems. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2156 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/HBPreviewController.mm | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'macosx/HBPreviewController.mm') diff --git a/macosx/HBPreviewController.mm b/macosx/HBPreviewController.mm index ec7862b0c..4df065d7d 100644 --- a/macosx/HBPreviewController.mm +++ b/macosx/HBPreviewController.mm @@ -517,7 +517,7 @@ return YES; - (IBAction)goFullScreen:(id)sender { // Get the screen information. - NSScreen* mainScreen = [NSScreen mainScreen]; + NSScreen* mainScreen = [fPreviewWindow screen]; NSDictionary* screenInfo = [mainScreen deviceDescription]; NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"]; // Capture the screen. @@ -540,7 +540,7 @@ return YES; styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO - screen:[NSScreen mainScreen]]; + screen:mainScreen]; // Establish the window attributes. [fFullScreenWindow setReleasedWhenClosed:NO]; @@ -551,26 +551,27 @@ return YES; [fFullScreenWindow setContentView:fPictureViewArea]; [fPictureViewArea setNeedsDisplay:YES]; - // Center the window - /* 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 = [[NSScreen mainScreen] frame].size; + 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; + 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]; @@ -587,6 +588,7 @@ return YES; // Show the window. [fFullScreenWindow makeKeyAndOrderFront:self]; + /* Change the name of fFullScreenToggleButton appropriately */ [fFullScreenToggleButton setTitle: @"Windowed"]; @@ -608,6 +610,20 @@ return YES; } } +// Title-less windows normally don't receive key presses, override this +- (BOOL)canBecomeKeyWindow +{ + return YES; +} + +// Title-less windows normally can't become main which means that another +// non-fullscreen window will have the "active" titlebar in expose. Bad, fix it. +- (BOOL)canBecomeMainWindow +{ + return YES; +} + + - (IBAction)goWindowedScreen:(id)sender { -- cgit v1.2.3