diff options
author | jmarshallnz <jmarshallnz@svn> | 2009-10-20 20:03:20 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2009-10-20 20:03:20 +0000 |
commit | b9ffb1eb889a70138855e6d870588f4282078321 (patch) | |
tree | bd56c5577da18410e164332fcea727a97148b683 /guilib/GUIFixedListContainer.cpp | |
parent | 63540e805bede53ad77484bd313c3e7e2bca20a9 (diff) |
fixed: fixed list focus would make some items unreachable in the case that number of items <= fixedcursor position.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23870 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIFixedListContainer.cpp')
-rw-r--r-- | guilib/GUIFixedListContainer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/guilib/GUIFixedListContainer.cpp b/guilib/GUIFixedListContainer.cpp index ce8fb5ba55..ffdbe09c94 100644 --- a/guilib/GUIFixedListContainer.cpp +++ b/guilib/GUIFixedListContainer.cpp @@ -240,9 +240,14 @@ void CGUIFixedListContainer::SelectItem(int item) // which may be different at either end of the list, then the offset int minCursor, maxCursor; GetCursorRange(minCursor, maxCursor); - if (item >= (int)m_items.size() - m_fixedCursor) + + // TODO: This breaks in the case where we have more items than slots. + // what we want to do is figure out what our cursor position should be at the end points. + // the code below only works if our offset isn't negative. eg what happens when we have + // ...xxxXx... + if ((int)m_items.size() - 1 - item <= maxCursor - m_fixedCursor) m_cursor = std::max(m_fixedCursor, maxCursor + item - (int)m_items.size() + 1); - else if (item <= m_fixedCursor) + else if (item <= m_fixedCursor - minCursor) m_cursor = std::min(m_fixedCursor, minCursor + item); else m_cursor = m_fixedCursor; |