aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIFixedListContainer.cpp
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2009-10-20 20:03:20 +0000
committerjmarshallnz <jmarshallnz@svn>2009-10-20 20:03:20 +0000
commitb9ffb1eb889a70138855e6d870588f4282078321 (patch)
treebd56c5577da18410e164332fcea727a97148b683 /guilib/GUIFixedListContainer.cpp
parent63540e805bede53ad77484bd313c3e7e2bca20a9 (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.cpp9
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;