diff options
author | dynaflash <[email protected]> | 2009-03-06 16:32:59 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2009-03-06 16:32:59 +0000 |
commit | f6a38ba0f0081bd88db74d2d66e9c464bf4ed737 (patch) | |
tree | 2e51ed23a1d581997221f8eada4898a0e0244d47 /macosx | |
parent | 139faba4c383453c714e28f20bc1f3fd963739a5 (diff) |
MacGui: Preview Window postioning fixes
- Make sure the preview window stays within the parameters of the screen as it resizes, even on multiple monitor systems.
- Among other things fixes an issue where preview window being opened up at launch would push part of it off screen as it resized to a new source.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2232 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBPreviewController.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/macosx/HBPreviewController.mm b/macosx/HBPreviewController.mm index 0eb6500fd..cea2a1ee3 100644 --- a/macosx/HBPreviewController.mm +++ b/macosx/HBPreviewController.mm @@ -1314,6 +1314,26 @@ return YES; } else { + /* Since upon launch we can open up the preview window if it was open + * the last time we quit (and at the size it was) we want to make + * sure that upon resize we do not have the window off the screen + * So check the origin against the screen origin and adjust if + * necessary. + */ + NSSize screenSize = [[[self window] screen] frame].size; + NSPoint screenOrigin = [[[self window] screen] frame].origin; + /* our origin is off the screen to the left*/ + if (frame.origin.x < screenOrigin.x) + { + /* so shift our origin to the right */ + frame.origin.x = screenOrigin.x; + } + else if ((frame.origin.x + frame.size.width) > (screenOrigin.x + screenSize.width)) + { + /* the right side of the preview is off the screen, so shift to the left */ + frame.origin.x = (screenOrigin.x + screenSize.width) - frame.size.width; + } + [[self window] setFrame:frame display:YES animate:YES]; } |