summaryrefslogtreecommitdiffstats
path: root/macosx/HBPreviewController.mm
diff options
context:
space:
mode:
authordynaflash <[email protected]>2009-02-13 05:26:29 +0000
committerdynaflash <[email protected]>2009-02-13 05:26:29 +0000
commit3df2e48a60f84740a9c22dd3796ef18a40df10cc (patch)
treefde0e4cc1898e4473a3d97b673b90ec366264d68 /macosx/HBPreviewController.mm
parent79ca983a70cef58f76cfaa86ea859c3d800a1f13 (diff)
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
Diffstat (limited to 'macosx/HBPreviewController.mm')
-rw-r--r--macosx/HBPreviewController.mm34
1 files changed, 25 insertions, 9 deletions
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
{