Bug 17715 - Page down action in menu operates incorrectly - skips items in some skins
: Page down action in menu operates incorrectly - skips items in some skins
Status: UNCONFIRMED
Product: SqueezePlay
Classification: Unclassified
Component: UI
: unspecified
: Macintosh MacOS X 10.5
: -- normal (vote)
: ---
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-01 10:46 UTC by Martin Williams
Modified: 2011-11-02 09:28 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Williams 2011-11-01 10:46:58 UTC
Paging down in menu views does not operate correctly. This is particularly
noticeable using WQVGAlargeskin (Touch's large screen skin - a three line
display), where the action of paging down advances too far down the list,
causing some of the available menu items to be skipped from each successive
view. Refer 'Intended behaviour' for detail.

The appended patch implements the intended page down behaviour, and has been
tested on Squeezeplay 7.6.2 r9550 using each of the four skins. No change is
required to the existing page up code as this operates correctly.

Serendipitously, the present page down action does yield the intended
behaviour when using WQVGAsmallskin (a five line display). The existing code
fortuitously happens to do the right thing in this case.

If a skin implements a menu display with more than five lines, the action of
paging down will advance too slowly. This can be observed when using
QVGAportraitskin (six lines). A custom/future skin that implemented a larger
number of items in the menu view would also be impacted.


Intended behaviour
------------------

In a regular jive menu 'Page up' and 'Page down' actions are generated by:

  Touching (not sliding) the scroll bar, above or below the slider
  Mouse click - ditto
  Use of page up/page down keys

The action is intended to move forwards (page down) / backwards (page up)
through a list of menu items, page by page. As an aid to navigation, the
bottom/top item of the currently displayed view is shown as the top/bottom
item of the next displayed view.


Patch
-----

The patch appended below applies to jive/ui/Menu.lua, and implements the
intended 'Page down' behaviour. It has been tested on Squeezeplay 7.6.2 r9550
using all skins.
No change in behaviour will be observed when using WQVGAsmallskin, but
the behaviour will be as intended when using other skins.

[Diff file referenced to 7.6/trunk/squeezeplay]

Index: src/squeezeplay/share/jive/ui/Menu.lua
===================================================================
--- src/squeezeplay/share/jive/ui/Menu.lua	(revision 9550)
+++ src/squeezeplay/share/jive/ui/Menu.lua	(working copy)
@@ -507,10 +507,22 @@
 				return EVENT_CONSUME
 
 			elseif action == "page_down" then
-				--when paging down, bottom item becomes the bottom item
+				--when paging down, bottom item becomes the top item
 				if not self.selected or self.selected < self.listSize then
-					self:setSelectedIndex(self.topItem, true )
-					self:scrollBy(self.numWidgets + 2, true, false, false)
+
+					-- This is the inverse of the page_up action.
+					-- Sets current 'cursor' to the bottom item on the display
+					-- and then scrolls down by number of lines - 2.
+
+					-- Why '- 2' instead of the expected '- 1' ?
+					-- Answer: scrollBy will try to keep one item visible
+					-- below the new 'cursor' position. This has the effect of
+					-- scrolling by one more line than we intend.
+					
+					-- setSelectedIndex(i,true) keeps 'i' within bounds, no
+					-- check required on 'i' here.
+					self:setSelectedIndex(self.topItem + self.numWidgets - 1, true )
+					self:scrollBy(self.numWidgets - 2, true, false, false)
 				end
 				return EVENT_CONSUME
Comment 1 Ben Klaas 2011-11-02 07:45:20 UTC
hi Martin-

Thanks for the patch. 

One point of clarification-- this will fix page up/page down behavior on all skins, but it's not currently an issue on WQVGAsmall (Fab4 touch skin), which is the only skin that page up/page down has *on device* relevance. In other words, this is a fix for desktop squeezeplay, and possibly a future device that uses squeezeplay and page up/page down actions.

Just to be clear, I no longer work for Logitech and have no official say in what goes in or out of firmware checkins. My general recommendation for this patch is to rigorously regression test WQVGAsmall before this is checked in. Test long lists (>200 items) and short (5-10), and test the page up/page down behavior at the top, middle, and bottom of those lists. For WQVGAsmall, it's critical to confirm that everything still works as it does currently.
Comment 2 Martin Williams 2011-11-02 09:28:33 UTC
(In reply to comment #1)

Hi Ben

> One point of clarification

Yes. I think that is the correct interpretation. A minor point:

I believe that WQVGAlargeskin may also be used on the 'Touch'. I don't own one,
so I can't confirm. Assuming that it is:

Presumably most users would only use the large screen view when the device is out
of reach. It would not be an issue in this case, as the scroll bar could not be
touched.

> rigorously regression test WQVGAsmall

I'll try to work up a test case that others can use to observe behaviours.