[vlc-commits] commit: skins2: small optimisation (Erwan Tulou )

git at videolan.org git at videolan.org
Thu Sep 16 09:51:05 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Sep 15 17:59:04 2010 +0200| [9427bb62cc89999ceee5e9fbd6a98c78db84ea8d] | committer: Erwan Tulou 

skins2: small optimisation

Only update image and notify for those mouse events that we care about.
This removes the job being done twice (once on mouse pressed and once
 on mouse released)

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

 modules/gui/skins2/controls/ctrl_tree.cpp |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 914dd52..508eb41 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -512,6 +512,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
                 it->m_selected = (*it).m_selected || select;
                 select = nextSelect;
             }
+            // Redraw the control
+            makeImage();
+            notifyLayout();
         }
         else if( rEvent.getAsString().find( "mouse:left:down:ctrl" ) !=
                  string::npos )
@@ -523,6 +526,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
                 it->m_selected = !it->m_selected;
                 m_pLastSelected = &*it;
             }
+            // Redraw the control
+            makeImage();
+            notifyLayout();
         }
         else if( rEvent.getAsString().find( "mouse:left:down:shift" ) !=
                  string::npos )
@@ -551,6 +557,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
                 it->m_selected = select;
                 select = nextSelect;
             }
+            // Redraw the control
+            makeImage();
+            notifyLayout();
         }
         else if( rEvent.getAsString().find( "mouse:left:down" ) !=
                  string::npos )
@@ -585,8 +594,10 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
                     }
                 }
             }
+            // Redraw the control
+            makeImage();
+            notifyLayout();
         }
-
         else if( rEvent.getAsString().find( "mouse:left:dblclick" ) !=
                  string::npos )
         {
@@ -596,10 +607,10 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
                // Execute the action associated to this item
                m_rTree.action( &*it );
             }
+            // Redraw the control
+            makeImage();
+            notifyLayout();
         }
-        // Redraw the control
-        makeImage();
-        notifyLayout();
     }
 
     else if( rEvent.getAsString().find( "scroll" ) != string::npos )



More information about the vlc-commits mailing list