]> git.sesse.net Git - vlc/commitdiff
skins2: resize only similar layouts on-the-fly
authorErwan Tulou <erwan10@videolan.org>
Mon, 1 Apr 2013 00:10:56 +0000 (02:10 +0200)
committerErwan Tulou <erwan10@videolan.org>
Mon, 1 Apr 2013 01:15:40 +0000 (03:15 +0200)
This fixes a regression brought by ff74e967e9777ed821734077051f55ac84a173a5

Forcefully resizing only makes sense when layouts were designed to be similar
in size in the first place. Furthermore, it cuts off a larger layout if a
smaller one is first defined when loading a skin.

Ideally, the skins2 dtd should be extended for skins developers to explicitly
express whether two layouts are tightly-coupled or not, i.e should always be
kept the same size whatever the subsequent resizing performed by the user.

modules/gui/skins2/src/top_window.cpp

index 4c27bacae38eef4c52fdc311718cdf116f7cb8ac..b9811285cdd3dc2c340f4dd2d8cd2cff4b204120 100644 (file)
@@ -351,7 +351,13 @@ void TopWindow::setActiveLayout( GenericLayout *pLayout )
         }
         // The current layout becomes inactive
         m_pActiveLayout->getActiveVar().set( false );
-        pLayout->resize( m_pActiveLayout->getWidth(), m_pActiveLayout->getHeight() );
+
+        // if both layouts have the same original size, infer a
+        // subsequent resize of the active layout has to be applied
+        // to the new layout about to become active
+        if( pLayout->isTightlyCoupledWith( *m_pActiveLayout ) )
+            pLayout->resize( m_pActiveLayout->getWidth(),
+                             m_pActiveLayout->getHeight() );
     }
 
     pLayout->setWindow( this );