summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--qt/qte234-for-opie091-simpad.patch69
1 files changed, 58 insertions, 11 deletions
diff --git a/qt/qte234-for-opie091-simpad.patch b/qt/qte234-for-opie091-simpad.patch
index fd535d4..93f4be3 100644
--- a/qt/qte234-for-opie091-simpad.patch
+++ b/qt/qte234-for-opie091-simpad.patch
@@ -1,162 +1,209 @@
1--- src/kernel/qwsmouse_qws.cpp.orig 2003-01-31 04:34:52.000000000 +0100 1--- src/kernel/qwsmouse_qws.cpp.orig 2003-01-31 04:34:52.000000000 +0100
2+++ src/kernel/qwsmouse_qws.cpp 2003-03-10 12:26:40.000000000 +0100 2+++ src/kernel/qwsmouse_qws.cpp 2003-03-10 12:26:40.000000000 +0100
3@@ -61,12 +61,14 @@ 3@@ -61,12 +61,14 @@
4 #endif 4 #endif
5 5
6 #if defined(QT_QWS_IPAQ) 6 #if defined(QT_QWS_IPAQ)
7+#include <sys/time.h> 7+#include <sys/time.h>
8 #define QT_QWS_IPAQ_RAW 8 #define QT_QWS_IPAQ_RAW
9 typedef struct { 9 typedef struct {
10 unsigned short pressure; 10 unsigned short pressure;
11 unsigned short x; 11 unsigned short x;
12 unsigned short y; 12 unsigned short y;
13 unsigned short pad; 13 unsigned short pad;
14+ struct timeval stamp; 14+ struct timeval stamp;
15 } TS_EVENT; 15 } TS_EVENT;
16 #elif defined(QT_QWS_SL5XXX) 16 #elif defined(QT_QWS_SL5XXX)
17 #define QT_QWS_SL5XXX_RAW 17 #define QT_QWS_SL5XXX_RAW
18@@ -1241,7 +1243,7 @@ 18@@ -1241,7 +1243,7 @@
19 #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 19 #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
20 #if defined(QT_QWS_IPAQ) 20 #if defined(QT_QWS_IPAQ)
21 # ifdef QT_QWS_IPAQ_RAW 21 # ifdef QT_QWS_IPAQ_RAW
22- if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) { 22- if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) {
23+ if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK /*O_NDELAY*/)) < 0) { 23+ if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK /*O_NDELAY*/)) < 0) {
24 # else 24 # else
25 if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) { 25 if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) {
26 # endif 26 # endif
27 --- src/kernel/qkeyboard_qws.cpp.origSat May 24 16:49:38 2003 27 --- src/kernel/qkeyboard_qws.cpp.origSat May 24 16:49:38 2003
28 +++ src/kernel/qkeyboard_qws.cppSat May 24 17:58:22 2003 28 +++ src/kernel/qkeyboard_qws.cppMon May 26 19:52:05 2003
29@@ -131,6 +131,46 @@ 29@@ -131,6 +131,53 @@
30 30
31 #endif // QNX6 31 #endif // QNX6
32 32
33+/* 33+/*
34+ * SIMpad switches handler 34+ * SIMpad switches handler
35+ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 35+ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
36+ */ 36+ */
37+ 37+
38+//TODO: guard this against inclusion with #ifdef QT_QWS_SIMPAD 38+//TODO: guard this against inclusion with #ifdef QT_QWS_SIMPAD
39+ 39+
40+#include <linux/switches.h> 40+#include <linux/switches.h>
41+#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches" 41+#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches"
42+ 42+
43+// switches from top to down over the SIMpad surface 43+// switches from top to down over the SIMpad surface
44+ 44+
45+#define SIMPAD_SWITCH_UPPER 0x10 45+#define SIMPAD_SWITCH_UPPER 0x10
46+ 46+
47+#define SIMPAD_SWITCH_UP 0x20 47+#define SIMPAD_SWITCH_UP 0x20
48+#define SIMPAD_SWITCH_DOWN 0x40 48+#define SIMPAD_SWITCH_DOWN 0x40
49+#define SIMPAD_SWITCH_LEFT 0x80 49+#define SIMPAD_SWITCH_LEFT 0x80
50+#define SIMPAD_SWITCH_RIGHT 0x100 50+#define SIMPAD_SWITCH_RIGHT 0x100
51+ 51+
52+#define SIMPAD_SWITCH_LOWER 0x8 52+#define SIMPAD_SWITCH_LOWER 0x8
53+ 53+
54+class QWSsimpadButtonsHandler : public QWSKeyboardHandler 54+class QWSsimpadButtonsHandler : public QWSKeyboardHandler
55+{ 55+{
56+ Q_OBJECT 56+ Q_OBJECT
57+ 57+
58+ public: 58+ public:
59+ QWSsimpadButtonsHandler(); 59+ QWSsimpadButtonsHandler();
60+ virtual ~QWSsimpadButtonsHandler(); 60+ virtual ~QWSsimpadButtonsHandler();
61+ 61+
62+ bool isOpen() { return fd > 0; } 62+ bool isOpen() { return fd > 0; }
63+ 63+
64+ private slots: 64+ private slots:
65+ void readSwitchesData(); 65+ void readSwitchesData();
66+ void autoRepeat();
66+ 67+
67+ private: 68+ private:
68+ switches_mask_t switches; 69+ switches_mask_t switches;
70+
69+ int fd; 71+ int fd;
72+ int repeatdelay;
73+ int repeatperiod;
74+ int k;
75+
76+ QTimer* repeater;
70+ QSocketNotifier *notifier; 77+ QSocketNotifier *notifier;
71+}; 78+};
72+ 79+
73 #ifdef QT_QWS_SL5XXX 80 #ifdef QT_QWS_SL5XXX
74 static const QWSServer::KeyMap keyM[] = { 81 static const QWSServer::KeyMap keyM[] = {
75 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00 82 { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00
76@@ -1440,7 +1480,11 @@ 83@@ -396,7 +443,7 @@
84 for the list of codes).
85 <li>\a modifiers is the set of modifier keys (see Qt::Modifier).
86 <li>\a isPress says whether this is a press or a release.
87- <li>\a autoRepeat says whether this event was generated by an auto-repeat
88+ <li>\a time says whether this event was generated by an auto-repeat
89 mechanism, or an actual key press.
90 </ul>
91 */
92@@ -1440,7 +1486,11 @@
77 } else { 93 } else {
78 type = spec; 94 type = spec;
79 } 95 }
80- 96-
81+ if ( type == "SIMpad" ) 97+ if ( type == "SIMpad" )
82+ { 98+ {
83+ qDebug( "QWSKeyboardHandler: using SIMpad keyboard handler..." ); 99+ qDebug( "QWSKeyboardHandler: using SIMpad keyboard handler..." );
84+ handler = new QWSsimpadButtonsHandler(); 100+ handler = new QWSsimpadButtonsHandler();
85+ } 101+ }
86 if ( type == "Buttons" ) { 102 if ( type == "Buttons" ) {
87 #if defined(QT_QWS_YOPY) 103 #if defined(QT_QWS_YOPY)
88 handler = new QWSyopyButtonsHandler(); 104 handler = new QWSyopyButtonsHandler();
89@@ -1469,6 +1513,72 @@ 105@@ -1469,6 +1519,103 @@
90 return keyM; 106 return keyM;
91 } 107 }
92 108
93-#endif // QT_NO_QWS_KEYBOARD 109-#endif // QT_NO_QWS_KEYBOARD
94 110+
95+/* 111+/*
96+ * SIMpad switches handler 112+ * SIMpad switches handler
97+ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 113+ * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
98+ */ 114+ */
99+ 115
100+ 116
101+QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() 117+QWSsimpadButtonsHandler::QWSsimpadButtonsHandler()
102+ :QWSKeyboardHandler(), fd( -1 ) 118+ :QWSKeyboardHandler(), fd( -1 ),
119+ repeatdelay( 400 ), repeatperiod( 80 )
103+{ 120+{
104+ qDebug( "SimpadButtonsHandler()" ); 121+ qDebug( "SimpadButtonsHandler()" );
105+ fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); 122+ fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 );
106+ if ( fd < 0 ) 123+ if ( fd < 0 )
107+ { 124+ {
108+ qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE ); 125+ qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE );
109+ return; 126+ return;
110+ } 127+ }
111+ 128+
112+ notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); 129+ notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this );
113+ connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); 130+ connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) );
131+
132+ repeater = new QTimer(this);
133+ connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat()));
134+
114+} 135+}
115 136+
116+ 137+
117+QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() 138+QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler()
118+{ 139+{
119+ qDebug( "~SimpadButtonsHandler()" ); 140+ qDebug( "~SimpadButtonsHandler()" );
120+ if ( fd > 0 ) 141+ if ( fd > 0 )
121+ { 142+ {
122+ ::close( fd ); 143+ ::close( fd );
123+ fd = -1; 144+ fd = -1;
124+ } 145+ }
125+} 146+}
126+ 147+
127+ 148+
128+void QWSsimpadButtonsHandler::readSwitchesData() 149+void QWSsimpadButtonsHandler::readSwitchesData()
129+{ 150+{
130+ qDebug( "SimpadButtonsHandler() - detected switches action" ); 151+ qDebug( "SimpadButtonsHandler() - detected switches action" );
131+ 152+
132+ if ( ::read( fd, &switches, sizeof switches ) < 0 ) 153+ if ( ::read( fd, &switches, sizeof switches ) < 0 )
133+ { 154+ {
134+ qWarning( "SimpadButtonsHandler() - switches read error!" ); 155+ qWarning( "SimpadButtonsHandler() - switches read error!" );
135+ return; 156+ return;
136+ } 157+ }
137+ 158+
138+ qDebug( "SimpadButtonsHandler() - EVENT = %04xd | %04xd", 159+ qDebug( "SimpadButtonsHandler() - SwitchEvent = %0x | %0x",
139+ switches.events[0], switches.states[0] ); 160+ switches.events[0], switches.states[0] );
140+ 161+
141+ bool press = switches.states[0]; // == switches.event[0]; 162+ bool press = switches.states[0]; // == switches.event[0];
142+ int code = switches.events[0]; 163+ int code = switches.events[0];
143+ int k = -1; 164+ k = -1;
144+ 165+
145+ switch(code) 166+ switch(code)
146+ { 167+ {
147+ case SIMPAD_SWITCH_UPPER: k = Qt::Key_Escape; break; 168+ case SIMPAD_SWITCH_UPPER: k = Qt::Key_Escape; break;
148+ case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break; 169+ case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break;
149+ case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break; 170+ case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break;
150+ case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break; 171+ case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break;
151+ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break; 172+ case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break;
152+ case SIMPAD_SWITCH_LOWER: k = Qt::Key_Return; break; 173+ case SIMPAD_SWITCH_LOWER: k = Qt::Key_Return; break;
153+ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; 174+ default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break;
154+ } 175+ }
155+ 176+
177+ bool repeatable = ( k != SIMPAD_SWITCH_UPPER && k != SIMPAD_SWITCH_LOWER );
178+
179+ qDebug( "SimpadButtonsHandler() - Repeatable = %s", repeatable? "true":"false" );
180+
181+ if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down )
182+ {
183+ qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." );
184+ int oldK = k;
185+ k = xform_dirkey( k );
186+ qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k );
187+ }
188+
189+ if ( repeatable && press )
190+ repeater->start( repeatdelay, true );
191+ else
192+ repeater->stop();
193+
156+ if ( k >= 0 ) 194+ if ( k >= 0 )
157+ { 195+ {
158+ qwsServer->processKeyEvent( 0, k, 0, press, false ); 196+ qwsServer->processKeyEvent( 0, k, 0, press, false );
159+ } 197+ }
160+} 198+}
161+ 199+
200+
201+void QWSsimpadButtonsHandler::autoRepeat()
202+{
203+ processKeyEvent( 0, k, 0, false, true );
204+ processKeyEvent( 0, k, 0, true, true );
205+ repeater->start(repeatperiod);
206+}
207+
208+
162+#endif // QT_NO_QWS_KEYBOARD 209+#endif // QT_NO_QWS_KEYBOARD