]> git.sesse.net Git - vlc/commitdiff
skins2: fix video autoresize default when contradictory
authorErwan Tulou <erwan10@videolan.org>
Sat, 14 Aug 2010 09:28:35 +0000 (11:28 +0200)
committerErwan Tulou <erwan10@videolan.org>
Sat, 14 Aug 2010 11:38:01 +0000 (13:38 +0200)
when parameters for a video control are contradictory (this occurs when the
skin developper only relies on default values), it is better not to resize,
since there is no easy means to check if the layout is really set up to handle
resizing properly.

This fixes some ugly behavior for a few skins from the skin repository
 on the website.

modules/gui/skins2/parser/builder.cpp

index 72efbe6840f3faac7ba0ed0f6be974c977a59b12..df0f5507fd4cfd3b1ccabaa11e6c66add32b9872 100644 (file)
@@ -1028,12 +1028,19 @@ void Builder::addVideo( const BuilderData::Video &rData )
         pVisible );
     m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pVideo );
 
-    // if autoresize is true, force the control to resize
     BuilderData::Video Data = rData;
-    if( rData.m_autoResize )
+    if( Data.m_autoResize )
     {
-        Data.m_leftTop = "lefttop";
-        Data.m_rightBottom = "rightbottom";
+        // force autoresize to false if the control is not able to
+        // freely resize within its container
+        if( Data.m_xKeepRatio || Data.m_yKeepRatio ||
+            !( Data.m_leftTop == "lefttop" &&
+               Data.m_rightBottom == "rightbottom" ) )
+        {
+            msg_Err( getIntf(),
+                "video: resize policy and autoresize are not compatible" );
+            Data.m_autoResize = false;
+        }
     }
 
     // Compute the position of the control