]> git.sesse.net Git - vlc/commitdiff
* Resize window fixes
authorDerk-Jan Hartman <hartman@videolan.org>
Fri, 7 Feb 2003 21:30:25 +0000 (21:30 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 7 Feb 2003 21:30:25 +0000 (21:30 +0000)
  - we should not resize the window in fullscreen
  - fixed the black bars bug in half and double size
  - position of top left corner should not change
  - more efficient code

modules/gui/macosx/controls.m
modules/gui/macosx/vout.h
modules/gui/macosx/vout.m

index a8628c02f51c8ee5fa1430510109619410145e40..337af8ea1c99949cb601275af59ead00d2352999 100644 (file)
@@ -2,7 +2,7 @@
  * controls.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: controls.m,v 1.20 2003/02/07 20:23:17 hartman Exp $
+ * $Id: controls.m,v 1.21 2003/02/07 21:30:25 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
     {
         if( [[o_window className] isEqualToString: @"VLCWindow"] )
         {
-            [o_window halfWindow];
+            [o_window scaleWindowWithFactor: 0.5];
         }
     }
 }
     {
         if( [[o_window className] isEqualToString: @"VLCWindow"] )
         {
-            [o_window normalWindow];
+            [o_window scaleWindowWithFactor: 1];
         }
     }
 }
     {
         if( [[o_window className] isEqualToString: @"VLCWindow"] )
         {
-            [o_window doubleWindow];
+            [o_window scaleWindowWithFactor: 2];
         }
     }
 }
index c8a66c757cae69d82d4abb738c33f9e6c8ab9aa2..c36d54e4e17478dca508e7e268ee2c1d6a1ba2e9 100644 (file)
@@ -2,7 +2,7 @@
  * vout.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: vout.h,v 1.6 2003/02/07 20:23:17 hartman Exp $
+ * $Id: vout.h,v 1.7 2003/02/07 21:30:25 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define WINDOW_TITLE_HEIGHT 21
+#define WINDOW_TITLE_HEIGHT 24
 
 /*****************************************************************************
  * VLCWindow interface
@@ -36,9 +36,7 @@
 - (void)setVout:(vout_thread_t *)_p_vout;
 - (vout_thread_t *)getVout;
 
-- (void)halfWindow;
-- (void)normalWindow;
-- (void)doubleWindow;
+- (void)scaleWindowWithFactor: (float)factor;
 - (void)toggleFullscreen;
 - (BOOL)isFullscreen;
 
index a501c3aab99379dcd7e14f267311eee2c9500321..e5f120e4498f75a09a32b9f1e496c59af442b700 100644 (file)
@@ -2,7 +2,7 @@
  * vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.24 2003/02/07 20:23:17 hartman Exp $
+ * $Id: vout.m,v 1.25 2003/02/07 21:30:25 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -725,37 +725,25 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     return( p_vout );
 }
 
-- (void)halfWindow
+- (void)scaleWindowWithFactor: (float)factor
 {
     NSSize newsize;
+    NSPoint topleftbase;
+    NSPoint topleftscreen;
     
-    newsize.width = (int) p_vout->render.i_width / 2 ;
-    newsize.height = ((int) p_vout->render.i_height / 2 ) + WINDOW_TITLE_HEIGHT ;
-    [self setContentSize: newsize];
-    //[[self contentView] setFrameSize: newsize];
-    p_vout->i_changes |= VOUT_SIZE_CHANGE;
-}
-
-- (void)normalWindow
-{
-    NSSize newsize;
-    
-    newsize.width = p_vout->render.i_width ;
-    newsize.height = p_vout->render.i_height + WINDOW_TITLE_HEIGHT ;
-    [self setContentSize: newsize];
-    //[[self contentView] setFrameSize: newsize];
-    p_vout->i_changes |= VOUT_SIZE_CHANGE;
-}
-
-- (void)doubleWindow
-{
-    NSSize newsize;
-    
-    newsize.width = p_vout->render.i_width * 2 ;
-    newsize.height = (p_vout->render.i_height * 2 ) + WINDOW_TITLE_HEIGHT;
-    [self setContentSize: newsize];
-    //[[self contentView] setFrameSize: newsize];
-    p_vout->i_changes |= VOUT_SIZE_CHANGE;
+    if ( !p_vout->b_fullscreen )
+    {
+        topleftbase.x = 0;
+        topleftbase.y = [self frame].size.height;
+        topleftscreen = [self convertBaseToScreen: topleftbase];
+        
+        newsize.width = (int) ( p_vout->render.i_width * factor );
+        newsize.height = (int) ( ( p_vout->render.i_height + WINDOW_TITLE_HEIGHT ) * factor );
+        [self setContentSize: newsize];
+        
+        [self setFrameTopLeftPoint: topleftscreen];
+        p_vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
 }
 
 - (void)toggleFullscreen