fixed:#11128 - using mouse wheel to scroll in fixed lists wasn't functioning correctly
authorJonathan Marshall <jmarshall@never.you.mind>
Thu, 27 Jan 2011 03:06:45 +0000 (16:06 +1300)
committertheuni <theuni-nospam-@xbmc.org>
Mon, 31 Jan 2011 02:59:09 +0000 (21:59 -0500)
(cherry picked from commit 42df464e973c0bf1dbc6b083e9ed6e94885bad09)

guilib/GUIFixedListContainer.cpp

index 1c10eb6..c25a8d3 100644 (file)
@@ -128,17 +128,23 @@ bool CGUIFixedListContainer::MoveDown(bool wrapAround)
   return true;
 }
 
-// scrolls the said amount
 void CGUIFixedListContainer::Scroll(int amount)
 {
-  // increase or decrease the offset
-  int item = m_offset + m_cursor + amount;
-  // check for our end points
-  if (item >= (int)m_items.size() - 1)
-    item = (int)m_items.size() - 1;
-  if (item < 0)
-    item = 0;
-  SelectItem(item);
+  // increase or decrease the offset within [-minCursor, m_items.size() - maxCursor]
+  int minCursor, maxCursor;
+  GetCursorRange(minCursor, maxCursor);
+  int offset = m_offset + amount;
+  if (offset < -minCursor)
+  {
+    offset = -minCursor;
+    m_cursor = minCursor;
+  }
+  if (offset > (int)m_items.size() - maxCursor)
+  {
+    offset = m_items.size() - maxCursor;
+    m_cursor = maxCursor;
+  }
+  ScrollToOffset(offset);
 }
 
 void CGUIFixedListContainer::ValidateOffset()