aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/obsolete/qte
diff options
context:
space:
mode:
authorFrans Meulenbroeks <fransmeulenbroeks@gmail.com>2010-10-07 19:25:05 +0200
committerFrans Meulenbroeks <fransmeulenbroeks@gmail.com>2010-10-07 19:49:00 +0200
commit07d484213524a460a78018198ed17f13e6bfec1c (patch)
treed2b38e1bf24d7d39ca524b32dcec9f68a29f4c4c /recipes/obsolete/qte
parent02d509a55b745d23a2690fa7edf87dd1358e297d (diff)
downloadopenembedded-07d484213524a460a78018198ed17f13e6bfec1c.tar.gz
qte : moved unused files to obsolete dir
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/obsolete/qte')
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/c700-hardware.patch27
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/devfs.patch161
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/ipaq-keyboard.patch27
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/mnci-touchscreen.patch1987
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/mnci.patch125
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/simpad-defaultkbd.patch11
-rw-r--r--recipes/obsolete/qte/qte-2.3.10/deprecated/simpad.patch340
7 files changed, 2678 insertions, 0 deletions
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/c700-hardware.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/c700-hardware.patch
new file mode 100644
index 0000000000..fa4bd25f37
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/c700-hardware.patch
@@ -0,0 +1,27 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.cpp~c700-hardware
++++ qt-2.3.9-snapshot-20050114/src/kernel/qwsmouse_qws.cpp
+@@ -87,6 +87,19 @@
+ #define QT_QWS_TP_PRESSURE_THRESHOLD 500
+ #define QT_QWS_TP_MOVE_LIMIT 50
+ #define QT_QWS_TP_JITTER_LIMIT 2
++#elif defined(QT_QWS_SLC700)
++#define QT_QWS_SLC700_RAW
++typedef struct {
++ unsigned short pressure;
++ unsigned short x;
++ unsigned short y;
++ unsigned short millisecs;
++} TS_EVENT;
++#define QT_QWS_TP_SAMPLE_SIZE 10
++#define QT_QWS_TP_MINIMUM_SAMPLES 4
++#define QT_QWS_TP_PRESSURE_THRESHOLD 500
++#define QT_QWS_TP_MOVE_LIMIT 50
++#define QT_QWS_TP_JITTER_LIMIT 2
+ #endif
+
+ #ifndef QT_QWS_TP_SAMPLE_SIZE
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/devfs.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/devfs.patch
new file mode 100644
index 0000000000..dd46d516ff
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/devfs.patch
@@ -0,0 +1,161 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+Index: qt-2.3.10/configure
+===================================================================
+--- qt-2.3.10.orig/configure 2005-07-03 12:26:10.000000000 +0200
++++ qt-2.3.10/configure 2005-07-03 12:30:36.000000000 +0200
+@@ -412,6 +412,9 @@
+ -visibility-hidden)
+ VISIBILITY=YES
+ ;;
++ -devfs)
++ DEVFS=yes
++ ;;
+ -no-g++-exceptions)
+ GPLUSPLUS_EXCEPTIONS=no
+ ;;
+@@ -1302,6 +1305,8 @@
+ -visibility-hidden . Use -fvisibility=hidden as default. This requires GCC 4.0
+ or a special patched GCC to support the visibility attribute
+
++ -devfs ............. Use devfs /dev paths.
++
+ -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
+ compiler by using the -fno-exceptions flag.
+
+@@ -1374,6 +1379,10 @@
+ then
+ QT_CXX="${QT_CXX} -DGCC_SUPPORTS_VISIBILITY -fvisibility=hidden"
+ fi
++if [ "x$DEVFS" = "xyes" ]
++then
++ QT_CXX="${QT_CXX} -DQT_QWS_DEVFS"
++fi
+ if [ "x$THREAD" = "xyes" ]
+ then
+ cat >src-mt.mk <<EOF
+Index: qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qgfxlinuxfb_qws.cpp 2005-07-03 12:26:13.000000000 +0200
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp 2005-07-03 12:30:36.000000000 +0200
+@@ -101,11 +101,19 @@
+ bool QLinuxFbScreen::connect( const QString &displaySpec )
+ {
+ // Check for explicitly specified device
++#ifdef QT_QWS_DEVFS
++ QRegExp r( "/dev/fb/[0-9]+" );
++#else
+ QRegExp r( "/dev/fb[0-9]+" );
++#endif
+ int len;
+ int m = r.match( displaySpec, 0, &len );
+
++#ifdef QT_QWS_DEVFS
++ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb/0");
++#else
+ QString dev = (m>=0) ? displaySpec.mid( m, len ) : QString("/dev/fb0");
++#endif
+
+ fd=open( dev.latin1(), O_RDWR );
+ if (fd<0) {
+@@ -121,14 +129,22 @@
+
+ /* Get fixed screen information */
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading fixed information");
+ return FALSE;
+ }
+
+ /* Get variable screen information */
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo)) {
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
+ perror("reading /dev/fb0");
++#endif
+ qWarning("Error reading variable information");
+ return FALSE;
+ }
+@@ -165,7 +181,11 @@
+ data += dataoffset;
+
+ if ((int)data == -1) {
+- perror("mapping /dev/fb0");
++#ifdef QT_QWS_DEVFS
++ perror("reading /dev/fb/0");
++#else
++ perror("reading /dev/fb0");
++#endif
+ qWarning("Error: failed to map framebuffer device to memory.");
+ return FALSE;
+ }
+@@ -229,7 +249,11 @@
+
+ static void writeTerm(const char* termctl, int sizeof_termctl)
+ {
++#ifdef QT_QWS_DEVFS
++ const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
++#else
+ const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
++#endif
+ const char** dev=tt;
+ while (*dev) {
+ int tty=::open(*dev,O_WRONLY);
+Index: qt-2.3.10/src/kernel/qkeyboard_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp 2005-07-03 12:26:13.000000000 +0200
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2005-07-03 12:30:36.000000000 +0200
+@@ -1253,7 +1253,11 @@
+
+ QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString& device)
+ {
++#ifdef QT_QWS_DEVFS
++ kbdFD=open(device.isEmpty() ? "/dev/vc/1" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#else
+ kbdFD=open(device.isEmpty() ? "/dev/tty0" : device.latin1(), O_RDWR | O_NDELAY, 0);
++#endif
+
+ if ( kbdFD >= 0 ) {
+ QSocketNotifier *notifier;
+Index: qt-2.3.10/src/kernel/qwindowsystem_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qwindowsystem_qws.cpp 2005-07-03 12:26:11.000000000 +0200
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.cpp 2005-07-03 12:30:36.000000000 +0200
+@@ -836,7 +836,11 @@
+ void openDevice()
+ {
+ if ( !sn ) {
++#ifdef QT_QWS_DEVFS
++ int fd = ::open("/dev/sound/dsp",O_RDWR);
++#else
+ int fd = ::open("/dev/dsp",O_RDWR);
++#endif
+ if ( fd < 0 ) {
+ // For debugging purposes - defined QT_NO_SOUND if you
+ // don't have sound hardware!
+Index: qt-2.3.10/src/kernel/qsoundqss_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qsoundqss_qws.cpp 2005-01-23 15:00:46.000000000 +0100
++++ qt-2.3.10/src/kernel/qsoundqss_qws.cpp 2005-07-03 12:30:36.000000000 +0200
+@@ -1088,7 +1088,12 @@
+ // Don't block open right away.
+ //
+ bool openOkay = false;
+- if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
++#ifdef QT_QWS_DEVFS
++ if ((fd = ::open("/dev/sound/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#else
++ if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1)
++#endif
++ {
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ openOkay = (fcntl(fd, F_SETFL, flags) == 0);
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/ipaq-keyboard.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/ipaq-keyboard.patch
new file mode 100644
index 0000000000..47474f698e
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/ipaq-keyboard.patch
@@ -0,0 +1,27 @@
+Index: qt-2.3.10/src/kernel/qkeyboard_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp 2005-02-20 13:20:03.285091763 +0100
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp 2005-02-20 13:21:49.668213425 +0100
+@@ -527,17 +527,17 @@
+ { Qt::Key_Plus, '+' , '-' , 0xffff },
+ { Qt::Key_Pause, 0xffff , 0xffff , 0xffff }, // 120
+ { Qt::Key_F31, 0xffff , 0xffff , 0xffff }, // IM toggle
+- { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // Sync
+- { Qt::Key_F34, 0xffff , 0xffff , 0xffff }, // Power
+- { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // Backlight
++ { Qt::Key_SysReq, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F9, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F10, 0xffff , 0xffff , 0xffff }, // iPAQ
+ #if defined(QT_KEYPAD_MODE)
+ { Qt::Key_Context1, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context2, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context3, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_Context4, 0xffff , 0xffff , 0xffff },
+ #else
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
++ { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // iPAQ
++ { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // iPAQ
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ { Qt::Key_unknown, 0xffff , 0xffff , 0xffff },
+ #endif
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci-touchscreen.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci-touchscreen.patch
new file mode 100644
index 0000000000..570c2ff290
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci-touchscreen.patch
@@ -0,0 +1,1987 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qwsmouse_qws.cpp~ramses-touchscreen
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+@@ -1,5 +1,5 @@
+ /****************************************************************************
+-** $Id: qt/src/kernel/qwsmouse_qws.cpp 2.3.10 edited 2005-01-24 $
++** $Id: qt/src/kernel/qwsmouse_qws.cpp 2.3.7 edited 2003-02-04 $
+ **
+ ** Implementation of Qt/Embedded mouse drivers
+ **
+@@ -47,85 +47,32 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <sys/ioctl.h>
+-#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <termios.h>
+
++
+ #include <qgfx_qws.h>
+ #if !defined(_OS_QNX6_)
+
+-#ifdef QT_QWS_CASSIOPEIA
+-#include <linux/tpanel.h>
+-#endif
+-#ifdef QT_QWS_TSLIB
+-#include <tslib.h>
+-#endif
+-
+-
+-//#define QT_QWS_K2
+-
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_K2)
+-#define QT_QWS_IPAQ_RAW
+-typedef struct {
+- unsigned short pressure;
+- unsigned short x;
+- unsigned short y;
+- unsigned short pad;
+- struct timeval stamp;
+-} TS_EVENT;
+-#elif defined(QT_QWS_SL5XXX)
+-#define QT_QWS_SL5XXX_RAW
+-typedef struct {
+- long y;
+- long x;
+- long pressure;
+- long long millisecs;
+-} TS_EVENT;
+-#define QT_QWS_TP_SAMPLE_SIZE 10
+-#define QT_QWS_TP_MINIMUM_SAMPLES 4
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 500
+-#define QT_QWS_TP_MOVE_LIMIT 50
+-#define QT_QWS_TP_JITTER_LIMIT 2
+-#elif defined(QT_QWS_SLC700)
+-#define QT_QWS_SLC700_RAW
+-typedef struct {
+- unsigned short pressure;
+- unsigned short x;
+- unsigned short y;
+- unsigned short millisecs;
+-} TS_EVENT;
+-#define QT_QWS_TP_SAMPLE_SIZE 10
+-#define QT_QWS_TP_MINIMUM_SAMPLES 4
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 500
+-#define QT_QWS_TP_MOVE_LIMIT 50
+-#define QT_QWS_TP_JITTER_LIMIT 2
+-#endif
+-
+-#ifndef QT_QWS_TP_SAMPLE_SIZE
+-#define QT_QWS_TP_SAMPLE_SIZE 5
+-#endif
+-
+-#ifndef QT_QWS_TP_MINIMUM_SAMPLES
+-#define QT_QWS_TP_MINIMUM_SAMPLES 5
++#ifndef QT_QWS_TP_PRESSURE_DOWN_THRESHOLD
++#define QT_QWS_TP_PRESSURE_DOWN_THRESHOLD 500
+ #endif
+
+-#ifndef QT_QWS_TP_PRESSURE_THRESHOLD
+-#define QT_QWS_TP_PRESSURE_THRESHOLD 1
++#ifndef QT_QWS_TP_PRESSURE_UP_THRESHOLD
++#define QT_QWS_TP_PRESSURE_UP_THRESHOLD 450
+ #endif
+
+-#ifndef QT_QWS_TP_MOVE_LIMIT
+-#define QT_QWS_TP_MOVE_LIMIT 100
++#ifndef QT_QWS_TP_TABLE_SIZE
++#define QT_QWS_TP_TABLE_SIZE 2
+ #endif
+
+-#ifndef QT_QWS_TP_JITTER_LIMIT
+-#define QT_QWS_TP_JITTER_LIMIT 2
++#ifndef QT_QWS_TP_MOVE_MAX
++#define QT_QWS_TP_MOVE_MAX 100
+ #endif
+
+-//#define QWS_CUSTOMTOUCHPANEL
+-
+ /*!
+ \class QWSMouseHandler qwsmouse_qws.h
+ \brief Mouse driver/handler for Qt/Embedded
+@@ -168,8 +115,7 @@
+ enum MouseProtocol { Unknown = -1, Auto = 0,
+ MouseMan, IntelliMouse, Microsoft,
+ QVFBMouse, TPanel, BusMouse,
+- FirstAuto = MouseMan,
+- LastAuto = Microsoft };
++ };
+
+ static void limitToScreen( QPoint &pt )
+ {
+@@ -186,810 +132,14 @@
+ } MouseConfig;
+
+ static const MouseConfig mouseConfig[] = {
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+ { "Auto", Auto },
+-#endif
+-#ifndef QT_NO_QWS_MOUSE_PC
+- { "MouseMan", MouseMan },
+- { "IntelliMouse", IntelliMouse },
+- { "USB", IntelliMouse },
+- { "Microsoft", Microsoft },
+-#endif
+-#ifndef QT_NO_QWS_VFB
+ { "QVFbMouse", QVFBMouse },
+-#endif
+ { "TPanel", TPanel },
+- { "BusMouse", BusMouse },
+ { 0, Unknown }
+ };
+
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-/*
+- * Automatic-detection mouse driver
+- */
+-
+-class QAutoMouseSubHandler {
+-protected:
+- enum { max_buf=32 };
+-
+- int fd;
+-
+- uchar buffer[max_buf];
+- int nbuf;
+-
+- QPoint motion;
+- int bstate;
+-
+- int goodness;
+- int badness;
+-
+- virtual int tryData()=0;
+-
+-public:
+- QAutoMouseSubHandler(int f) : fd(f)
+- {
+- nbuf = bstate = goodness = badness = 0;
+- }
+-
+- int file() const { return fd; }
+-
+- void closeIfNot(int& f)
+- {
+- if ( fd != f ) {
+- f = fd;
+- close(fd);
+- }
+- }
+-
+- void worse(int by=1) { badness+=by; }
+- bool reliable() const { return goodness >= 5 && badness < 50; }
+- int buttonState() const { return bstate; }
+- bool motionPending() const { return motion!=QPoint(0,0); }
+- QPoint takeMotion() { QPoint r=motion; motion=QPoint(0,0); return r; }
+-
+- void appendData(uchar* data, int length)
+- {
+- memcpy(buffer+nbuf, data, length);
+- nbuf += length;
+- }
+-
+- enum UsageResult { Insufficient, Motion, Button };
+-
+- UsageResult useData()
+- {
+- int pbstate = bstate;
+- int n = tryData();
+- if ( n > 0 ) {
+- if ( n<nbuf )
+- memmove( buffer, buffer+n, nbuf-n );
+- nbuf -= n;
+- return pbstate == bstate ? Motion : Button;
+- }
+- return Insufficient;
+- }
+-};
+-
+-class QAutoMouseSubHandler_intellimouse : public QAutoMouseSubHandler {
+- int packetsize;
+-public:
+- QAutoMouseSubHandler_intellimouse(int f) : QAutoMouseSubHandler(f)
+- {
+- init();
+- }
+-
+- void init()
+- {
+- int n;
+- uchar reply[20];
+-
+- tcflush(fd,TCIOFLUSH);
+- static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 };
+- static const uchar query[] = { 0xf2 };
+- if (write(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
+- badness = 100;
+- return;
+- }
+- usleep(10000);
+- tcflush(fd,TCIOFLUSH);
+- if (write(fd, query, sizeof(query))!=sizeof(query)) {
+- badness = 100;
+- return;
+- }
+- usleep(10000);
+- n = read(fd, reply, 20);
+- if ( n > 0 ) {
+- goodness = 10;
+- switch ( reply[n-1] ) {
+- case 3:
+- case 4:
+- packetsize = 4;
+- break;
+- default:
+- packetsize = 3;
+- }
+- } else {
+- badness = 100;
+- }
+- }
+-
+- int tryData()
+- {
+- if ( nbuf >= packetsize ) {
+- //int overflow = (buffer[0]>>6 )& 0x03;
+-
+- if ( /*overflow ||*/ !(buffer[0] & 8) ) {
+- badness++;
+- return 1;
+- } else {
+- motion +=
+- QPoint((buffer[0] & 0x10) ? buffer[1]-256 : buffer[1],
+- (buffer[0] & 0x20) ? 256-buffer[2] : -buffer[2]);
+- int nbstate = buffer[0] & 0x7;
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- }
+- return packetsize;
+- }
+- return 0;
+- }
+-};
+-
+-class QAutoMouseSubHandler_serial : public QAutoMouseSubHandler {
+-public:
+- QAutoMouseSubHandler_serial(int f) : QAutoMouseSubHandler(f)
+- {
+- initSerial();
+- }
+-
+-protected:
+- void setflags(int f)
+- {
+- termios tty;
+- tcgetattr(fd, &tty);
+- tty.c_iflag = IGNBRK | IGNPAR;
+- tty.c_oflag = 0;
+- tty.c_lflag = 0;
+- tty.c_cflag = f | CREAD | CLOCAL | HUPCL;
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- tty.c_line = 0;
+-#endif
+- tty.c_cc[VTIME] = 0;
+- tty.c_cc[VMIN] = 1;
+- tcsetattr(fd, TCSANOW, &tty);
+- }
+-
+-private:
+- void initSerial()
+- {
+- int speed[4] = { B9600, B4800, B2400, B1200 };
+-
+- for (int n = 0; n < 4; n++) {
+- setflags(CSTOPB | speed[n]);
+- write(fd, "*q", 2);
+- usleep(10000);
+- }
+- }
+-};
+-
+-class QAutoMouseSubHandler_mousesystems : public QAutoMouseSubHandler_serial {
+-public:
+- // ##### This driver has not been tested
+-
+- QAutoMouseSubHandler_mousesystems(int f) : QAutoMouseSubHandler_serial(f)
+- {
+- init();
+- }
+-
+- void init()
+- {
+- setflags(B1200|CS8|CSTOPB);
+- // 60Hz
+- if (write(fd, "R", 1)!=1) {
+- badness = 100;
+- return;
+- }
+- tcflush(fd,TCIOFLUSH);
+- }
+-
+- int tryData()
+- {
+- if ( nbuf >= 5 ) {
+- if ( (buffer[0] & 0xf8) != 0x80 ) {
+- badness++;
+- return 1;
+- }
+- motion +=
+- QPoint((signed char)buffer[1] + (signed char)buffer[3],
+- -(signed char)buffer[2] + (signed char)buffer[4]);
+- int t = ~buffer[0];
+- int nbstate = ((t&3) << 1) | ((t&4) >> 2);
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- return 5;
+- }
+- return 0;
+- }
+-};
+-
+-class QAutoMouseSubHandler_ms : public QAutoMouseSubHandler_serial {
+- int mman;
+-public:
+- QAutoMouseSubHandler_ms(int f) : QAutoMouseSubHandler_serial(f)
+- {
+- mman=0;
+- init();
+- }
+-
+- void init()
+- {
+- setflags(B1200|CS7);
+- // 60Hz
+- if (write(fd, "R", 1)!=1) {
+- badness = 100;
+- return;
+- }
+- tcflush(fd,TCIOFLUSH);
+- }
+-
+- int tryData()
+- {
+- if ( !(buffer[0] & 0x40) ) {
+- if ( buffer[0] == 0x20 && (bstate & Qt::MidButton) ) {
+- mman=1; // mouseman extension
+- }
+- return 1;
+- }
+- int extra = mman&&(bstate & Qt::MidButton);
+- if ( nbuf >= 3+extra ) {
+- int nbstate = 0;
+- if ( buffer[0] == 0x40 && !bstate && !buffer[1] && !buffer[2] ) {
+- nbstate = Qt::MidButton;
+- } else {
+- nbstate = ((buffer[0] & 0x20) >> 5)
+- | ((buffer[0] & 0x10) >> 3);
+- if ( extra && buffer[3] == 0x20 )
+- nbstate = Qt::MidButton;
+- }
+-
+- if ( buffer[1] & 0x40 ) {
+- badness++;
+- return 1;
+- } else {
+- motion +=
+- QPoint((signed char)((buffer[0]&0x3)<<6)
+- |(signed char)(buffer[1]&0x3f),
+- (signed char)((buffer[0]&0xc)<<4)
+- |(signed char)(buffer[2]&0x3f));
+- if ( motion.x() || motion.y() || bstate != nbstate ) {
+- bstate = nbstate;
+- goodness++;
+- } else {
+- badness++;
+- return 1;
+- }
+- return 3+extra;
+- }
+- }
+- return 0;
+- }
+-};
+-
+-/*
+-QAutoMouseHandler::UsageResult QAutoMouseHandler::useDev(Dev& d)
+-{
+- if ( d.nbuf >= mouseData[d.protocol].bytesPerPacket ) {
+- uchar *mb = d.buf;
+- int bstate = 0;
+- int dx = 0;
+- int dy = 0;
+-
+- switch (mouseProtocol) {
+- case MouseMan:
+- case IntelliMouse:
+- {
+- bstate = mb[0] & 0x7; // assuming Qt::*Button order
+-
+- int overflow = (mb[0]>>6 )& 0x03;
+- if (mouseProtocol == MouseMan && overflow) {
+- //### wheel events signalled with overflow bit, ignore for now
+- }
+- else {
+- bool xs = mb[0] & 0x10;
+- bool ys = mb[0] & 0x20;
+- dx = xs ? mb[1]-256 : mb[1];
+- dy = ys ? mb[2]-256 : mb[2];
+- }
+- break;
+- }
+- case Microsoft:
+- if ( ((mb[0] & 0x20) >> 3) ) {
+- bstate |= Qt::LeftButton;
+- }
+- if ( ((mb[0] & 0x10) >> 4) ) {
+- bstate |= Qt::RightButton;
+- }
+-
+- dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f));
+- dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f));
+-
+- break;
+- }
+- }
+- }
+-*/
+-
+-#endif
+-
+-class QAutoMouseHandler : public QWSMouseHandler {
+- Q_OBJECT
+-
+-public:
+- QAutoMouseHandler();
+- ~QAutoMouseHandler();
+-
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-private:
+- enum { max_dev=32 };
+- QAutoMouseSubHandler *sub[max_dev];
+- QList<QSocketNotifier> notifiers;
+- int nsub;
+- int retries;
+-#endif
+-
+-private slots:
+- void readMouseData(int);
+-
+-private:
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- void openDevices();
+- void closeDevices();
+- void notify(int fd);
+- bool sendEvent(QAutoMouseSubHandler& h)
+- {
+- if ( h.reliable() ) {
+- mousePos += h.takeMotion();
+- limitToScreen( mousePos );
+-/*
+-qDebug("%d,%d %c%c%c",
+-mousePos.x(),mousePos.y(),
+-(h.buttonState()&Qt::LeftButton)?'L':'.',
+-(h.buttonState()&Qt::MidButton)?'M':'.',
+-(h.buttonState()&Qt::RightButton)?'R':'.');
+-*/
+- emit mouseChanged(mousePos,h.buttonState());
+- return TRUE;
+- } else {
+- h.takeMotion();
+- if ( h.buttonState() & (Qt::RightButton|Qt::MidButton) ) {
+- // Strange for the user to press right or middle without
+- // a moving mouse!
+- h.worse();
+- }
+- return FALSE;
+- }
+- }
+-#endif
+-};
+-
+-QAutoMouseHandler::QAutoMouseHandler()
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- notifiers.setAutoDelete( TRUE );
+- retries = 0;
+- openDevices();
+-#endif
+-}
+-
+-QAutoMouseHandler::~QAutoMouseHandler()
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- closeDevices();
+-#endif
+-}
+-
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+-void QAutoMouseHandler::openDevices()
+-{
+- nsub=0;
+- int fd;
+- fd = open( "/dev/psaux", O_RDWR | O_NDELAY );
+- if ( fd >= 0 ) {
+- sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
+- notify(fd);
+- }
+-#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) && !defined(QT_QWS_K2) && !defined(QT_QWS_SLC700)
+- char fn[] = "/dev/ttyS?";
+- for (int ch='0'; ch<='3'; ch++) {
+- fn[9] = ch;
+- fd = open( fn, O_RDWR | O_NDELAY );
+- if ( fd >= 0 ) {
+- //sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
+- sub[nsub++] = new QAutoMouseSubHandler_mousesystems(fd);
+- sub[nsub++] = new QAutoMouseSubHandler_ms(fd);
+- notify(fd);
+- }
+- }
+-#endif
+- // ...
+-}
+-
+-void QAutoMouseHandler::closeDevices()
+-{
+- int pfd=-1;
+- for (int i=0; i<nsub; i++) {
+- sub[i]->closeIfNot(pfd);
+- delete sub[i];
+- }
+- notifiers.clear();
+-}
+-
+-void QAutoMouseHandler::notify(int fd)
+-{
+- QSocketNotifier *mouseNotifier
+- = new QSocketNotifier( fd, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData(int)));
+- notifiers.append( mouseNotifier );
+-}
+-#endif
+-
+-void QAutoMouseHandler::readMouseData(int fd)
+-{
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- for (;;) {
+- uchar buf[8];
+- int n = read(fd, buf, 8);
+- if ( n<=0 )
+- break;
+- for (int i=0; i<nsub; i++) {
+- QAutoMouseSubHandler& h = *sub[i];
+- if ( h.file() == fd ) {
+- h.appendData(buf,n);
+- for (;;) {
+- switch ( h.useData() ) {
+- case QAutoMouseSubHandler::Button:
+- sendEvent(h);
+- break;
+- case QAutoMouseSubHandler::Insufficient:
+- goto breakbreak;
+- case QAutoMouseSubHandler::Motion:
+- break;
+- }
+- }
+- breakbreak:
+- ;
+- }
+- }
+- }
+- bool any_reliable=FALSE;
+- for (int i=0; i<nsub; i++) {
+- QAutoMouseSubHandler& h = *sub[i];
+- if ( h.motionPending() )
+- sendEvent(h);
+- any_reliable = any_reliable || h.reliable();
+- }
+- if ( any_reliable ) {
+- // ... get rid of all unreliable ones? All bad ones?
+- } else if ( retries < 2 ) {
+- // Try again - maybe the mouse was being moved when we tried to init.
+- closeDevices();
+- openDevices();
+- retries++;
+- }
+-#else
+- Q_UNUSED( fd );
+-#endif
+-}
+-
+-
+-
+-
+-/*
+- * Standard mouse driver
+- */
+-
+-typedef struct {
+- int bytesPerPacket;
+-} MouseData;
+-
+-static const MouseData mouseData[] = {
+- { 3 }, // dummy for auto protocal, correction made by add by YYD
+- { 3 }, // MouseMan
+- { 4 }, // intelliMouse
+- { 3 }, // Microsoft
+- { 0 }, // QVFBMouse,
+- { 0 }, // TPanel,
+- { 3 }, // BusMouse,
+-};
+-
+-
+-class QWSMouseHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QWSMouseHandlerPrivate( MouseProtocol protocol, QString mouseDev );
+- ~QWSMouseHandlerPrivate();
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+-private:
+- static const int mouseBufSize = 128;
+- int mouseFD;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+- MouseProtocol mouseProtocol;
+- void handleMouseData();
+-#endif
+-
+-private slots:
+- void readMouseData();
+-
+-private:
+- int obstate;
+-};
+-
+-
+-void QWSMouseHandlerPrivate::readMouseData()
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- int n;
+- if ( BusMouse == mouseProtocol ) {
+- // a workaround of linux busmouse driver interface.
+- // It'll only read 3 bytes a time and return all other buffer zeroed, thus cause protocol errors
+- for (;;) {
+- if ( mouseBufSize - mouseIdx < 3 )
+- break;
+- n = read( mouseFD, mouseBuf+mouseIdx, 3 );
+- if ( n != 3 )
+- break;
+- mouseIdx += 3;
+- }
+- } else {
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 );
+- }
+- handleMouseData();
+-#endif
+-}
+-
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+-/*
+-*/
+-
+-void QWSMouseHandlerPrivate::handleMouseData()
+-{
+- static const int accel_limit = 5;
+- static const int accel = 2;
+-
+- int idx = 0;
+- int bstate = 0;
+- int dx = 0, dy = 0;
+- bool sendEvent = false;
+- int tdx = 0, tdy = 0;
+-
+- while ( mouseIdx-idx >= mouseData[mouseProtocol].bytesPerPacket ) {
+- //qDebug( "Got mouse data" );
+- uchar *mb = mouseBuf+idx;
+- bstate = 0;
+- dx = 0;
+- dy = 0;
+- sendEvent = false;
+- switch (mouseProtocol) {
+- case MouseMan:
+- case IntelliMouse:
+- {
+- if (mb[0] & 0x01)
+- bstate |= Qt::LeftButton;
+- if (mb[0] & 0x02)
+- bstate |= Qt::RightButton;
+- if (mb[0] & 0x04)
+- bstate |= Qt::MidButton;
+-
+- int overflow = (mb[0]>>6 )& 0x03;
+- if (mouseProtocol == MouseMan && overflow) {
+- //### wheel events signalled with overflow bit, ignore for now
+- }
+- else {
+- bool xs = mb[0] & 0x10;
+- bool ys = mb[0] & 0x20;
+- dx = xs ? mb[1]-256 : mb[1];
+- dy = ys ? mb[2]-256 : mb[2];
+
+- sendEvent = true;
+- }
+-#if 0 //debug
+- if (mouseProtocol == MouseMan)
+- printf("(%2d) %02x %02x %02x ", idx, mb[0], mb[1], mb[2]);
+- else
+- printf("(%2d) %02x %02x %02x %02x ",idx,mb[0],mb[1],mb[2],mb[3]);
+- const char *b1 = (mb[0] & 0x01) ? "b1":" ";//left
+- const char *b2 = (mb[0] & 0x02) ? "b2":" ";//right
+- const char *b3 = (mb[0] & 0x04) ? "b3":" ";//mid
+
+- if ( overflow )
+- printf( "Overflow%d %s %s %s (%4d,%4d)\n", overflow,
+- b1, b2, b3, mousePos.x(), mousePos.y() );
+- else
+- printf( "%s %s %s (%+3d,%+3d) (%4d,%4d)\n",
+- b1, b2, b3, dx, dy, mousePos.x(), mousePos.y() );
+-#endif
+- break;
+- }
+- case Microsoft:
+- if ( (mb[0] & 0x20) )
+- bstate |= Qt::LeftButton;
+- if ( (mb[0] & 0x10) )
+- bstate |= Qt::RightButton;
+-
+- dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f));
+- dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f));
+- sendEvent=true;
+-
+- break;
+- case BusMouse:
+- if ( !(mb[0] & 0x04) )
+- bstate |= Qt::LeftButton;
+- if ( !(mb[0] & 0x01) )
+- bstate |= Qt::RightButton;
+-
+- dx=(signed char)mb[1];
+- dy=(signed char)mb[2];
+- sendEvent=true;
+- break;
+-
+- default:
+- qWarning( "Unknown mouse protocol in QWSMouseHandlerPrivate" );
+- break;
+- }
+- if (sendEvent) {
+- if ( QABS(dx) > accel_limit || QABS(dy) > accel_limit ) {
+- dx *= accel;
+- dy *= accel;
+- }
+- tdx += dx;
+- tdy += dy;
+- if ( bstate != obstate ) {
+- mousePos += QPoint(tdx,-tdy);
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos,bstate);
+- sendEvent = FALSE;
+- tdx = 0;
+- tdy = 0;
+- obstate = bstate;
+- }
+- }
+- idx += mouseData[mouseProtocol].bytesPerPacket;
+- }
+- if ( sendEvent ) {
+- mousePos += QPoint(tdx,-tdy);
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos,bstate);
+- }
+-
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-}
+-#endif
+-
+-
+-QWSMouseHandlerPrivate::QWSMouseHandlerPrivate( MouseProtocol protocol,
+- QString mouseDev )
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- mouseProtocol = protocol;
+-
+- if ( mouseDev.isEmpty() )
+- mouseDev = "/dev/mouse";
+- obstate = -1;
+- mouseFD = -1;
+- mouseFD = open( mouseDev.local8Bit().data(), O_RDWR | O_NDELAY);
+- if ( mouseFD < 0 ) {
+- mouseFD = open( mouseDev.local8Bit().data(), O_RDONLY | O_NDELAY);
+- if ( mouseFD < 0 )
+- qDebug( "Cannot open %s (%s)", mouseDev.ascii(),
+- strerror(errno));
+- } else {
+- // Clear pending input
+- tcflush(mouseFD,TCIFLUSH);
+-
+- bool ps2 = false;
+-
+- switch (mouseProtocol) {
+- case MouseMan:
+- ps2 = true;
+- write(mouseFD,"",1);
+- usleep(50000);
+- write(mouseFD,"@EeI!",5);
+- break;
+-
+- case IntelliMouse: {
+-// ps2 = true;
+- const unsigned char init1[] = { 243, 200, 243, 100, 243, 80 };
+- const unsigned char init2[] = { 246, 230, 244, 243, 100, 232, 3 };
+- write(mouseFD,init1,sizeof(init1));
+- usleep(50000);
+- write(mouseFD,init2,sizeof(init2));
+- }
+- break;
+-
+- case Microsoft:
+- struct termios tty;
+-
+- tcgetattr(mouseFD, &tty);
+-
+- tty.c_iflag = IGNBRK | IGNPAR;
+- tty.c_oflag = 0;
+- tty.c_lflag = 0;
+-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+- tty.c_line = 0;
+-#endif // _OS_FREEBSD_
+- tty.c_cc[VTIME] = 0;
+- tty.c_cc[VMIN] = 1;
+- tty.c_cflag = B1200 | CS7 | CREAD | CLOCAL | HUPCL;
+- tcsetattr(mouseFD, TCSAFLUSH, &tty); /* set parameters */
+- break;
+-
+- case BusMouse:
+- usleep(50000);
+- break;
+-
+- default:
+- qDebug("Unknown mouse protocol");
+- exit(1);
+- }
+-
+- if (ps2) {
+- char buf[] = { 246, 244 };
+- write(mouseFD,buf,1);
+- write(mouseFD,buf+1,1);
+- }
+-
+- usleep(50000);
+- tcflush(mouseFD,TCIFLUSH); // ### doesn't seem to work.
+- usleep(50000);
+- tcflush(mouseFD,TCIFLUSH); // ### doesn't seem to work.
+-
+- char buf[100]; // busmouse driver will not read if bufsize < 3, YYD
+- while (read(mouseFD, buf, 100) > 0) { } // eat unwanted replies
+-
+- mouseIdx = 0;
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- }
+-#else
+- Q_UNUSED(protocol);
+- Q_UNUSED(mouseDev);
+-#endif
+-}
+-
+-QWSMouseHandlerPrivate::~QWSMouseHandlerPrivate()
+-{
+-#ifndef QT_NO_QWS_MOUSE_PC
+- if (mouseFD >= 0) {
+- tcflush(mouseFD,TCIFLUSH); // yyd.
+- close(mouseFD);
+- }
+-#endif
+-}
+-
+-/*
+- *
+- */
+
+ QCalibratedMouseHandler::QCalibratedMouseHandler()
+ : samples(5), currSample(0), numSamples(0)
+@@ -1030,7 +180,8 @@
+ if ( file.open( IO_WriteOnly ) ) {
+ QTextStream t( &file );
+ t << a << " " << b << " " << c << " ";
+- t << d << " " << e << " " << f << " " << s;
++ t << d << " " << e << " " << f << " " << s << endl;
++ file.close();
+ } else
+ #endif
+ {
+@@ -1046,6 +197,7 @@
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream t( &file );
+ t >> a >> b >> c >> d >> e >> f >> s;
++ file.close();
+ } else
+ #endif
+ {
+@@ -1073,12 +225,24 @@
+ writeCalibration();
+ }
+
++void QCalibratedMouseHandler::setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss)
++{
++ a = aa;
++ b = bb;
++ c = cc;
++ d = dd;
++ e = ee;
++ f = ff;
++ s = ss;
++}
++
+ QPoint QCalibratedMouseHandler::transform( const QPoint &p )
+ {
+ QPoint tp;
+
+ tp.setX( (a * p.x() + b * p.y() + c) / s );
+ tp.setY( (d * p.x() + e * p.y() + f) / s );
++//qDebug("QCalibratedMouseHandler::transform(%d,%d) -> %d,%d)", p.x(), p.y(), tp.x(), tp.y() );
+
+ return tp;
+ }
+@@ -1143,814 +307,192 @@
+ return sent;
+ }
+
+-/*
+- * Handler for /dev/tpanel Linux kernel driver
+- */
+
+-class QVrTPanelHandlerPrivate : public QCalibratedMouseHandler {
+- Q_OBJECT
+-public:
+- QVrTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QVrTPanelHandlerPrivate();
+
+-private:
+- int mouseFD;
+- MouseProtocol mouseProtocol;
+-private slots:
+- void sendRelease();
+- void readMouseData();
+-private:
+- static const int mouseBufSize = 1280;
+- QTimer *rtimer;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+-};
+
+-#ifndef QT_QWS_CASSIOPEIA
+-QVrTPanelHandlerPrivate::QVrTPanelHandlerPrivate( MouseProtocol, QString ) :
+- QCalibratedMouseHandler()
+-{
+-}
+-#else
+-QVrTPanelHandlerPrivate::QVrTPanelHandlerPrivate( MouseProtocol, QString dev ) :
+- QCalibratedMouseHandler()
+-{
+- if ( dev.isEmpty() )
+- dev = "/dev/tpanel";
+-
+- if ((mouseFD = open( dev, O_RDONLY)) < 0) {
+- qFatal( "Cannot open %s (%s)", dev.latin1(), strerror(errno));
+- } else {
+- sleep(1);
+- }
+-
+- struct scanparam s;
+- s.interval = 20000;
+- s.settletime = 480;
+- if ( ioctl(mouseFD, TPSETSCANPARM, &s) < 0
+- || fcntl(mouseFD, F_SETFL, O_NONBLOCK) < 0 )
+- qWarning("Error initializing touch panel.");
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-
+- rtimer = new QTimer( this );
+- connect( rtimer, SIGNAL(timeout()), this, SLOT(sendRelease()));
+- mouseIdx = 0;
+- setFilterSize( 3 );
+-
+- printf("\033[?25l"); fflush(stdout); // VT100 cursor off
+-}
+-#endif
+-
+-QVrTPanelHandlerPrivate::~QVrTPanelHandlerPrivate()
+-{
+- if (mouseFD >= 0)
+- close(mouseFD);
+-}
+-
+-void QVrTPanelHandlerPrivate::sendRelease()
+-{
+- sendFiltered( mousePos, 0 );
+-}
+
+-void QVrTPanelHandlerPrivate::readMouseData()
+-{
+-#ifdef QT_QWS_CASSIOPEIA
+- if(!qt_screen)
+- return;
+- static bool pressed = FALSE;
+-
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 && mouseIdx < mouseBufSize );
+-
+- int idx = 0;
+- while ( mouseIdx-idx >= (int)sizeof( short ) * 6 ) {
+- uchar *mb = mouseBuf+idx;
+- ushort *data = (ushort *) mb;
+- if ( data[0] & 0x8000 ) {
+- if ( data[5] > 750 ) {
+- QPoint t(data[3]-data[4],data[2]-data[1]);
+- if ( sendFiltered( t, Qt::LeftButton ) )
+- pressed = TRUE;
+- if ( pressed )
+- rtimer->start( 200, TRUE ); // release unreliable
+- }
+- } else if ( pressed ) {
+- rtimer->start( 50, TRUE );
+- pressed = FALSE;
+- }
+- idx += sizeof( ushort ) * 6;
+- }
++struct input_event {
++ struct timeval time;
++ unsigned short type;
++ unsigned short code;
++ unsigned int value;
++};
+
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+
+-#endif
+-}
++#define EV_ABS 0x03
++#define ABS_X 0x00
++#define ABS_Y 0x01
++#define ABS_PRESSURE 0x18
+
+
+-class QTPanelHandlerPrivate : public QCalibratedMouseHandler
++class QInputEventHandler : public QCalibratedMouseHandler
+ {
+ Q_OBJECT
+ public:
+- QTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QTPanelHandlerPrivate();
++ QInputEventHandler(MouseProtocol, QString dev);
++ ~QInputEventHandler();
++
++ virtual void calibrate( QWSPointerCalibrationData * );
++ virtual void setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss);
+
+ private:
+- static const int mouseBufSize = 2048;
++ void init();
++ void fini();
++
+ int mouseFD;
+- QPoint oldmouse;
+- QPoint oldTotalMousePos;
+- bool waspressed;
+- QPointArray samples;
+- unsigned int currSample;
+- unsigned int lastSample;
+- unsigned int numSamples;
+- int skipCount;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
++ struct input_event sample;
++ int myX, myY, myP, oldX, oldY, oldP;
++ int xtable[QT_QWS_TP_TABLE_SIZE];
++ int ytable[QT_QWS_TP_TABLE_SIZE];
++ int ptr;
+
+ private slots:
+ void readMouseData();
+ };
+
+
+-QTPanelHandlerPrivate::QTPanelHandlerPrivate( MouseProtocol, QString dev )
+- : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0),
+- numSamples(0), skipCount(0)
+-{
+- Q_UNUSED(dev);
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+-#if defined(QT_QWS_IPAQ)
+-# ifdef QT_QWS_IPAQ_RAW
+- if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) {
+-# else
+- if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) {
+-# endif
+- qWarning( "Cannot open /dev/h3600_ts (%s)", strerror(errno));
+- return;
+- }
+-#elif defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700)
+-//# ifdef QT_QWS_SL5XXX_TSRAW
+-# if 0
+- if ((mouseFD = open( "/dev/tsraw", O_RDONLY | O_NDELAY)) < 0) {
+- qWarning( "Cannot open /dev/tsraw (%s)", strerror(errno));
+- return;
+- }
+-# else
+- if ((mouseFD = open( "/dev/ts", O_RDONLY | O_NDELAY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
+- return;
+- }
+-# endif
+-#elif defined(QT_QWS_SIMPAD )
+- if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) {
+- qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno));
+- return;
+- }
+-#endif
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- waspressed=FALSE;
+- mouseIdx = 0;
+-#endif
+-}
+-
+-QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
++QInputEventHandler::QInputEventHandler( MouseProtocol, QString )
++ : myP(-1)
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- if (mouseFD >= 0)
+- close(mouseFD);
+-#endif
++ init();
+ }
+
+-void QTPanelHandlerPrivate::readMouseData()
++QInputEventHandler::~QInputEventHandler()
+ {
+-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- if(!qt_screen)
+- return;
+-
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 && mouseIdx < mouseBufSize );
+-
+- TS_EVENT *data;
+- int idx = 0;
+-
+- // perhaps we shouldn't be reading EVERY SAMPLE.
+- while ( mouseIdx-idx >= (int)sizeof( TS_EVENT ) ) {
+- uchar *mb = mouseBuf+idx;
+- data = (TS_EVENT *) mb;
+- if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) {
+-#if defined(QT_QWS_SL5XXX) || defined(QT_QWS_SLC700)
+- samples[currSample] = QPoint( 1000 - data->x, data->y );
+-#else
+- samples[currSample] = QPoint( data->x, data->y );
+-#endif
+-
+- numSamples++;
+- if ( numSamples >= QT_QWS_TP_MINIMUM_SAMPLES ) {
+- int sampleCount = QMIN(numSamples + 1,samples.count());
+-
+- // average the rest
+- mousePos = QPoint( 0, 0 );
+- QPoint totalMousePos = oldTotalMousePos;
+- totalMousePos += samples[currSample];
+- if(numSamples >= samples.count())
+- totalMousePos -= samples[lastSample];
+-
+- mousePos = totalMousePos / (sampleCount - 1);
+-
+-# if defined(QT_QWS_IPAQ_RAW) || defined(QT_QWS_SL5XXX_RAW)
+- mousePos = transform( mousePos );
+-# endif
+- if(!waspressed)
+- oldmouse = mousePos;
+- QPoint dp = mousePos - oldmouse;
+- int dxSqr = dp.x() * dp.x();
+- int dySqr = dp.y() * dp.y();
+- if ( dxSqr + dySqr < (QT_QWS_TP_MOVE_LIMIT * QT_QWS_TP_MOVE_LIMIT) ) {
+- if ( waspressed ) {
+- if ( (dxSqr + dySqr > (QT_QWS_TP_JITTER_LIMIT * QT_QWS_TP_JITTER_LIMIT) ) || skipCount > 2) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- oldmouse = mousePos;
+- skipCount = 0;
+- } else {
+- skipCount++;
+- }
+- } else {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- oldmouse=mousePos;
+- waspressed=true;
+- }
+-
+- // save recuring information
+- currSample++;
+- if (numSamples >= samples.count())
+- lastSample++;
+- oldTotalMousePos = totalMousePos;
+- } else {
+- numSamples--; // don't use this sample, it was bad.
+- }
+- } else {
+- // build up the average
+- oldTotalMousePos += samples[currSample];
+- currSample++;
+- }
+- if ( currSample >= samples.count() )
+- currSample = 0;
+- if ( lastSample >= samples.count() )
+- lastSample = 0;
+- } else {
+- currSample = 0;
+- lastSample = 0;
+- numSamples = 0;
+- skipCount = 0;
+- oldTotalMousePos = QPoint(0,0);
+- if ( waspressed ) {
+- emit mouseChanged(oldmouse,0);
+- oldmouse = QPoint( -100, -100 );
+- waspressed=false;
+- }
+- }
+- idx += sizeof( TS_EVENT );
+- }
++ fini();
+
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-#endif
+ }
+
+-// YOPY touch panel support based on changes contributed by Ron Victorelli
+-// (victorrj at icubed.com) to Custom TP driver.
+-//
+-class QYopyTPanelHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QYopyTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QYopyTPanelHandlerPrivate();
+-
+-private:
+- int mouseFD;
+- int prevstate;
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QYopyTPanelHandlerPrivate::QYopyTPanelHandlerPrivate( MouseProtocol, QString )
++void QInputEventHandler::setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss)
+ {
+-#ifdef QT_QWS_YOPY
+- if ((mouseFD = open( "/dev/ts", O_RDONLY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
+- return;
+- } else {
+- sleep(1);
+- }
+- prevstate=0;
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+-}
++ QCalibratedMouseHandler::setCalibration(aa, bb, cc, dd, ee, ff, ss);
+
+-QYopyTPanelHandlerPrivate::~QYopyTPanelHandlerPrivate()
+-{
+- if (mouseFD >= 0)
+- close(mouseFD);
++ writeCalibration();
++ fini();
++ init();
+ }
+
+-#define YOPY_XPOS(d) (d[1]&0x3FF)
+-#define YOPY_YPOS(d) (d[2]&0x3FF)
+-#define YOPY_PRES(d) (d[0]&0xFF)
+-#define YOPY_STAT(d) (d[3]&0x01 )
+-
+-struct YopyTPdata {
+-
+- unsigned char status;
+- unsigned short xpos;
+- unsigned short ypos;
+-
+-};
+-
+-void QYopyTPanelHandlerPrivate::readMouseData()
++void QInputEventHandler::calibrate( QWSPointerCalibrationData *cd )
+ {
+-#ifdef QT_QWS_YOPY
+- if(!qt_screen)
+- return;
+- YopyTPdata data;
+-
+- unsigned int yopDat[4];
+-
+- int ret;
+-
+- ret=read(mouseFD,&yopDat,sizeof(yopDat));
++ QCalibratedMouseHandler::calibrate( cd );
+
+- if(ret) {
+- data.status= ( YOPY_PRES(yopDat) ) ? 1 : 0;
+- data.xpos=YOPY_XPOS(yopDat);
+- data.ypos=YOPY_YPOS(yopDat);
+- QPoint q;
+- q.setX(data.xpos);
+- q.setY(data.ypos);
+- mousePos=q;
+- if(data.status && !prevstate) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- } else if( !data.status && prevstate ) {
+- emit mouseChanged(mousePos,0);
+- }
+- prevstate = data.status;
+- }
+- if(ret<0) {
+- qDebug("Error %s",strerror(errno));
+- }
+-#endif
++ // write calibration data, and close and reopen
++ // tslib, in order to ensure it uses the new values
++ writeCalibration();
++ fini();
++ init();
+ }
+
+-class QCustomTPanelHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QCustomTPanelHandlerPrivate(MouseProtocol, QString dev);
+- ~QCustomTPanelHandlerPrivate();
+-
+-private:
+- int mouseFD;
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QCustomTPanelHandlerPrivate::QCustomTPanelHandlerPrivate( MouseProtocol, QString )
++void QInputEventHandler::init()
+ {
+-#ifdef QWS_CUSTOMTOUCHPANEL
+- if ((mouseFD = open( "/dev/ts", O_RDONLY)) < 0) {
+- qWarning( "Cannot open /dev/ts (%s)", strerror(errno));
++ if ((mouseFD = open( "/dev/input/event1", O_RDONLY)) < 0) {
++ qWarning( "Cannot open /dev/input/event1 (%s)", strerror(errno));
+ return;
+- } else {
+- sleep(1);
+ }
+
+ QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read,
+- this );
++ mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
++ setFilterSize(2);
+ connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+ }
+
+-QCustomTPanelHandlerPrivate::~QCustomTPanelHandlerPrivate()
++void QInputEventHandler::fini()
+ {
+ if (mouseFD >= 0)
+ close(mouseFD);
+ }
+
+-struct CustomTPdata {
+-
+- unsigned char status;
+- unsigned short xpos;
+- unsigned short ypos;
+-
+-};
+-
+-void QCustomTPanelHandlerPrivate::readMouseData()
++void QInputEventHandler::readMouseData()
+ {
+-#ifdef QWS_CUSTOMTOUCHPANEL
+- if(!qt_screen)
+- return;
+- CustomTPdata data;
+-
+- unsigned char data2[5];
+-
+- int ret;
+-
+- ret=read(mouseFD,data2,5);
++ if (!qt_screen)
++ return;
+
+- if(ret==5) {
+- data.status=data2[0];
+- data.xpos=(data2[1] << 8) | data2[2];
+- data.ypos=(data2[3] << 8) | data2[4];
+- QPoint q;
+- q.setX(data.xpos);
+- q.setY(data.ypos);
+- mousePos=q;
+- if(data.status & 0x40) {
+- emit mouseChanged(mousePos,Qt::LeftButton);
+- } else {
+- emit mouseChanged(mousePos,0);
++ unsigned int size = read(mouseFD, &sample, sizeof(sample));
++ if (size < sizeof(sample)) {
++ qDebug("no input");
++ return;
++ }
++ //qDebug("type,code,val: %d,%d,%d", sample.type, sample.code, sample.value);
++ if (sample.type == EV_ABS) {
++ if (sample.code == ABS_Y) {
++ myY = sample.value;
++ return;
++ } else
++ if (sample.code == ABS_X) {
++ myX = sample.value;
++ return;
++ } else
++ if (sample.code == ABS_PRESSURE) {
++ myP = sample.value;
++ }
+ }
+- }
+- if(ret<0) {
+- qDebug("Error %s",strerror(errno));
+- }
+-#endif
+-}
+-
+-/*
+- * Virtual framebuffer mouse driver
+- */
+-
+-#ifndef QT_NO_QWS_VFB
+-#include "qvfbhdr.h"
+-extern int qws_display_id;
+-#endif
+-
+-class QVFbMouseHandlerPrivate : public QWSMouseHandler {
+- Q_OBJECT
+-public:
+- QVFbMouseHandlerPrivate(MouseProtocol, QString dev);
+- ~QVFbMouseHandlerPrivate();
+-
+-#ifndef QT_NO_QWS_VFB
+- bool isOpen() const { return mouseFD > 0; }
+-
+-private:
+- static const int mouseBufSize = 128;
+- int mouseFD;
+- int mouseIdx;
+- uchar mouseBuf[mouseBufSize];
+-#endif
+-
+-private slots:
+- void readMouseData();
+-};
+-
+-QVFbMouseHandlerPrivate::QVFbMouseHandlerPrivate( MouseProtocol, QString mouseDev )
+-{
+-#ifndef QT_NO_QWS_VFB
+- mouseFD = -1;
+- if ( mouseDev.isEmpty() )
+- mouseDev = QString(QT_VFB_MOUSE_PIPE).arg(qws_display_id);
+-
+- if ((mouseFD = open( mouseDev.local8Bit().data(), O_RDWR | O_NDELAY)) < 0) {
+- qDebug( "Cannot open %s (%s)", mouseDev.ascii(),
+- strerror(errno));
+- } else {
+- // Clear pending input
+- char buf[2];
+- while (read(mouseFD, buf, 1) > 0) { }
+-
+- mouseIdx = 0;
+-
+- QSocketNotifier *mouseNotifier;
+- mouseNotifier = new QSocketNotifier( mouseFD, QSocketNotifier::Read, this );
+- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+- }
+-#endif
+-}
+-
+-QVFbMouseHandlerPrivate::~QVFbMouseHandlerPrivate()
+-{
+-#ifndef QT_NO_QWS_VFB
+- if (mouseFD >= 0)
+- close(mouseFD);
+-#endif
+-}
+-
+-void QVFbMouseHandlerPrivate::readMouseData()
+-{
+-#ifndef QT_NO_QWS_VFB
+- int n;
+- do {
+- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx );
+- if ( n > 0 )
+- mouseIdx += n;
+- } while ( n > 0 );
+-
+- int idx = 0;
+- while ( mouseIdx-idx >= int(sizeof( QPoint ) + sizeof( int )) ) {
+- uchar *mb = mouseBuf+idx;
+- QPoint *p = (QPoint *) mb;
+- mb += sizeof( QPoint );
+- int *bstate = (int *)mb;
+- mousePos = *p;
+- limitToScreen( mousePos );
+- emit mouseChanged(mousePos, *bstate);
+- idx += sizeof( QPoint ) + sizeof( int );
+- }
+-
+- int surplus = mouseIdx - idx;
+- for ( int i = 0; i < surplus; i++ )
+- mouseBuf[i] = mouseBuf[idx+i];
+- mouseIdx = surplus;
+-#endif
+-}
+-
+-/*
+- mouse handler for tslib
+- see http://cvs.arm.linux.org.uk/
+- */
+-/*
+-
+- Copyright (C) 2003, 2004, 2005 Texas Instruments, Inc.
+- Copyright (C) 2004, 2005 Holger Hans Peter Freyther
+- All rights reserved.
+-
+- Redistribution and use in source and binary forms, with or without
+- modification, are permitted provided that the following conditions are met:
+-
+- Redistributions of source code must retain the above copyright notice,
+- this list of conditions and the following disclaimer.
+-
+- Redistributions in binary form must reproduce the above copyright
+- notice, this list of conditions and the following disclaimer in the
+- documentation and/or other materials provided with the distribution.
+-
+- Neither the name Texas Instruments, Inc nor the names of its
+- contributors may be used to endorse or promote products derived
+- from this software without specific prior written permission.
+-
+- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+- POSSIBILITY OF SUCH DAMAGE.
+-
+-*/
+-class QTSLibHandlerPrivate : public QCalibratedMouseHandler
+-{
+- Q_OBJECT
+-public:
+- QTSLibHandlerPrivate();
+- ~QTSLibHandlerPrivate();
+-
+- virtual void clearCalibration();
+- virtual void calibrate( QWSPointerCalibrationData * );
+- static int sortByX( const void*, const void* );
+- static int sortByY( const void*, const void* );
+-
+-private:
+- bool m_raw : 1;
+- QSocketNotifier *m_notify;
+-
+-#ifdef QT_QWS_TSLIB
+- struct tsdev *m_ts;
+-#endif
+- void openTs();
+- void closeTs();
+- void interpolateSample();
+-
+-private slots:
+- void readMouseData();
+-
+-};
+-
+-QTSLibHandlerPrivate::QTSLibHandlerPrivate()
+- : m_raw(false), m_notify(0 )
+-{
+- openTs();
+-}
+-
+-QTSLibHandlerPrivate::~QTSLibHandlerPrivate()
+-{
+- closeTs();
+-}
+-
+-void QTSLibHandlerPrivate::openTs()
+-{
+-#ifdef QT_QWS_TSLIB
+- char *tsdevice;
+- if((tsdevice = getenv("TSLIB_TSDEVICE")) != NULL) {
+- m_ts = ts_open( tsdevice, 1 ); //1 = nonblocking, 0 = blocking mode
+- } else {
+- m_ts = ts_open( "/dev/ts", 1 );
+- }
+-
+- if (!m_ts) {
+- qWarning( "Cannot open touchscreen (%s)", strerror( errno));
+- return;
+- }
+-
+- if (ts_config( m_ts)) {
+- qWarning( "Cannot configure touchscreen (%s)", strerror( errno));
+- return;
+- }
+- m_notify = new QSocketNotifier( ts_fd(m_ts), QSocketNotifier::Read, this );
+- connect( m_notify, SIGNAL(activated(int)),this, SLOT(readMouseData()));
+-#endif
+-}
+-
+-void QTSLibHandlerPrivate::closeTs()
+-{
+-#ifdef QT_QWS_TSLIB
+- if (m_ts)
+- ts_close(m_ts);
+- m_ts = 0;
+-#endif
+-
+- delete m_notify;
+- m_notify = 0;
+- m_raw = false;
+-}
+-
+-void QTSLibHandlerPrivate::clearCalibration()
+-{
+- m_raw = true;
+-}
+-
+-void QTSLibHandlerPrivate::calibrate( QWSPointerCalibrationData * cd)
+-{
+- QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
+- QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
+- QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
+- QPoint screen_br = cd->screenPoints[ QWSPointerCalibrationData::BottomRight ];
+- int a, b, c, d, e, f, s;
+-
+- s = 1 << 16;
+
+- a = s * (screen_tl.x() - screen_br.x() ) / (dev_tl.x() - dev_br.x());
+- b = 0;
+- c = s * screen_tl.x() - a * dev_tl.x();
++ // up->up
++ if (oldP==0 && myP==0) {
++ //qDebug("uu %d,%d,%d", myX,myY,myP);
++ return;
++ }
+
+- d = 0;
+- e = s * (screen_tl.y() - screen_br.y() ) / (dev_tl.y() - dev_br.y());
+- f = s * screen_tl.y() - e * dev_tl.y();
++ // up->down
++ if (oldP==0 && myP>QT_QWS_TP_PRESSURE_DOWN_THRESHOLD) {
++ //qDebug("ud %d,%d,%d", myX,myY,myP);
+
+- QString calFile = "/etc/pointercal";
+-#ifndef QT_NO_TEXTSTREAM
+- QFile file( calFile );
+- if ( file.open( IO_WriteOnly ) ) {
+- QTextStream t( &file );
+- t << a << " " << b << " " << c << " ";
+- t << d << " " << e << " " << f << " " << s;
+- file.flush(); closeTs();
+- openTs();
+- } else
+-#endif
+- {
+- qDebug( "Could not save calibration: %s", calFile.latin1() );
+- }
+-}
++ xtable[0] = myX;
++ ytable[0] = myY;
++ ptr = 1;
++ oldX = myX;
++ oldY = myY;
++ oldP = myP;
++ return;
++ }
+
+-void QTSLibHandlerPrivate::readMouseData()
+-{
+-#ifdef QT_QWS_TSLIB
+- if(!qt_screen)
+- return;
++ // down->down
++ if (oldP>QT_QWS_TP_PRESSURE_DOWN_THRESHOLD && myP>QT_QWS_TP_PRESSURE_UP_THRESHOLD) {
++ //qDebug("dd %d,%d,%d (%d,%d)", myX,myY,myP, oldX,oldY);
+
+- /*
+- * After clear Calibration
+- * we're in raw mode and do some easy median
+- * search.
+- */
+- if ( m_raw )
+- return interpolateSample();
++ int dxSqr = myX-oldX; dxSqr *= dxSqr;
++ int dySqr = myY-oldY; dySqr *= dySqr;
++ oldX = myX;
++ oldY = myY;
++ if (dxSqr+dySqr > QT_QWS_TP_MOVE_MAX*QT_QWS_TP_MOVE_MAX) {
++ //qWarning("distance too wide %d", dxSqr+dySqr);
++ return;
++ }
+
+- static struct ts_sample sample;
+- static int ret;
++ if (ptr < QT_QWS_TP_TABLE_SIZE) {
++ xtable[ptr] = myX;
++ ytable[ptr++] = myY;
++ }
+
+- /*
+- * Ok. We need to see if we can read more than one event
+- * We do this not to lose an update.
+- */
+- while ( true ) {
+- if ((ret = ts_read(m_ts, &sample, 1)) != 1 )
+- return;
++ if (ptr == QT_QWS_TP_TABLE_SIZE) {
++ int i;
++ int mx = 0;
++ int my = 0;
++ for (i=0; i<QT_QWS_TP_TABLE_SIZE; i++) {
++ mx += xtable[i];
++ my += ytable[i];
++ if (i>0) {
++ xtable[i-1] = xtable[i];
++ ytable[i-1] = ytable[i];
++ }
++ }
++ ptr--;
++ mousePos = transform(QPoint(mx/QT_QWS_TP_TABLE_SIZE, my/QT_QWS_TP_TABLE_SIZE));
+
++ emit mouseChanged(mousePos, Qt::LeftButton);
++ }
++ return;
++ }
+
+- QPoint pos( sample.x, sample.y );
+- mouseChanged( pos, sample.pressure != 0 ? 1 : 0 );
+- }
+-#endif
++ // down->up
++ //qDebug("du %d,%d,%d", myX,myY,myP);
++ emit mouseChanged(mousePos, 0);
++ oldP = 0;
+ }
+
+-/*
+- * Lets take all down events and then sort them
+- * and take the event in the middle.
+- *
+- * inspired by testutils.c
+- */
+-void QTSLibHandlerPrivate::interpolateSample() {
+-#ifdef QT_QWS_TSLIB
+-#define TSLIB_MAX_SAMPLES 25
+- static struct ts_sample samples[TSLIB_MAX_SAMPLES];
+- int index = 0;
+- int read_samples = 0;
+- int ret;
+-
+- do {
+- /* do not access negative arrays */
+- if ( index < 0 )
+- index = 0;
+-
+- /* we're opened non-blocking */
+- if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 )
+- /* no event yet, so try again */
+- if (ret==-1 )
+- continue;
+-
+- read_samples++;
+- index = (index+1)%TSLIB_MAX_SAMPLES;
+- }while (samples[index == 0 ? (TSLIB_MAX_SAMPLES-1) : index-1].pressure != 0);
+-
+- /*
+- * If we've wrapped around each sample is used otherwise
+- * we will use the index
+- */
+- index = read_samples >= TSLIB_MAX_SAMPLES ?
+- (TSLIB_MAX_SAMPLES-1 ) : index;
+- int x, y;
+-
+- /*
+- * now let us use the median value
+- * even index does not have an item in the middle
+- * so let us take the average of n/2 and (n/2)-1 as the middle
+- */
+- int m = index/2;
+- ::qsort(samples, index, sizeof(ts_sample), QTSLibHandlerPrivate::sortByX);
+- x = (index % 2 ) ? samples[m].x :
+- ( samples[m-1].x + samples[m].x )/2;
+-
+- ::qsort(samples, index, sizeof(ts_sample), QTSLibHandlerPrivate::sortByY);
+- y = (index % 2 ) ? samples[m].y :
+- ( samples[m-1].y + samples[m].y )/2;
+
+- emit mouseChanged( QPoint(x, y), 1 );
+- emit mouseChanged( QPoint(0, 0), 0 );
+-#endif
+-}
+
+-int QTSLibHandlerPrivate::sortByX( const void* one, const void* two) {
+-#ifdef QT_QWS_TSLIB
+- return reinterpret_cast<const struct ts_sample*>(one)->x -
+- reinterpret_cast<const struct ts_sample*>(two)->x;
+-#else
+- return 0;
+-#endif
+-}
+
+-int QTSLibHandlerPrivate::sortByY( const void* one, const void* two) {
+-#ifdef QT_QWS_TSLIB
+- return reinterpret_cast<const struct ts_sample*>(one)->y -
+- reinterpret_cast<const struct ts_sample*>(two)->y;
+-#else
+- return 0;
+-#endif
+-}
+-//////
+
+ /*
+ * return a QWSMouseHandler that supports /a spec.
+@@ -1977,7 +519,7 @@
+
+ if ( mouseProto == "USB" && mouseDev.isEmpty() )
+ mouseDev = "/dev/input/mice";
+-
++
+ MouseProtocol mouseProtocol = Unknown;
+
+ int idx = 0;
+@@ -1988,50 +530,7 @@
+ idx++;
+ }
+
+-
+- QWSMouseHandler *handler = 0;
+-
+- switch ( mouseProtocol ) {
+-#ifndef QT_NO_QWS_MOUSE_AUTO
+- case Auto:
+- handler = new QAutoMouseHandler();
+- break;
+-#endif
+-
+-#ifndef QT_NO_QWS_MOUSE_PC
+- case MouseMan:
+- case IntelliMouse:
+- case Microsoft:
+- case BusMouse:
+- handler = new QWSMouseHandlerPrivate( mouseProtocol, mouseDev );
+- break;
+-#endif
+-
+-#ifndef QT_NO_QWS_VFB
+- case QVFBMouse:
+- handler = new QVFbMouseHandlerPrivate( mouseProtocol, mouseDev );
+- break;
+-#endif
+-
+- case TPanel:
+-#if defined(QWS_CUSTOMTOUCHPANEL)
+- handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_TSLIB)
+- handler = new QTSLibHandlerPrivate();
+-#elif defined(QT_QWS_YOPY)
+- handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD)
+- handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
+-#elif defined(QT_QWS_CASSIOPEIA)
+- handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
+-#endif
+- break;
+-
+- default:
+- qDebug( "Mouse type %s unsupported", spec.latin1() );
+- }
+-
+- return handler;
++ return new QInputEventHandler( mouseProtocol, mouseDev );
+ }
+
+ #include "qwsmouse_qws.moc"
+--- qt-2.3.10/src/kernel/qwsmouse_qws.h~ramses-touchscreen
++++ qt-2.3.10/src/kernel/qwsmouse_qws.h
+@@ -1,5 +1,5 @@
+ /****************************************************************************
+-** $Id: qt/src/kernel/qwsmouse_qws.h 2.3.10 edited 2005-01-24 $
++** $Id: qt/src/kernel/qwsmouse_qws.h 2.3.7 edited 2001-10-03 $
+ **
+ ** Definition of Qt/FB central server classes
+ **
+@@ -70,6 +70,7 @@
+ virtual void clearCalibration();
+ virtual void calibrate( QWSPointerCalibrationData * );
+ virtual void getCalibration( QWSPointerCalibrationData * );
++ virtual void setCalibration(int aa, int bb, int cc, int dd, int ee, int ff, int ss);
+
+ protected:
+ void readCalibration();
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci.patch
new file mode 100644
index 0000000000..c2e0e079d9
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/mnci.patch
@@ -0,0 +1,125 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -249,20 +249,12 @@
+
+ static void writeTerm(const char* termctl, int sizeof_termctl)
+ {
+-#ifdef QT_QWS_DEVFS
+- const char* tt[]={"/dev/vc/1","/dev/console","/dev/tty",0};
+-#else
+- const char* tt[]={"/dev/console","/dev/tty","/dev/tty0",0};
+-#endif
+- const char** dev=tt;
+- while (*dev) {
+- int tty=::open(*dev,O_WRONLY);
++qWarning("writeTerm");
++ int tty=::open("/dev/vc/2", O_WRONLY);
+ if ( tty>=0 ) {
+ ::write(tty,termctl,sizeof_termctl);
+ ::close(tty);
+ }
+- dev++;
+- }
+ }
+
+ /*!
+@@ -275,6 +267,7 @@
+
+ bool QLinuxFbScreen::initDevice()
+ {
++qWarning("QLinuxFbScreen::initDevice");
+ /* Setting up the VT parameters is done in qapplication_qws.cpp
+ const char termctl[]="\033[9;0]\033[?33l\033[?25l";
+ writeTerm(termctl,sizeof(termctl)); */
+@@ -765,9 +758,12 @@
+ }
+ */
+
++qWarning("QLinuxFbScreen::shutdownDevice");
++/*
+ // Blankin' screen, blinkin' cursor!
+ const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
+ writeTerm(termctl,sizeof(termctl));
++*/
+ }
+
+ /*!
+--- qt-2.3.10/src/kernel/qapplication_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qapplication_qws.cpp
+@@ -1756,8 +1756,6 @@
+ */
+ if ( qws_daemon )
+ {
+- qWarning( "qt_init() - starting in daemon mode..." );
+-
+ int pid1 = fork();
+ if ( pid1 == -1 )
+ {
+@@ -1791,7 +1789,6 @@
+ }
+ if ( pid2 )
+ {
+- syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
+ _exit( 0 ); // ok, second fork performed
+ }
+ }
+@@ -1828,9 +1825,12 @@
+ #if defined(_OS_LINUX_)
+ if ( qws_terminal_id )
+ {
+- qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
+ struct vt_stat console_stat;
++#ifdef QT_QWS_DEVFS
++ int console_fd = ::open( QString().sprintf( "/dev/vc/%d", qws_terminal_id ).latin1(), O_RDWR );
++#else
+ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
++#endif
+ if ( console_fd == -1)
+ {
+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
+@@ -1927,7 +1927,11 @@
+ {
+ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
+
++#ifdef QT_QWS_DEVFS
++ int console_fd = ::open( "/dev/vc/0", O_RDWR );
++#else
+ int console_fd = ::open( "/dev/tty0", O_RDWR );
++#endif
+ if ( console_fd == -1)
+ {
+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
+--- qt-2.3.10/src/kernel/qwindowsystem_qws.cpp~ramses.patch
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.cpp
+@@ -1791,6 +1791,7 @@
+ }
+
+ #ifndef QT_NO_QWS_KEYBOARD
++#ifndef QT_QWS_RAMSES
+ static int keyUnicode(int keycode)
+ {
+ const QWSServer::KeyMap *km = QWSServer::keyMap();
+@@ -1803,6 +1804,7 @@
+ return 0xffff;
+ }
+ #endif
++#endif
+ /*!
+ Send a key event. You can use this to send key events generated by
+ "virtual keyboards".
+@@ -1845,8 +1847,10 @@
+
+ event.simpleData.unicode =
+ #ifndef QT_NO_QWS_KEYBOARD
++#ifndef QT_QWS_RAMSES
+ unicode < 0 ? keyUnicode(keycode) :
+ #endif
++#endif
+ unicode;
+ event.simpleData.keycode = keycode;
+ event.simpleData.modifiers = modifiers;
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad-defaultkbd.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad-defaultkbd.patch
new file mode 100644
index 0000000000..3e5450a4da
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad-defaultkbd.patch
@@ -0,0 +1,11 @@
+--- qt-2.3.10/src/kernel/qwindowsystem_qws.cpp.orig 2005-11-30 10:53:32.000000000 +0100
++++ qt-2.3.10/src/kernel/qwindowsystem_qws.cpp 2005-11-30 10:55:51.000000000 +0100
+@@ -2917,7 +2917,7 @@
+ {
+ QString keyboards = getenv("QWS_KEYBOARD");
+ if ( keyboards.isEmpty() ) {
+-#if defined( QT_QWS_CASSIOPEIA )
++#if defined( QT_QWS_CASSIOPEIA ) || defined( QT_QWS_SIMPAD )
+ keyboards = "Buttons";
+ #elif !defined(QT_NO_QWS_VFB)
+ extern bool qvfbEnabled;
diff --git a/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad.patch b/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad.patch
new file mode 100644
index 0000000000..8a728ef74a
--- /dev/null
+++ b/recipes/obsolete/qte/qte-2.3.10/deprecated/simpad.patch
@@ -0,0 +1,340 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.10/src/kernel/qkeyboard_qws.cpp~simpad.patch
++++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp
+@@ -37,6 +37,7 @@
+ #include <qapplication.h>
+ #include <qsocketnotifier.h>
+ #include <qnamespace.h>
++#include <qdatetime.h>
+ #include <qtimer.h>
+
+ #include <stdlib.h>
+@@ -80,6 +81,60 @@
+ #include <sys/vt.h>
+ #endif
+
++/*
++ * SIMpad switches handler
++ * (C) 2003-2005 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ */
++
++
++
++#include <linux/switches.h>
++#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches"
++
++// switches from left top to right down over the SIMpad surface
++
++#define SIMPAD_SWITCH_POWER 0x02
++#define SIMPAD_SWITCH_UPPER 0x10
++#define SIMPAD_SWITCH_UP 0x20
++#define SIMPAD_SWITCH_DOWN 0x40
++#define SIMPAD_SWITCH_LEFT 0x80
++#define SIMPAD_SWITCH_RIGHT 0x100
++#define SIMPAD_SWITCH_LOWER 0x8
++
++class QWSsimpadButtonsHandler : public QWSKeyboardHandler
++{
++ Q_OBJECT
++
++ public:
++ QWSsimpadButtonsHandler();
++ virtual ~QWSsimpadButtonsHandler();
++
++ bool isOpen() { return fd > 0; }
++
++ private slots:
++ void readSwitchesData();
++ void autoRepeat();
++
++ private:
++ switches_mask_t switches;
++
++ int fd;
++ int repeatdelay;
++ int repeatperiod;
++
++ int lastCode; // last native code
++ int lastPress; // last press/release state
++
++ int k; // last emitted Qt key code
++ int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released
++ bool shiftUsed; // true if SHIFT has been used
++
++ QTime eventTimer; // tracks time between raw events
++ QTimer* repeater;
++ QSocketNotifier *notifier;
++};
++
++
+ #ifdef QT_QWS_SL5XXX
+ #include <asm/sharp_char.h>
+ #endif
+@@ -1775,9 +1830,11 @@
+ } else {
+ type = spec;
+ }
+-
+ if ( type == "Buttons" ) {
+-#if defined(QT_QWS_YOPY)
++#if defined(QT_QWS_SIMPAD)
++ qDebug( "QWSKeyboardHandler: using SIMpad switches handler..." );
++ handler = new QWSsimpadButtonsHandler();
++#elif defined(QT_QWS_YOPY)
+ handler = new QWSyopyButtonsHandler();
+ #elif defined(QT_QWS_CASSIOPEIA)
+ handler = new QWSVr41xxButtonsHandler();
+@@ -1812,6 +1869,218 @@
+ return keyM;
+ }
+
+-#endif // QT_NO_QWS_KEYBOARD
+
++/*
++ * SIMpad switches handler
++ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ */
++
++
++QWSsimpadButtonsHandler::QWSsimpadButtonsHandler()
++ :QWSKeyboardHandler(), fd( -1 ),
++ repeatdelay( 700 ), repeatperiod( 80 ),
++ lastCode( 0 ), lastPress( 0 ),
++ k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false )
++{
++ qDebug( "SimpadButtonsHandler() - V4.1" );
++ fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 );
++ if ( fd < 0 )
++ {
++ qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE );
++ return;
++ }
++
++ notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this );
++ connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) );
++
++ repeater = new QTimer(this);
++ connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
++
++}
+
++
++QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler()
++{
++ qDebug( "~SimpadButtonsHandler()" );
++ if ( fd > 0 )
++ {
++ ::close( fd );
++ fd = -1;
++ }
++}
++
++
++void QWSsimpadButtonsHandler::readSwitchesData()
++{
++ qDebug( "SimpadButtonsHandler() - detected switches action" );
++
++ if ( ::read( fd, &switches, sizeof switches ) < 0 )
++ {
++ qWarning( "SimpadButtonsHandler() - switches read error!" );
++ return;
++ }
++
++ qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x",
++ shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] );
++
++ bool press = switches.states[0]; // == switches.event[0];
++ int code = switches.events[0];
++
++ //=========================================================================
++
++ /**
++ * Work around a bug in the kernel keyboard driver emitting
++ * bogus events when pressing multiple switches at once
++ **/
++
++ if ( lastCode == 0 )
++ {
++ // first press ever
++ eventTimer.start();
++ lastPress = press;
++ lastCode = code;
++ }
++ else
++ {
++ int interval = eventTimer.restart();
++ qDebug( "event interval = %d", interval );
++ if ( code == lastCode && interval < 10 )
++ {
++ qDebug( "event interval too small - ignoring bogus event" );
++ qDebug( "did I say i hate buggy kernel drivers? :-D" );
++ return;
++ }
++
++ lastPress = press;
++ lastCode = code;
++ }
++
++ /**
++ * Actually it may also be a hardware problem, but I really don't like
++ * to review kernel code for further inquiry. So just being lazy and
++ * do the workaround in user space :-D
++ **/
++
++ //=====================================================================
++
++ if ( shiftKeyPressed )
++ {
++ // a shift key obviously is being held
++ qDebug( "while shift key is being held..." );
++
++ if ( code != shiftKeyPressed )
++ {
++ // another key is being touched - that means shift mode for us!
++ qDebug( " another key is being touched -> shift use now = true" );
++
++ shiftUsed = true;
++
++ if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1
++ {
++ qDebug( " shift mode 1" );
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu
++ case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break;
++ }
++ }
++ else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2
++ {
++ qDebug( " shift mode 2" );
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8
++ case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break;
++ }
++ }
++ }
++ else
++ {
++ qDebug( " shift key has been released. checking if being used..." );
++ shiftKeyPressed = 0;
++
++ if ( !shiftUsed )
++ {
++ qDebug( " ... has _not_ being used -> really emit the key" );
++ k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return );
++ qDebug( "Emitting key = %d (pressed)", k );
++ processKeyEvent( 0, k, 0, true, true );
++ qDebug( "Emitting key = %d (released)", k );
++ processKeyEvent( 0, k, 0, false, true );
++ return;
++ }
++ else
++ {
++ qDebug( " ... has being used -> doing nothing" );
++ return;
++ }
++ }
++ }
++ else
++ {
++ qDebug( "standard mode - no shift yet..." );
++
++ switch(code)
++ {
++ case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break;
++ case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break;
++ case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break;
++ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break;
++ case SIMPAD_SWITCH_POWER: k = Qt::Key_F34; break; // Power Button
++
++ case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
++ case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return;
++
++ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break;
++ }
++ }
++
++ if ( k == -1 )
++ {
++ qDebug( "no key to emit - returning." );
++ return;
++ }
++
++ bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down ||
++ k == Qt::Key_Right || k == Qt::Key_Left );
++
++ qDebug( "key to emit = %d [%s] [repeat=%s]", k,
++ press ? "press" : "release",
++ repeatable ? "true":"false" );
++
++ if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down )
++ {
++ qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." );
++ int oldK = k;
++ k = xform_dirkey( k );
++ qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k );
++ }
++
++ if ( repeatable && press )
++ repeater->start( repeatdelay, true );
++ else
++ repeater->stop();
++
++ qwsServer->processKeyEvent( 0, k, 0, press, false );
++}
++
++
++void QWSsimpadButtonsHandler::autoRepeat()
++{
++ qDebug( "Emitting key = %d (released)", k );
++ processKeyEvent( 0, k, 0, false, true );
++ qDebug( "Emitting key = %d (pressed)", k );
++ processKeyEvent( 0, k, 0, true, true );
++ repeater->start(repeatperiod);
++}
++
++
++#endif // QT_NO_QWS_KEYBOARD
+--- qt-2.3.10/src/kernel/qwsmouse_qws.cpp~simpad.patch
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+@@ -47,6 +47,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <sys/ioctl.h>
++#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+@@ -73,6 +74,7 @@
+ unsigned short x;
+ unsigned short y;
+ unsigned short pad;
++ struct timeval stamp;
+ } TS_EVENT;
+ #elif defined(QT_QWS_SL5XXX)
+ #define QT_QWS_SL5XXX_RAW
+@@ -1310,6 +1312,11 @@
+ return;
+ }
+ # endif
++#elif defined(QT_QWS_SIMPAD )
++ if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) {
++ qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno));
++ return;
++ }
+ #endif
+
+ QSocketNotifier *mouseNotifier;