[vlc-commits] skins2: avoid layout resize if size is unchanged

Erwan Tulou git at videolan.org
Wed Apr 3 14:36:13 CEST 2013


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Apr  3 14:30:42 2013 +0200| [13db37f57fc6053816fd41204e38b9999e0aa746] | committer: Erwan Tulou

skins2: avoid layout resize if size is unchanged

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13db37f57fc6053816fd41204e38b9999e0aa746
---

 modules/gui/skins2/src/generic_layout.cpp |   15 ++++-----------
 modules/gui/skins2/src/window_manager.cpp |    7 +++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/gui/skins2/src/generic_layout.cpp b/modules/gui/skins2/src/generic_layout.cpp
index a2e1cd6..d9464b2 100644
--- a/modules/gui/skins2/src/generic_layout.cpp
+++ b/modules/gui/skins2/src/generic_layout.cpp
@@ -174,6 +174,10 @@ void GenericLayout::onControlUpdate( const CtrlGeneric &rCtrl,
 
 void GenericLayout::resize( int width, int height )
 {
+    // check real resize
+    if( width == m_rect.getWidth() && height == m_rect.getHeight() )
+        return;
+
     // Update the window size
     m_rect = SkinsRect( 0, 0 , width, height );
 
@@ -191,16 +195,6 @@ void GenericLayout::resize( int width, int height )
     {
         iter->m_pControl->onResize();
     }
-
-    // Resize and refresh the associated window
-    TopWindow *pWindow = getWindow();
-    if( pWindow )
-    {
-        // Resize the window
-        pWindow->resize( width, height );
-        // Change the shape of the window and redraw it
-        refreshAll();
-    }
 }
 
 
@@ -236,7 +230,6 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
     {
         // first apply new shape to the window
         pWindow->updateShape();
-
         pWindow->invalidateRect( x, y, width, height );
     }
 }
diff --git a/modules/gui/skins2/src/window_manager.cpp b/modules/gui/skins2/src/window_manager.cpp
index b611e15..24f8fd6 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -278,6 +278,13 @@ void WindowManager::resize( GenericLayout &rLayout,
     // Do the actual resizing
     rLayout.resize( newWidth, newHeight );
 
+    // Resize the window
+    TopWindow *pWindow = rLayout.getWindow();
+    pWindow->resize( newWidth, newHeight );
+
+    // refresh content
+    rLayout.refreshAll();
+
     // Move all the anchored windows
     WinSet_t::const_iterator it;
     if( m_direction == kResizeE ||



More information about the vlc-commits mailing list