changeset 15855:1ca8b5873c3f

keep window size when changing aspect
author nplourde
date Wed, 29 Jun 2005 21:54:48 +0000
parents df539b2f5f4f
children c41a88cd6886
files libvo/vo_macosx.h libvo/vo_macosx.m
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_macosx.h	Wed Jun 29 21:49:58 2005 +0000
+++ b/libvo/vo_macosx.h	Wed Jun 29 21:54:48 2005 +0000
@@ -31,6 +31,7 @@
     GLfloat upperLeft[2];
 	
 	BOOL mouseHide;
+	float winSizeMult;
 	
 	//menu command id
 	NSMenuItem *kQuitCmd;
--- a/libvo/vo_macosx.m	Wed Jun 29 21:49:58 2005 +0000
+++ b/libvo/vo_macosx.m	Wed Jun 29 21:54:48 2005 +0000
@@ -288,6 +288,7 @@
     [window setTitle:@"MPlayer - The Movie Player"];
 	
 	isFullscreen = 0;
+	winSizeMult = 1;
 }
 
 - (id) config
@@ -359,7 +360,7 @@
 	kDoubleScreenCmd = menuItem;
 	menuItem = [[NSMenuItem alloc] initWithTitle:@"Full Size" action:@selector(menuAction:) keyEquivalent:@"f"]; [menu addItem:menuItem];
 	kFullScreenCmd = menuItem;
-	menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [menu addItem:menuItem];
+	//menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [menu addItem:menuItem];
 	
 		NSMenu	*aspectMenu;
 		aspectMenu = [[NSMenu alloc] initWithTitle:@"Aspect Ratio"];
@@ -424,8 +425,9 @@
 			vo_fs = (!(vo_fs)); [self fullscreen:YES];
 		}
 		
-		frame.size.width = (d_width/2);
-		frame.size.height = ((d_width/movie_aspect)/2);
+		winSizeMult = 0.5;
+		frame.size.width = (d_width*winSizeMult);
+		frame.size.height = ((d_width/movie_aspect)*winSizeMult);
 		[window setContentSize: frame.size];
 		[self reshape];
 	}
@@ -435,6 +437,7 @@
 			vo_fs = (!(vo_fs)); [self fullscreen:YES];
 		}
 		
+		winSizeMult = 1;
 		frame.size.width = d_width;
 		frame.size.height = d_width/movie_aspect;
 		[window setContentSize: frame.size];
@@ -446,8 +449,9 @@
 			vo_fs = (!(vo_fs)); [self fullscreen:YES];
 		}
 		
-		frame.size.width = d_width*2;
-		frame.size.height = (d_width/movie_aspect)*2;
+		winSizeMult = 2;
+		frame.size.width = d_width*winSizeMult;
+		frame.size.height = (d_width/movie_aspect)*winSizeMult;
 		[window setContentSize: frame.size];
 		[self reshape];
 	}
@@ -478,8 +482,8 @@
 	if(sender == kAspectOrgCmd)
 	{
 		movie_aspect = old_movie_aspect;
-		frame.size.width = d_width;
-		frame.size.height = d_width/movie_aspect;
+		frame.size.width = d_width*winSizeMult;
+		frame.size.height = (d_width/movie_aspect)*winSizeMult;
 		[window setContentSize: frame.size];
 		[self reshape];
 	}
@@ -487,8 +491,8 @@
 	if(sender == kAspectFullCmd)
 	{
 		movie_aspect = 4.0f/3.0f;
-		frame.size.width = d_width;
-		frame.size.height = d_width/movie_aspect;
+		frame.size.width = d_width*winSizeMult;
+		frame.size.height = (d_width/movie_aspect)*winSizeMult;
 		[window setContentSize: frame.size];
 		[self reshape];
 	}
@@ -496,8 +500,8 @@
 	if(sender == kAspectWideCmd)
 	{
 		movie_aspect = 16.0f/9.0f;
-		frame.size.width = d_width;
-		frame.size.height = d_width/movie_aspect;
+		frame.size.width = d_width*winSizeMult;
+		frame.size.height = (d_width/movie_aspect)*winSizeMult;
 		[window setContentSize: frame.size];
 		[self reshape];
 	}