[vlc-commits] commit: skins2: fix arrows short of 1 (Erwan Tulou )
git at videolan.org
git at videolan.org
Tue Aug 10 11:34:07 CEST 2010
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Aug 5 18:05:45 2010 +0200| [e14ddb1442a8215a4dc3a6a19bba737e17d9fc4e] | committer: Erwan Tulou
skins2: fix arrows short of 1
For n items, index spans from 0 to (n-1).
This issue accounted for arrows failing to move the cursor past the end of
the visible list (short of 1 click)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e14ddb1442a8215a4dc3a6a19bba737e17d9fc4e
---
modules/gui/skins2/controls/ctrl_tree.cpp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index c31962c..b8be9b4 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -697,13 +697,13 @@ bool CtrlTree::ensureVisible( int focusItemIndex )
if( it != m_rTree.end()
&& ( focusItemIndex < firstPosIndex
- || focusItemIndex > firstPosIndex + maxItems() ) )
+ || focusItemIndex > firstPosIndex + maxItems() - 1 ) )
{
// Scroll to have the wanted stream visible
VarPercent &rVarPos = m_rTree.getPositionVar();
- rVarPos.set( 1.0 - (double)focusItemIndex /
- (double)( m_flat ? m_rTree.countLeafs()
- : m_rTree.visibleItems() ) );
+ int indexMax = ( m_flat ? m_rTree.countLeafs()
+ : m_rTree.visibleItems() ) - 1;
+ rVarPos.set( 1.0 - (double)focusItemIndex / (double)indexMax );
return true;
}
return false;
More information about the vlc-commits
mailing list