diff -Nur microwin/src/Makefile.rules microwin/src/Makefile.rules --- microwin/src/Makefile.rules 2005-06-16 21:52:30.000000000 -0500 +++ microwin/src/Makefile.rules 2007-04-04 14:17:38.289065432 -0500 @@ -15,10 +15,10 @@ endif # install directories for headers and libraries -INSTALL_PREFIX = /usr +INSTALL_PREFIX = / INSTALL_OWNER1 = -o root -g root INSTALL_OWNER2 = -o root -g bin -HDRINSTALLDIR = $(INSTALL_PREFIX)/include/microwin +HDRINSTALLDIR = $(INSTALL_PREFIX)/include LIBINSTALLDIR = $(INSTALL_PREFIX)/lib BININSTALLDIR = $(INSTALL_PREFIX)/bin @@ -35,7 +35,7 @@ DEFINES += -DMWPIXEL_FORMAT=$(SCREEN_PIXTYPE) # Includes -INCLUDEDIRS += -I. -I$(MW_DIR_SRC)/include +INCLUDEDIRS += -I. -I/include -I$(MW_DIR_SRC)/include # Libraries required for the 'engine' functionality. MW_CORE_LIBS := @@ -131,6 +131,11 @@ LDFLAGS += -lm endif +ifeq ($(HAVE_TSLIB_SUPPORT), Y) +DEFINES += -DHAVE_TSLIB_SUPPORT=1 +LDFLAGS += -L/lib -lts -lm +endif + ifeq ($(HAVE_FREETYPE_SUPPORT), Y) DEFINES += -DHAVE_FREETYPE_SUPPORT=1 DEFINES += -DFREETYPE_FONT_DIR=\"$(FREETYPE_FONT_DIR)\" @@ -302,6 +307,10 @@ DEFINES += -DTPHELIO=1 endif +ifeq ($(UTLMOUSE), Y) + DEFINES += -DTOUCHSCREEN_TSLIB=1 +endif + ifeq ($(LIRCMOUSE), Y) DEFINES += -DMW_LIRC_MOUSE=1 endif diff -Nur microwin/src/config microwin/src/config --- microwin/src/config 2005-06-16 21:52:30.000000000 -0500 +++ microwin/src/config 2007-04-04 14:17:38.289065432 -0500 @@ -62,7 +62,7 @@ # Libraries to build: microwin, nano-X, nanowidget, object frameworks # #################################################################### -MICROWIN = Y +MICROWIN = N NANOX = Y SHAREDLIBS = Y OBJFRAMEWORK = N @@ -73,15 +73,15 @@ # Demos to build # #################################################################### -MICROWINDEMO = Y -NANOXDEMO = Y +MICROWINDEMO = N +NANOXDEMO = N #################################################################### # # Applications to build # #################################################################### -NANOWM = Y +NANOWM = N #################################################################### # @@ -99,7 +99,7 @@ # define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ # #################################################################### -SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 +SCREEN_PIXTYPE = MWPF_TRUECOLOR555 #################################################################### # @@ -108,7 +108,7 @@ # or for speed or debugging. This affects the nano-X server only. # #################################################################### -LINK_APP_INTO_SERVER = N +LINK_APP_INTO_SERVER = Y #################################################################### # Shared memory support for Nano-X client/server protocol speedup @@ -127,14 +127,14 @@ # BMP, GIF reading support #################################################################### HAVE_BMP_SUPPORT = Y -HAVE_GIF_SUPPORT = Y -HAVE_PNM_SUPPORT = Y -HAVE_XPM_SUPPORT = Y +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = N +HAVE_XPM_SUPPORT = N #################################################################### # JPEG support through libjpeg, see README.txt in contrib/jpeg #################################################################### -HAVE_JPEG_SUPPORT = Y +HAVE_JPEG_SUPPORT = N INCJPEG = . LIBJPEG = /usr/lib/libjpeg.so @@ -157,8 +157,8 @@ #################################################################### # native .fnt loadable font support #################################################################### -HAVE_FNT_SUPPORT = Y -HAVE_FNTGZ_SUPPORT = Y +HAVE_FNT_SUPPORT = N +HAVE_FNTGZ_SUPPORT = N FNT_FONT_DIR = "fonts/bdf" #################################################################### @@ -169,28 +169,35 @@ LIBT1LIB = /usr/local/lib/libt1.a #################################################################### -# TrueType font support thru FreeType 1.x +# TSLIB support through libts, #################################################################### -HAVE_FREETYPE_SUPPORT = Y -INCFTLIB = /usr/include/freetype1 -LIBFTLIB = /usr/lib/libttf.so -FREETYPE_FONT_DIR = "fonts/truetype" +HAVE_TSLIB_SUPPORT = Y +INCTS = /include +LIBTS = /lib/libts.so #################################################################### +# TrueType font support thru FreeType 1.x +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /include/freetype1 +LIBFTLIB = /lib/libttf.so +FREETYPE_FONT_DIR = "/fonts/truetype" +# might want to change this to /etc/fonts/truetype +#################################################################### # Support for many kinds of font thru FreeType 2.x # Must also set FREETYPE_FONT_DIR in the Freetype 1.x section #################################################################### -HAVE_FREETYPE_2_SUPPORT = N -INCFT2LIB = /usr/include -LIBFT2LIB = /usr/lib/libfreetype.a +HAVE_FREETYPE_2_SUPPORT = Y +INCFT2LIB = /include/freetype2 +LIBFT2LIB = /lib/libfreetype.so #################################################################### # PCF font support # Selecting HAVE_PCFGZ_SUPPORT will allow you to directly read # .pcf.gz files, but it will add libz to the size of the server #################################################################### -HAVE_PCF_SUPPORT = Y -HAVE_PCFGZ_SUPPORT = Y +HAVE_PCF_SUPPORT = N +HAVE_PCFGZ_SUPPORT = N PCF_FONT_DIR = "fonts/pcf" #################################################################### @@ -285,8 +292,8 @@ # set FBREVERSE to reverse bit orders in 1,2,4 bpp # set FBVGA=N for all systems without VGA hardware (for MIPS must=N) FRAMEBUFFER = Y -FBVGA = Y -VTSWITCH = Y +FBVGA = N +VTSWITCH = N FBREVERSE = N # set HAVETEXTMODE=Y for systems that can switch between text & graphics. @@ -319,8 +326,9 @@ # PSIONMOUSE Psion 5 (/dev/touch_psion) # YOPYMOUSE Yopy (/dev/yopy-ts) # HARRIERMOUSE NEC Harrier (/dev/tpanel) +# UTLMOUSE Universal Touschreen Library - tslib (/dev/input/event0) #################################################################### -GPMMOUSE = Y +GPMMOUSE = N SERMOUSE = N SUNMOUSE = N NOMOUSE = N @@ -336,14 +344,15 @@ YOPYMOUSE = N HARRIERMOUSE = N LIRCMOUSE = N +UTLMOUSE = Y # keyboard or null kbd driver TTYKBD = N -SCANKBD = Y +SCANKBD = N PIPEKBD = N IPAQKBD = N LIRCKBD = N -NOKBD = N +NOKBD = Y endif @@ -357,8 +366,8 @@ #################################################################### HAVE_VNCSERVER_SUPPORT = N VNCSERVER_PTHREADED = N -LIBVNC = /usr/local/lib/libvncserver.a -INCVNC = /usr/local/include +LIBVNC = /local/lib/libvncserver.a +INCVNC = /local/include #################################################################### # Screen driver specific configuration diff -Nur microwin/src/drivers/Objects.rules microwin/src/drivers/Objects.rules --- microwin/src/drivers/Objects.rules 2005-06-15 11:38:19.000000000 -0500 +++ microwin/src/drivers/Objects.rules 2007-04-04 14:17:38.313061784 -0500 @@ -159,6 +159,12 @@ MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_ser.o endif +### tslib touchscreen driver +ifeq ($(UTLMOUSE), Y) +#CFLAGS += -DTOUCHSCREEN_TSLIB=1 FIXME +MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/tslib_touchscreen.o +endif + ### Generic touchscreen driver ifeq ($(ADSMOUSE), Y) CFLAGS += -DTOUCHSCREEN_ADS=1 diff -Nur microwin/src/drivers/touchscreen_tslib.h microwin/src/drivers/touchscreen_tslib.h --- microwin/src/drivers/touchscreen_tslib.h 1969-12-31 18:00:00.000000000 -0600 +++ microwin/src/drivers/touchscreen_tslib.h 2007-04-04 14:17:38.318061024 -0500 @@ -0,0 +1,23 @@ +#include +#include +#include +#include +#include +#include +#include + +#ifndef TS_DEVICE +#define TS_DEVICE "TS_MOUSE" +#define TS_DEVICE_FILE "/dev/input/event0" + +struct ts_event { + int x; + int y; + unsigned int pressure; + struct timeval timestamp; +}; + +struct tsdev *i_ts; +struct ts_event event; +#endif + diff -Nur microwin/src/drivers/tslib_touchscreen.c microwin/src/drivers/tslib_touchscreen.c --- microwin/src/drivers/tslib_touchscreen.c 1969-12-31 18:00:00.000000000 -0600 +++ microwin/src/drivers/tslib_touchscreen.c 2007-04-04 14:17:38.318061024 -0500 @@ -0,0 +1,111 @@ +/* + * Touchscreen driver using the Universal Touscreen Library + * Copyright (c) 2006, Home Automation, Inc. + * Written by Ezban Robertson + * Copyright (c) 2003, Century Software, Inc. + * Written by Jordan Crouse + */ + +#include +#include +#include +#include +#include "device.h" + +#ifdef TOUCHSCREEN_TSLIB +#include "touchscreen_tslib.h" +#endif + +#ifndef TS_DEVICE +#error "You didn't define a device for the generic touchscreen driver!" +#endif + +static int pd_fd = -1; +static char *tsdevice=NULL; +extern SCREENDEVICE scrdev; + +static int PD_Open(MOUSEDEVICE *pmd) +{ + if((tsdevice = getenv("TSLIB_TSDEVICE")) == NULL ) + { + tsdevice = strdup("/dev/input/event0"); + } + + if(!(i_ts = ts_open(tsdevice, 0))) /* 1: non-blocking mode, 0: blocking mode */ + { + EPRINTF("Error %d opening %s touchscreen device [%s] \n", errno, TS_DEVICE, TS_DEVICE_FILE); + return -1; + } + + if(ts_config(i_ts)) + { + EPRINTF("Error: ts_config\n"); + return -1; + } + + pd_fd = ts_fd(i_ts); + + GdHideCursor(&scrdev); + return pd_fd; +} + +static void PD_Close(void) +{ + /* Close the touch panel device. */ + + if(pd_fd < 0) return; + + close(pd_fd); + free(i_ts); + pd_fd = -1; +} + +static int PD_GetButtonInfo(void) +{ + /* get "mouse" buttons supported */ + return MWBUTTON_L; +} + +static void PD_GetDefaultAccel(int *pscale,int *pthresh) +{ + *pscale = 3; + *pthresh = 5; +} + +static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb) +{ + struct ts_sample samp; + struct ts_event event; + + if((ts_read(i_ts, &samp, 1)) < 0) + { + EPRINTF("[%s] Error %d reading from touch panel.\n", TS_DEVICE, errno); + return -1; + } + + event.x = samp.x; + event.y = samp.y; + event.pressure = samp.pressure; + event.timestamp = samp.tv; + + *px = event.x; + *py = event.y; + *pz = event.pressure; + + *pb = (event.pressure > 500) ? MWBUTTON_L : 0; /* MWBUTTON_L - left button, 04*/ + if(!*pb) return 3; + if(*py < 0) return 3; + if(*px < 0) return 3; + + return 2; +} + +MOUSEDEVICE mousedev = { + PD_Open, + PD_Close, + PD_GetButtonInfo, + PD_GetDefaultAccel, + PD_Read, + NULL, + MOUSE_NORMAL /* Input filter flags */ +}; diff -Nur microwin/src/engine/devmouse.c microwin/src/engine/devmouse.c --- microwin/src/engine/devmouse.c 2005-06-23 00:00:00.000000000 -0500 +++ microwin/src/engine/devmouse.c 2007-04-04 14:17:38.322060416 -0500 @@ -218,6 +218,66 @@ * @param pb On return, holds the buttons status. * @return -1 on error, 0 if mouse has not moved, 1 if mouse has moved. */ +#ifdef TOUCHSCREEN_TSLIB +int +GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb) +{ + MWCOORD x, y, z; + int newbuttons; /* new button state */ + int status; /* status of reading mouse */ + MWCOORD dx, dy; + + *px = xpos; + *py = ypos; + *pb = buttons; + + if (changed) { + changed = FALSE; + return 1; + } + + /* read the mouse position */ + status = mousedev.Read(&x, &y, &z, &newbuttons); + /* EPRINTF("stat: %d tsread->X: %d, Y: %d, Z: %d\n",status, x, y, z); */ + if (status < 0) { + EPRINTF("GdReadMouse ERROR return -1\n"); + return -1; + } + else if(status == 2) { + if(z<=0) + EPRINTF("GdReadMouse pressure=0, STATUS=%d\n",status); + dx = x; + dy = y; + } + + /* + * At this point, we should have a valid mouse point. Check the button + * state and set the flags accordingly. We do this *after* the filters, + * because some of the filters (like the transform) need to be called + * several times before we get valid data. + */ + if (buttons != newbuttons) { + changed = TRUE; + buttons = newbuttons; + } + + /* Finally, move the mouse */ + if (status != 3) + GdMoveMouse(dx, dy); + + /* anything change? */ + if (!changed) + return 0; + + /* report new mouse data */ + changed = FALSE; + *px = xpos; + *py = ypos; + *pb = buttons; + + return 1; +} +#else int GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb) { @@ -298,6 +358,7 @@ return 1; } +#endif /** * Set the cursor position.