[vlc-devel] commit: skins2: remove unnecessary notifyLayout() (Erwan Tulou )

git version control git at videolan.org
Thu Jan 14 15:23:17 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jan 14 10:01:45 2010 +0100| [5cbb5d860cd870b552cf235e4ea385e3941dbc79] | committer: Erwan Tulou 

skins2: remove unnecessary notifyLayout()

In today's implementation, notifyLayout() for a control leads to a whole
 layout rebuilt. Therefore, this function must be called _only_ if needed.

- Never needed in onResize() since we are already in the process of rebuilding
the whole layout. Calling notifyLayout() means the job is done twice.
- Never needed in onPositionChange() for the same reason as onResize().
- Not needed for a checkbox since already called in setImage() two lines above.

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

 modules/gui/skins2/controls/ctrl_checkbox.cpp |    2 --
 modules/gui/skins2/controls/ctrl_list.cpp     |    8 ++------
 modules/gui/skins2/controls/ctrl_tree.cpp     |    2 --
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_checkbox.cpp b/modules/gui/skins2/controls/ctrl_checkbox.cpp
index 89c2c57..0f0116f 100644
--- a/modules/gui/skins2/controls/ctrl_checkbox.cpp
+++ b/modules/gui/skins2/controls/ctrl_checkbox.cpp
@@ -276,7 +276,5 @@ void CtrlCheckbox::changeButton()
 
     // Notify the window the tooltip has changed
     notifyTooltipChange();
-    // Refresh
-    notifyLayout();
 }
 
diff --git a/modules/gui/skins2/controls/ctrl_list.cpp b/modules/gui/skins2/controls/ctrl_list.cpp
index 28c8be5..4bf7d1e 100644
--- a/modules/gui/skins2/controls/ctrl_list.cpp
+++ b/modules/gui/skins2/controls/ctrl_list.cpp
@@ -78,9 +78,8 @@ void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg  )
     // Get the size of the control
     const Position *pPos = getPosition();
     if( !pPos )
-    {
         return;
-    }
+
     int height = pPos->getHeight();
 
     // How many lines can be displayed ?
@@ -114,9 +113,8 @@ void CtrlList::onResize()
     // Get the size of the control
     const Position *pPos = getPosition();
     if( !pPos )
-    {
         return;
-    }
+
     int height = pPos->getHeight();
 
     // How many lines can be displayed ?
@@ -142,14 +140,12 @@ void CtrlList::onResize()
     }
 
     makeImage();
-    notifyLayout();
 }
 
 
 void CtrlList::onPositionChange()
 {
     makeImage();
-    notifyLayout();
 }
 
 
diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 7450b48..31d9cb5 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -244,13 +244,11 @@ void CtrlTree::onResize()
     // Redraw the control if the position has changed
     m_firstPos = it;
     makeImage();
-    notifyLayout();
 }
 
 void CtrlTree::onPositionChange()
 {
     makeImage();
-    notifyLayout();
 }
 
 void CtrlTree::handleEvent( EvtGeneric &rEvent )




More information about the vlc-devel mailing list