=== modified file 'gui/Player.cpp'
--- gui/Player.cpp	2009-07-21 15:59:57 +0000
+++ gui/Player.cpp	2009-11-16 02:27:25 +0000
@@ -102,6 +102,7 @@
 #endif
     _hostfd(-1),
     _startFullscreen(false),
+    _scaleExactFit(false),
     _hideMenu(false)
 {
     init();
@@ -494,6 +495,10 @@
         _gui->hideMenu();
     }
     
+    if (!_windowID && _scaleExactFit) {
+        _gui->setScaleExactFit();
+    }
+    
     _gui->run();
 
     log_debug("Main loop ended, cleaning up");

=== modified file 'gui/Player.h'
--- gui/Player.h	2009-07-13 09:15:53 +0000
+++ gui/Player.h	2009-11-16 02:28:31 +0000
@@ -130,6 +130,10 @@
 	void setParam(std::string& name, std::string& value) {
 		params[name] = value;
 	}
+	
+	void setScaleExactFit(bool x) {
+	    _scaleExactFit = x;
+	}
 
 	void setHostFD(int fd) {
 		_hostfd = fd;
@@ -302,6 +306,7 @@
 	// (Or what did you think it meant?)
 	bool _startFullscreen;
 	bool _hideMenu;
+    bool _scaleExactFit;
 
     // The filename to use for dumping audio.
     std::string _audioDump;

=== modified file 'gui/gnash.cpp'
--- gui/gnash.cpp	2009-04-14 18:44:33 +0000
+++ gui/gnash.cpp	2009-11-16 02:20:22 +0000
@@ -93,6 +93,7 @@
     << _("  -h,  --help              Print this help and exit") << endl
     << _("  -V,  --version           Print version information and exit") << endl
     << _("  -s,  --scale <factor>    Scale the movie by the specified factor") << endl
+    << _("  -S,  --exactfit          Force the SWF to scale to the window size") << endl
     << _("  -c                       Produce a core file instead of letting SDL trap it") << endl
     << _("  -d,  --delay num         Number of milliseconds to delay in main loop") << endl
     << _("  -v,  --verbose           Produce verbose output") << endl
@@ -200,6 +201,7 @@
         { 'a', 0,               Arg_parser::no  },
         { 'p', 0,               Arg_parser::no  },
         { 's', "scale",         Arg_parser::yes },
+        { 'S', "exactfit",      Arg_parser::no },
         { 256, "max-advances",  Arg_parser::yes },
         { 257, "fullscreen",    Arg_parser::no  },
         { 258, "hide-menubar",  Arg_parser::no  },                
@@ -289,6 +291,9 @@
                                     parser.argument<float>(i),
                                     0.01f, 100.f));
                     break;
+                case 'S':
+                    player.setScaleExactFit(true);
+                    break;
                 case 'd':
                     player.setDelay( parser.argument<long>(i) );
                     break;

=== modified file 'gui/gui.cpp'
--- gui/gui.cpp	2009-07-13 09:15:53 +0000
+++ gui/gui.cpp	2009-11-16 02:25:05 +0000
@@ -83,6 +83,7 @@
     _interval(0),
     _redraw_flag(true),
     _fullscreen(false),
+    _scaleExactFit(false),
     _mouseShown(true),
     _maxAdvances(0),
     _advances(0),
@@ -128,6 +129,7 @@
     _interval(0),
     _redraw_flag(true),
     _fullscreen(false),
+    _scaleExactFit(false),
     _mouseShown(true),
     _maxAdvances(0),
     _advances(0),
@@ -192,6 +194,13 @@
     log_unimpl(_("Menu hiding not yet supported in this GUI"));
 }
 
+void 
+Gui::setScaleExactFit()
+{
+    _scaleExactFit = true;
+}
+
+
 bool
 Gui::showMouse(bool /* show */)
 {
@@ -260,20 +269,38 @@
 	{
 		case movie_root::noScale:
 			_xscale = _yscale = 1.0f;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    _xscale = _yscale = 1.0f;
+		    }
 			break;
 
 		case movie_root::showAll:
 		{
 		
-			// set new scale value ( user-pixel / pseudo-pixel ). Do
-			// not divide by zero, or we end up with an invalid
-			// stage matrix that returns nan values.			
-			_xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
-			_yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    // set new scale value ( user-pixel / pseudo-pixel ). Do
+			    // not divide by zero, or we end up with an invalid
+			    // stage matrix that returns nan values.			
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+
 			
-			// Scale proportionally, using smallest scale
-			if (_xscale < _yscale) _yscale = _xscale;
-			else if (_yscale < _xscale) _xscale = _yscale;
+			    // Scale proportionally, using smallest scale
+			    if (_xscale < _yscale) _yscale = _xscale;
+			    else if (_yscale < _xscale) _xscale = _yscale;
+		    }
 
 			break;
 		}
@@ -281,13 +308,21 @@
 		case movie_root::noBorder:
 		{
 
-			// set new scale value ( user-pixel / pseudo-pixel )
-			_xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
-			_yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    // set new scale value ( user-pixel / pseudo-pixel )
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
 			
-			// Scale proportionally, using biggest scale
-			if (_xscale > _yscale) _yscale = _xscale;
-			else if (_yscale > _xscale) _xscale = _yscale;
+			    // Scale proportionally, using biggest scale
+			    if (_xscale > _yscale) _yscale = _xscale;
+			    else if (_yscale > _xscale) _xscale = _yscale;
+            }
 
 			break;
 		}
@@ -303,7 +338,16 @@
 
 		default:
 		{
-			log_error("Invalid scaleMode %d", scaleMode);
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+			    log_error("Invalid scaleMode - forcing to exactfit");
+		    }
+		    else
+		    {
+			    log_error("Invalid scaleMode %d", scaleMode);
+		    }
 			break;
 		}
 	}

=== modified file 'gui/gui.h'
--- gui/gui.h	2009-07-13 09:15:53 +0000
+++ gui/gui.h	2009-11-16 02:26:08 +0000
@@ -263,6 +263,8 @@
     ///
     virtual void hideMenu();
     
+    void setScaleExactFit();
+    
     /// Sets whether the gui should show the system mouse pointer
     //
     /// @param show true if the mouse should be shown.
@@ -442,6 +444,9 @@
 
     // True if Gnash is running in fullscreen
     bool _fullscreen;
+    
+    // Forces Gnash to scale video
+    bool _scaleExactFit;
 
     // True if mouse pointer is showing
     bool _mouseShown;

