* 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 a8628c0..337af8e 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 c8a66c7..c36d54e 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 a501c3a..e5f120e 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