Fix 2524488 Not able to launch app in the last line of app launcher in landscape mode

Change-Id: Iffe3e95a10e49f1dadcab2f4f177e79c0140699e
diff --git a/res/raw/allapps.rs b/res/raw/allapps.rs
index e28ab0a..af5abd3 100644
--- a/res/raw/allapps.rs
+++ b/res/raw/allapps.rs
@@ -28,6 +28,8 @@
 float g_MoveToTime;
 float g_MoveToOldPos;
 
+int g_Cols;
+int g_Rows;
 
 // Drawing constants, should be parameters ======
 #define VIEW_ANGLE 1.28700222f
@@ -388,10 +390,14 @@
 
     // icons & labels
     int iconCount = state->iconCount;
-    g_PosMax = ((iconCount + 3) / 4) - 4;
     if (getWidth() > getHeight()) {
-        g_PosMax -= 2;
+        g_Cols = 6;
+        g_Rows = 3;
+    } else {
+        g_Cols = 4;
+        g_Rows = 4;
     }
+    g_PosMax = ((iconCount + (g_Cols-1)) / g_Cols) - g_Rows;
     if (g_PosMax < 0) g_PosMax = 0;
 
     updatePos();