Difference between revisions of "Patch Launcher Reset Scroll on Page Change"

From WebOS Internals
Jump to navigation Jump to search
Line 9: Line 9:
  
 
'''It works fine for me. Scroll down on a launcher page so the first row of icons is hidden. Switch to another page, and switch back. The page will be reset back to the top.'''
 
'''It works fine for me. Scroll down on a launcher page so the first row of icons is hidden. Switch to another page, and switch back. The page will be reset back to the top.'''
 +
 +
'''This is not working for me either. I have tried this code in a few different ways, and it doesn't work as described. 24 September 2009'''
  
 
==Editing Process==
 
==Editing Process==

Revision as of 05:54, 25 September 2009


Introduction

If you have many apps on a page, you may have to scroll to see some of those. The launcher maintains the scroll state (the amount you have scrolled) on each page, which means when you return to a page, you are still at the location that you last scrolled to. This can be annoying. For example, it can make it difficult to train your muscle memory because, when repeating the same steps, the app you want is not always at the same location on the screen. This patch resets the scroll of each page back to the top when it goes out of view.

Anyone have any luck with this? It's not doing a thing for me.

This is not working for me. Hmagoo 23:54, 2 September 2009 (UTC)

It works fine for me. Scroll down on a launcher page so the first row of icons is hidden. Switch to another page, and switch back. The page will be reset back to the top.

This is not working for me either. I have tried this code in a few different ways, and it doesn't work as described. 24 September 2009

Editing Process

  • SSH in.
  • Remount the filesystem as read/write:

<source lang="bash">

sudo rootfs_open -w

</source>

  • Load launcher-assistant.js in vi:

<source lang="bash">

sudo vi /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js

</source>

  • Locate the onPageChange method around line 157:

<source lang="javascript">

onPageChange: function(event) { this.activePageIndex = event.value; this.updatePageIndicators(); },

</source>

  • Add the four lines below so that onPageChange now looks like the following:

<source lang="javascript">

onPageChange: function(event) { var scroller = this.getPageScroller(); if (scroller && scroller.mojo) { scroller.mojo.revealTop(0); } this.activePageIndex = event.value; this.updatePageIndicators(); },

</source>

  • Save the file and quit vi.
  • Remount the filesystem as read only - this should reboot your Pre:

<source lang="bash">

sudo rootfs_open -w

</source>


Patch Process

The patch should soon be located in the webos-internals gitorious repository. Until then, you can copy and paste the source below. Visit Applying Patches for info on how to use it. To apply the patch, follow the instructions above, and after remounting the filesystem as read/write, do the following:

  • Apply the patch (In this example, I have the patch file located in my home directory under patches):

<source lang="bash">

cd / sudo patch -p0 --backup-if-mismatch < ~/patches/reset-scroll.patch

</source>

This is what you should see if it ran properly: <source lang="text"> patching file /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js

</source>

  • Remount the filesystem as read only as described above.


Patch Source (reset-scroll.patch)

<source lang="diff"> --- /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js.bak 2009-05-22 17:12:34.000000000 -0400 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js 2009-08-21 17:19:48.426297000 -0400 @@ -155,6 +155,10 @@

	/* keep track of which page we are on */
	onPageChange: function(event) {

+ var scroller = this.getPageScroller(); + if (scroller && scroller.mojo) { + scroller.mojo.revealTop(0); + }

		this.activePageIndex = event.value;
		this.updatePageIndicators();
	},

</source>