diff options
author | Andre Pang <athp@users.sourceforge.net> | 2004-06-21 03:24:51 +0000 |
---|---|---|
committer | Andre Pang <athp@users.sourceforge.net> | 2004-06-21 03:24:51 +0000 |
commit | 09d8634a6550c2a74b4c455eb81299244ab931c6 (patch) | |
tree | 4954d8df61e37dd6b97dafd2b7dc670fe6c3306a /src | |
parent | 8dbd31b0444d86741a37b313ca0bee87f8c52b3e (diff) | |
download | xine-lib-09d8634a6550c2a74b4c455eb81299244ab931c6.tar.gz xine-lib-09d8634a6550c2a74b4c455eb81299244ab931c6.tar.bz2 |
Mac OS X XineVideoWindow:
Replaced fitToScreen method with windowWillUseStandardFrame:defaultFrame:,
since NSWindow's native zoom: method uses that to determine the zoomed side
Made new windowWillUseStandardFrame:defaultFrame: method center the screen
CVS patchset: 6719
CVS date: 2004/06/21 03:24:51
Diffstat (limited to 'src')
-rw-r--r-- | src/video_out/macosx/video_window.h | 1 | ||||
-rw-r--r-- | src/video_out/macosx/video_window.m | 34 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h index 61602c498..2aa29d46a 100644 --- a/src/video_out/macosx/video_window.h +++ b/src/video_out/macosx/video_window.h @@ -72,7 +72,6 @@ typedef enum { - (void) setContentSize: (NSSize) size; - (XineOpenGLView *) xineView; -- (void) fitToScreen; - (void) setKeepsAspectRatio: (BOOL) i; - (int) keepsAspectRatio; @end diff --git a/src/video_out/macosx/video_window.m b/src/video_out/macosx/video_window.m index 165227514..6546428a9 100644 --- a/src/video_out/macosx/video_window.m +++ b/src/video_out/macosx/video_window.m @@ -67,27 +67,35 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; return xineView; } -- (void) fitToScreen { - NSSize size, video_size; - float screen_width, screen_height; - +- (NSRect)windowWillUseStandardFrame:(NSWindow *)sender + defaultFrame:(NSRect)defaultFrame +{ + NSSize screen_size, video_size; + NSRect standard_frame; + if ([xineView isFullScreen]) return; - - screen_width = CGDisplayPixelsWide (kCGDirectMainDisplay); - screen_height = CGDisplayPixelsHigh (kCGDirectMainDisplay) - 40; + screen_size = defaultFrame.size; video_size = [xineView videoSize]; - if ((screen_width / screen_height) > (video_size.width / video_size.height)) { - size.width = video_size.width * (screen_height / video_size.height); - size.height = screen_height; + if (screen_size.width / screen_size.height > + video_size.width / video_size.height) { + standard_frame.size.width = video_size.width * + (screen_size.height / video_size.height); + standard_frame.size.height = screen_size.height; } else { - size.width = screen_width; - size.height = video_size.height * (screen_width / video_size.width); + standard_frame.size.width = screen_size.width; + standard_frame.size.height = video_size.height * + (screen_size.width / video_size.width); } - [super setContentSize: size]; + standard_frame.origin.x = + (screen_size.width - standard_frame.size.width) / 2; + standard_frame.origin.y = + (screen_size.height - standard_frame.size.height) / 2; + + return standard_frame; } - (void) setKeepsAspectRatio: (BOOL) flag { |