Hi,

to keep things a little bit seperated i have two seperate patches. One 
includes the limitation to 640x480 fullscreen (incl. the removal of the video 
options from the option menu). And the second one contains pipelines 
touchscreen patches as well as my maemo specific tiltstick interface.

Both apply using "patch -p1" to the current 1.10 trunk

Till
--- trunk.orig/data/Makefile.am	2008-02-15 13:06:25.000000000 +0100
+++ enigma-1.10/data/Makefile.am	2008-02-15 21:06:57.000000000 +0100
@@ -6,10 +6,7 @@
 	models-2d.lua \
 	models-oxyd.lua \
 	models-editor.lua \
-	models-16.lua \
 	models-32.lua \
-	models-40.lua \
-	models-48.lua \
 	init.lua \
 	startup.lua \
 	sound-defaults.lua \
--- trunk.orig/src/video.cc	2008-02-15 13:04:14.000000000 +0100
+++ enigma-1.10/src/video.cc	2008-02-15 21:08:54.000000000 +0100
@@ -346,176 +346,6 @@
             Rect (150, 434, 475, 35),        // text area
             true, true,                      // available window, fullscreen
             "-0-","-0-"                      // fallback modes window, fullscreen
-        },
-        { 
-            VM_640x512, 640, 512,            // id, w, h
-            32, VTS_32,                      // tilesize, tiletype
-            "640x512", "640x512", "5:4",     // name, fsname, fs only
-            "models-32.lua", "gfx32/",       // initscript, dir
-            Rect (0, 0, 640, 480),           // display area
-            0, 0,                            // menu background image offsets 
-            120, 78, "",                     // thumbnail size/extension
-            Rect (0, 0, 640, 416),           // game area
-            Rect (0, 416, 640, 64),          // statusbar area
-            Rect (15, 420, 110, 40),         // time area
-            Rect (100, 420, 30, 40),         // moves area
-            Rect (152, 433, 490, 52),        // inventory area
-            Rect (150, 434, 475, 35),        // text area
-            false, false,                    // 640x512 is deprecated!
-            "-0-","-0-"                      // fallback modes window, fullscreen
-        },
-        { 
-            VM_800x600, 800, 600,            // id, w, h
-            40, VTS_40,                      // tilesize, tiletype
-            "800x600", "SVGA", "4:3",        // name, fsname, fs only
-            "models-40.lua", "gfx40/",       // initscript, dir
-            Rect (0, 0, 800, 600),           // display area
-            0, 0,                            // menu background image offsets 
-            120, 78, "",                     // thumbnail size/extension
-            Rect (0, 0, 800, 520),           // game area
-            Rect (0, 520, 800, 80),          // statusbar area
-            Rect (15, 540, 140, 40),         // time area
-            Rect (125, 540, 30, 40),         // moves area
-            Rect (192, 539, 610, 46),        // inventory area
-            Rect (185, 545, 600, 39),        // text area
-            true, true,                      // available window, fullscreen
-            "-2-0-","-2-0-"                  // fallback modes window, fullscreen
-        },
-        { 
-            VM_1024x768, 1024, 768,          // id, w, h
-            48, VTS_48,                      // tilesize, tiletype
-            "1024x768", "XGA", "4:3",        // name, fsname, fs only
-            "models-48.lua", "gfx48/",       // initscript, dir
-            Rect (32, 0, 960, 720),          // display area
-            -128, -96,                       // menu background image offsets 
-            120, 78, "",                     // thumbnail size/extension
-            Rect (32, 0, 960, 624),          // game area
-            Rect (32, 624, 960, 96),         // statusbar area
-            Rect (50, 640, 170, 60),         // time area
-            Rect (185, 640, 30, 60),         // moves area
-            Rect (260, 650, 710, 46),        // inventory area
-            Rect (260, 655, 710, 40),        // text area
-            true, true,                      // available window, fullscreen
-            "-3-2-0-","-3-2-0-"              // fallback modes window, fullscreen
-        },
-        { 
-            VM_960x720, 960, 720,            // id, w, h
-            48, VTS_48,                      // tilesize, tiletype
-            "960x720", "960x720", "4:3",     // name, fsname, fs only
-            "models-48.lua", "gfx48/",       // initscript, dir
-            Rect (0, 0, 960, 720),           // display area
-            -192, -144,                      // menu background image offsets 
-            120, 78, "",                     // thumbnail size/extension
-            Rect (0, 0, 960, 624),           // game area
-            Rect (0, 624, 960, 96),          // statusbar area
-            Rect (18, 640, 170, 60),         // time area
-            Rect (153, 640, 30, 60),         // moves area
-            Rect (228, 650, 710, 46),        // inventory area
-            Rect (228, 655, 710, 40),        // text area
-            true, true,                      // available window, fullscreen
-            "-4-2-0-","-4-2-0-"              // fallback modes window, fullscreen
-        },
-        { 
-            VM_1280x720, 1280, 720,          // id, w, h
-            48, VTS_48,                      // tilesize, tiletype
-            "1280x720", "HD720", "16:10",    // name, fsname, fs only
-            "models-48.lua", "gfx48/",       // initscript, dir
-            Rect (160, 0, 960, 720),         // display area
-            -192, -96,                       // menu background image offsets 
-            120, 78, "",                     // thumbnail size/extension
-            Rect (160, 0, 960, 624),         // game area
-            Rect (160, 624, 960, 96),        // statusbar area
-            Rect (178, 640, 170, 60),        // time area
-            Rect (313, 640, 30, 60),         // moves area
-            Rect (388, 650, 710, 46),        // inventory area
-            Rect (388, 655, 710, 40),        // text area
-            false, true,                     // available window, fullscreen
-            "-0-","-5-0-"                    // fallback modes window, fullscreen
-        },
-        { 
-            VM_1280x960, 1280, 960,          // id, w, h
-            64, VTS_64,                      // tilesize, tiletype
-            "1280x960", "1280x960", "4:3",   // name, fsname, fs only
-            "models-64.lua", "gfx64/",       // initscript, dir
-            Rect (0, 0, 1280, 960),          // display area
-            -400, -90,                       // menu background image offsets 
-            160, 104, "-160x104",            // thumbnail size/extension
-            Rect (0, 0, 1280, 832),          // game area
-            Rect (0, 832, 1280, 128),        // statusbar area
-            Rect (24, 853, 227, 80),         // time area //TODO
-            Rect (204, 853, 40, 80),         // moves area //TODO
-            Rect (304, 867, 947, 61),        // inventory area //TODO
-            Rect (304, 873, 947, 53),        // text area //TODO
-            true, true,                      // available window, fullscreen
-            "-6-4-2-0-","-6-4-2-0-"          // fallback modes window, fullscreen
-        },
-        { 
-            VM_1440x960, 1440, 960,          // id, w, h
-            64, VTS_64,                      // tilesize, tiletype
-            "1440x960", "1440x960", "3:2",   // name, fsname, fs only
-            "models-64.lua", "gfx64/",       // initscript, dir
-            Rect (80, 0, 1280, 960),         // display area
-            -400, -90,                       // menu background image offsets 
-            160, 104, "-160x104",            // thumbnail size/extension
-            Rect (80, 0, 1280, 832),         // game area
-            Rect (80, 832, 1280, 128),       // statusbar area
-            Rect (104, 853, 227, 80),        // time area //TODO
-            Rect (284, 853, 40, 80),         // moves area //TODO
-            Rect (384, 867, 947, 61),        // inventory area //TODO
-            Rect (384, 873, 947, 53),        // text area //TODO
-            false, true,                     // available window, fullscreen
-            "-0-","-7-0-"                    // fallback modes window, fullscreen
-        },
-        { 
-            VM_1280x1024, 1280, 1024,        // id, w, h
-            64, VTS_64,                      // tilesize, tiletype
-            "1280x1024", "SXGA", "5:4",      // name, fsname, fs only
-            "models-64.lua", "gfx64/",       // initscript, dir
-            Rect (0, 0, 1280, 960),          // display area
-            -400, -26,                       // menu background image offsets 
-            160, 104, "-160x104",            // thumbnail size/extension
-            Rect (0, 0, 1280, 832),          // game area
-            Rect (0, 832, 1280, 128),        // statusbar area
-            Rect (18, 640, 170, 60),         // time area //TODO
-            Rect (153, 640, 30, 60),         // moves area //TODO
-            Rect (228, 650, 710, 46),        // inventory area //TODO
-            Rect (228, 655, 710, 40),        // text area //TODO
-            false, true,                     // available window, fullscreen
-            "-0-","-8-0-"                    // fallback modes window, fullscreen
-        },
-        { 
-            VM_1680x1050, 1680, 1050,        // id, w, h
-            64, VTS_64,                      // tilesize, tiletype
-            "1680x1050", "WSXGA+", "16:10",  // name, fsname, fs only
-            "models-64.lua", "gfx64/",       // initscript, dir
-            Rect (200, 0, 1280, 960),        // display area
-            -0, -0,                          // menu background image offsets 
-            160, 104, "-160x104",            // thumbnail size/extension
-            Rect (200, 0, 1280, 832),        // game area
-            Rect (200, 832, 1280, 128),      // statusbar area
-            Rect (224, 853, 227, 80),        // time area //TODO
-            Rect (404, 853, 40, 80),         // moves area //TODO
-            Rect (504, 867, 947, 61),        // inventory area //TODO
-            Rect (504, 873, 947, 53),        // text area //TODO
-            false, true,                     // available window, fullscreen
-            "-0-","-9-0-"                    // fallback modes window, fullscreen
-        },
-        { 
-            VM_320x240, 320, 240,            // id, w, h
-            16, VTS_16,                      // tilesize, tiletype
-            "320x240", "CGA", "4:3",         // name, fsname, fs only
-            "models-16.lua", "gfx16/",       // initscript, dir
-            Rect (0, 0, 320, 240),           // display area
-            0, 0,                            // menu background image offsets 
-            60, 39, "-60x39",                // thumbnail size/extension
-            Rect (0, 0, 320, 208),           // game area
-            Rect (0, 208, 320, 32),          // statusbar area
-            Rect (5, 212, 587, 21),          // time area
-            Rect (50, 212, 15, 21),          // moves area
-            Rect (76, 216, 245, 26),         // inventory area
-            Rect (75, 217, 237, 17),         // text area
-            true, true,                      // available window, fullscreen
-            "-10-0-","-10-0-"                // fallback modes window, fullscreen
         }
     };
 
--- trunk.orig/src/video.hh	2008-02-15 13:04:14.000000000 +0100
+++ enigma-1.10/src/video.hh	2008-02-15 21:09:22.000000000 +0100
@@ -32,16 +32,6 @@
     enum VideoModes {
         VM_None      = -1,
         VM_640x480   = 0,   ///< 32 bit basic    -  4:3  - VGA
-        VM_640x512   = 1,   ///< 32 bit embedded -  5:4  - none
-        VM_800x600   = 2,   ///< 40 bit basic    -  4:3  - SVGA
-        VM_1024x768  = 3,   ///< 48 bit embedded -  4:3  - XGA
-        VM_960x720   = 4,   ///< 48 bit basic    -  4:3  - none
-        VM_1280x720  = 5,   ///< 48 bit embedded - 16:9  - HD720
-        VM_1280x960  = 6,   ///< 64 bit basic    -  4:3  - none
-        VM_1440x960  = 7,   ///< 64 bit embedded -  3:2  - none
-        VM_1280x1024 = 8,   ///< 64 bit embedded -  5:4  - SXGA
-        VM_1680x1050 = 9,   ///< 64 bit embedded - 16:10 - WSXGA+
-        VM_320x240   = 10,  ///< 16 bit basic    -  4:3  - CGA
         VM_COUNT
     };
     
--- trunk.orig/src/gui/OptionsMenu.cc	2008-02-15 13:04:12.000000000 +0100
+++ enigma-1.10/src/gui/OptionsMenu.cc	2008-02-15 21:25:15.000000000 +0100
@@ -125,43 +125,6 @@
 
 
 
-    /* -------------------- VideoModeButton -------------------- */
-    
-    VideoModeButton::VideoModeButton() : ValueButton(0, 1) {
-        bool isFullScreen = app.prefs->getBool("FullScreen");
-        setMaxValue(video::GetNumAvailableModes(isFullScreen) - 1);
-        init();
-    }
-    
-    void VideoModeButton::reinit() {
-        bool isFullScreen = app.prefs->getBool("FullScreen");
-        ValueButton::setMaxValue(video::GetNumAvailableModes(isFullScreen) - 1);
-    }
-
-    int VideoModeButton::get_value() const {
-        bool isFullScreen = app.prefs->getBool("FullScreen");        
-        return video::GetModeNumber(static_cast<video::VideoModes>(app.selectedVideoMode), isFullScreen);
-    }
-
-    void VideoModeButton::set_value(int value) {
-        bool isFullScreen = app.prefs->getBool("FullScreen");
-        video::VideoModes vm = video::GetVideoMode(value, isFullScreen);
-        app.selectedVideoMode = vm;
-
-        if (vm != video::GetBestUserMode(isFullScreen)) {
-            const video::VMInfo * info = video::GetInfo(vm);
-            app.prefs->setProperty(isFullScreen ? "VideoModesFullscreen" : "VideoModesWindow",
-                    isFullScreen ? info->fallback_fullscreen : info->fallback_window);
-        }
-    }
-
-    string VideoModeButton::get_text(int value) const {
-        bool isFullScreen = app.prefs->getBool("FullScreen");        
-        const video::VMInfo * vi = video::GetInfo(video::GetVideoMode(value, isFullScreen));
-        return vi->name;
-    }
-
-
     /* -------------------- SoundSetButton -------------------- */
     
     SoundSetButton::SoundSetButton() : ValueButton(0, 1) {
@@ -220,13 +183,6 @@
     }
     
 
-    /* -------------------- FullscreenButton -------------------- */
-    
-    FullscreenButton::FullscreenButton()
-        : BoolOptionButton("FullScreen", N_("Yes"), N_("No"))
-    {
-    }
-    
     /* -------------------- LanguageButton -------------------- */
     
     struct Language {
@@ -341,18 +297,11 @@
         BuildVList rightlabels (this, Rect(but_width+midspacing, 0, label_width, but_height), spacing);
         BuildVList right(this, Rect(but_width+midspacing+label_width, 0, but_width, but_height), spacing);
         leftlabels.add (new Label(N_("Language: "), HALIGN_RIGHT));
-        leftlabels.add (new Label(N_("Fullscreen: "), HALIGN_RIGHT));
-        leftlabels.add (new Label(N_("Video mode: "), HALIGN_RIGHT));
         leftlabels.add (new Label(N_("Gamma correction: "), HALIGN_RIGHT));
         leftlabels.add (new Label(N_("Mouse speed: "), HALIGN_RIGHT));
     
         language = new LanguageButton(this);
         left.add (language);
-        fullscreen = new FullscreenButton();
-        fullscreen->set_listener(this);
-        left.add (fullscreen);
-        videomode = new VideoModeButton();
-        left.add (videomode);
         left.add (new GammaButton);
         left.add (new MouseSpeedButton);
     
@@ -433,17 +382,7 @@
 
     bool OptionsMenu::on_event (const SDL_Event &e)
     {
-        bool handled=false;
-        if (e.type == SDL_KEYUP) {
-            if ((e.key.keysym.sym==SDLK_RETURN) &&
-                (e.key.keysym.mod & KMOD_ALT))
-            {
-                // update state of FullscreenButton :
-                fullscreen->invalidate();
-                handled = true;
-            }
-        }
-        return handled;
+        return false;
     }
     
     void OptionsMenu::on_action(Widget *w)
@@ -453,14 +392,6 @@
         else if (w == language)
             // language changed - retranslate and redraw everything
             invalidate_all();
-        else if (w == fullscreen) {
-            // switch the fullscreen button and option
-            fullscreen->on_action(fullscreen);
-            app.selectedVideoMode = video::GetBestUserMode(app.prefs->getBool("FullScreen"));
-            // update the video mode button to the modes available
-            videomode->reinit();
-            invalidate_all();
-        }
     }
     
     void OptionsMenu::tick (double)
--- trunk.orig/src/client.cc	2008-02-15 13:04:14.000000000 +0100
+++ enigma-1.10/src/client.cc	2008-02-16 13:06:11.000000000 +0100
@@ -51,12 +51,146 @@
 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;
+
+/* the includes below ae required for the tiltstick interface */
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/select.h>
+#include <linux/input.h>  /* linux kernel event interface */
+
+int TILTSTICK_SCALE = 2;
+    
 #include "client_internal.hh"
 
 /* -------------------- Auxiliary functions -------------------- */
 
 namespace
 {
+    int tiltstick_evif = 0;
+
+    /* The maemo 2008 kernel does not include the joystick subsystem. */
+    /* This program thus accesses the TiltStick via the even interface */
+    /* the linux kernel is providing for all input devices */
+
+    /* open the event interface to the TiltStick */
+    int evif_open(void) 
+    {
+        DIR *dirp;
+	struct dirent *dp;
+    
+	dirp = opendir("/dev/input");
+	if(!dirp) {
+	    fprintf(stderr, "Unable to open directory /dev/input");
+	    return -1;
+	}
+    
+	/* try to find TiltStick interface */
+	while ((dp = readdir(dirp)) != NULL) {
+            if(strncmp(dp->d_name, "event", 5) == 0) {
+	        char tiltstick_name[256];
+
+		sprintf(tiltstick_name, "/dev/input/%s", dp->d_name);
+		if((tiltstick_evif = open(tiltstick_name, O_RDONLY)) >= 0) {
+	            struct input_id id;
+
+		    /* suck out some device information */
+		    if(ioctl(tiltstick_evif, EVIOCGID, &id)) {
+		        perror("ioctl(EVIOCGID)");
+		    } else {
+		        /* only the tiltstick uses these vendor ids */
+		        if((id.vendor == 0x1c40) && (id.product == 0x0533)) {
+			    printf("Found device at %s\n", tiltstick_name);
+		      
+			    if(ioctl(tiltstick_evif, EVIOCGNAME(sizeof(tiltstick_name)),
+				     tiltstick_name) < 0) {
+			        perror("ioctl(EVIOCGNAME)");
+			    } else
+			        printf("Device name: %s\n", tiltstick_name);
+
+			    closedir(dirp);
+			    return 0;
+			}
+		    }
+		    
+		    close(tiltstick_evif);
+		    tiltstick_evif = 0;
+		} else
+		    fprintf(stderr, "Unable to open %s: %s\n",
+			    tiltstick_name, strerror(errno));
+	    }
+	}
+	closedir(dirp);
+	return -1;
+    }
+
+    int evif_poll(int *x, int *y) 
+    {
+        fd_set rfds;
+	struct timeval tv;
+	int retval;
+
+	static int xbuf = 0, ybuf = 0;
+	static int xrem = 0, yrem = 0;
+	int xcnt = 1, ycnt = 1;
+	
+	if(!tiltstick_evif) return -1;
+    
+	*x = xbuf + xrem;
+	*y = ybuf + yrem;
+	
+	do {
+	    FD_ZERO(&rfds);
+	    FD_SET(tiltstick_evif, &rfds);
+	
+	    /* don't wait at all */
+	    tv.tv_sec = tv.tv_usec = 0;
+	    
+	    retval = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
+	    
+	    if (retval == -1)
+	        perror("select()");
+	    else if (retval) {
+	        if(FD_ISSET(tiltstick_evif, &rfds)) {
+		    struct input_event ev;
+	    
+		    
+		    if(read(tiltstick_evif, &ev, sizeof(struct input_event)) < 0) {
+		        perror("read()");
+			return -1;
+		    }
+		    
+		    /* button press */
+		    if(ev.type == 1) printf("but: %d\n", ev.value);
+		    
+		    /* the TiltStick returns signed 12 bit values */
+		    if(ev.type == EV_ABS) {
+		        if(!ev.code) { *x += (xbuf = ev.value); xcnt++; }
+			else         { *y += (ybuf = ev.value); ycnt++; }
+		    }
+		}
+	    }
+	} while(retval > 0);  /* read until no more data available */
+	
+	*x /= xcnt;
+	*y /= ycnt;
+	
+	/* save remainder */
+	xrem = *x % TILTSTICK_SCALE;
+	yrem = *y % TILTSTICK_SCALE;
+	
+	*x /= TILTSTICK_SCALE;
+	*y /= TILTSTICK_SCALE;
+	
+	return 0;
+    }
+  
     /*! Display a message and change the current mouse speed. */
     void set_mousespeed (double speed)
     {
@@ -112,6 +246,7 @@
   m_cheater(false), 
   m_user_input()
 {
+    evif_open();
     m_network_host = 0;
 }
 
@@ -190,22 +325,32 @@
 void Client::handle_events() 
 {
     SDL_Event e;
+
+    int x, y;
+    evif_poll(&x, &y);
+    server::Msg_MouseForce ( V2 (x, y));
+
     while (SDL_PollEvent(&e)) {
         switch (e.type) {
         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") *
-                                        V2 (e.motion.xrel, e.motion.yrel));
+           /* 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: break;
         case SDL_MOUSEBUTTONUP:
-            on_mousebutton(e);
+           bFirstMove = 1;
+            if(!TOUCHSCREEN) on_mousebutton(e);
             break;
         case SDL_ACTIVEEVENT: {
             update_mouse_button_state();
@@ -441,9 +586,12 @@
                 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) rotate_inventory(+1); break;
+
 
         case SDLK_F10: {
             lev::Proxy *level = lev::Proxy::loadedLevel();
_______________________________________________
Enigma-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/enigma-devel

Reply via email to