From b9ffb1eb889a70138855e6d870588f4282078321 Mon Sep 17 00:00:00 2001 From: jmarshallnz Date: Tue, 20 Oct 2009 20:03:20 +0000 Subject: 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 --- guilib/GUIFixedListContainer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'guilib/GUIFixedListContainer.cpp') 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; -- cgit v1.2.3