Index: client.cc
===================================================================
--- client.cc	(revision 1046)
+++ client.cc	(working copy)
@@ -51,6 +51,13 @@
 using namespace ecl;
 using namespace std;
 
+/* maemo build mods */
+int IS_MAEMO = 1; /* Mostly Keybinding specific stuff */
+int TOUCHSCREEN=1;
+int TOUCHSCREEN_MULTIPLE=2;
+int bFirstMove=1; 
+int bMouse1=0;
+
 #include "client_internal.hh"
 
 /* -------------------- Auxiliary functions -------------------- */
@@ -192,20 +199,26 @@
     SDL_Event e;
     while (SDL_PollEvent(&e)) {
         switch (e.type) {
+	case SDL_KEYUP:
+	    if (IS_MAEMO && bMouse1) { bMouse1 = 0; update_mouse_button_state(); } break;
         case SDL_KEYDOWN:
             on_keydown(e);
             break;
         case SDL_MOUSEMOTION:
-            if (abs(e.motion.xrel) > 300 || abs(e.motion.yrel) > 300) {
-                fprintf(stderr, "mouse event with %i, %i\n", e.motion.xrel, e.motion.yrel);
-            }
-            else
-                server::Msg_MouseForce (options::GetDouble("MouseSpeed") *
+	    /* Ignore first moves after stylus lift (mouseup) */
+	    if ((TOUCHSCREEN==1) && (bFirstMove==1)) { bFirstMove = 0; }
+	    else {
+               if (abs(e.motion.xrel) > 300 || abs(e.motion.yrel) > 300) {
+                  fprintf(stderr, "mouse event with %i, %i\n", e.motion.xrel, e.motion.yrel);
+               }
+               else
+                  server::Msg_MouseForce (options::GetDouble("MouseSpeed") * (TOUCHSCREEN?TOUCHSCREEN_MULTIPLE:1) *
                                         V2 (e.motion.xrel, e.motion.yrel));
+	    }
             break;
-        case SDL_MOUSEBUTTONDOWN:
+        case SDL_MOUSEBUTTONDOWN: if (IS_MAEMO) break;
         case SDL_MOUSEBUTTONUP:
-            on_mousebutton(e);
+	    if (IS_MAEMO) { bFirstMove = 1; } else on_mousebutton(e);
             break;
         case SDL_ACTIVEEVENT: {
             update_mouse_button_state();
@@ -229,7 +242,7 @@
 
 void Client::update_mouse_button_state() 
 {
-    int b = SDL_GetMouseState(0, 0);
+    int b=(IS_MAEMO)?bMouse1:SDL_GetMouseState(0, 0);
     player::InhibitPickup((b & SDL_BUTTON(1)) || (b & SDL_BUTTON(3)));
 }
 
@@ -441,9 +454,11 @@
                 server::Msg_Command ("suicide"); 
             break;
 
-        case SDLK_F4: Msg_AdvanceLevel(lev::ADVANCE_STRICTLY); break;
+        case SDLK_F4: if (IS_MAEMO) { show_help(); } else Msg_AdvanceLevel(lev::ADVANCE_STRICTLY); break;
         case SDLK_F5: Msg_AdvanceLevel(lev::ADVANCE_UNSOLVED); break;
-        case SDLK_F6: Msg_JumpBack(); break;
+        case SDLK_F6: if (IS_MAEMO) {  server::Msg_ActivateItem ();  } else Msg_JumpBack(); break;
+	case SDLK_F7: if (IS_MAEMO) Msg_AdvanceLevel(lev::ADVANCE_STRICTLY); break;
+	case SDLK_F8: if (IS_MAEMO) { bMouse1 = 1; update_mouse_button_state(); } break;
 
         case SDLK_F10: {
             lev::Proxy *level = lev::Proxy::loadedLevel();
@@ -461,8 +476,8 @@
         }
         case SDLK_RETURN: process_userinput(); break;
         case SDLK_BACKSPACE: user_input_backspace(); break;
-        case SDLK_UP: user_input_previous(); break;
-        case SDLK_DOWN: user_input_next(); break;
+        case SDLK_UP: if (IS_MAEMO) { rotate_inventory(-1); } else user_input_previous(); break;
+        case SDLK_DOWN: if (IS_MAEMO) { rotate_inventory(+1); } else user_input_next(); break;
         default:
             if (e.key.keysym.unicode  && (e.key.keysym.unicode & 0xff80) == 0) {
                 char ascii = static_cast<char>(e.key.keysym.unicode & 0x7f);
