-rw-r--r-- | qt/qte234-for-opie091-simpad.patch | 83 |
1 files changed, 74 insertions, 9 deletions
diff --git a/qt/qte234-for-opie091-simpad.patch b/qt/qte234-for-opie091-simpad.patch index 5b892d4..74a8d83 100644 --- a/qt/qte234-for-opie091-simpad.patch +++ b/qt/qte234-for-opie091-simpad.patch | |||
@@ -1,205 +1,205 @@ | |||
1 | --- src/kernel/qkeyboard_qws.cpp.origFri May 30 16:05:20 2003 | 1 | --- qt-2.3.5/src/kernel/qkeyboard_qws.cpp~qte234-for-opie091-simpad2003-06-13 16:59:33.000000000 +0200 |
2 | +++ src/kernel/qkeyboard_qws.cppFri May 30 16:03:41 2003 | 2 | +++ qt-2.3.5/src/kernel/qkeyboard_qws.cpp2003-06-13 16:59:33.000000000 +0200 |
3 | @@ -37,6 +37,7 @@ | 3 | @@ -37,6 +37,7 @@ |
4 | #include <qapplication.h> | 4 | #include <qapplication.h> |
5 | #include <qsocketnotifier.h> | 5 | #include <qsocketnotifier.h> |
6 | #include <qnamespace.h> | 6 | #include <qnamespace.h> |
7 | +#include <qdatetime.h> | 7 | +#include <qdatetime.h> |
8 | #include <qtimer.h> | 8 | #include <qtimer.h> |
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | @@ -131,6 +132,59 @@ | 11 | @@ -131,6 +132,59 @@ |
12 | 12 | ||
13 | #endif // QNX6 | 13 | #endif // QNX6 |
14 | 14 | ||
15 | +/* | 15 | +/* |
16 | + * SIMpad switches handler | 16 | + * SIMpad switches handler |
17 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 17 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
18 | + */ | 18 | + */ |
19 | + | 19 | + |
20 | +//TODO: guard this against inclusion with #ifdef QT_QWS_SIMPAD | 20 | +//TODO: guard this against inclusion with #ifdef QT_QWS_SIMPAD |
21 | + | 21 | + |
22 | +#include <linux/switches.h> | 22 | +#include <linux/switches.h> |
23 | +#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches" | 23 | +#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches" |
24 | + | 24 | + |
25 | +// switches from left top to right down over the SIMpad surface | 25 | +// switches from left top to right down over the SIMpad surface |
26 | + | 26 | + |
27 | +#define SIMPAD_SWITCH_POWER 0x02 | 27 | +#define SIMPAD_SWITCH_POWER 0x02 |
28 | +#define SIMPAD_SWITCH_UPPER 0x10 | 28 | +#define SIMPAD_SWITCH_UPPER 0x10 |
29 | +#define SIMPAD_SWITCH_UP 0x20 | 29 | +#define SIMPAD_SWITCH_UP 0x20 |
30 | +#define SIMPAD_SWITCH_DOWN 0x40 | 30 | +#define SIMPAD_SWITCH_DOWN 0x40 |
31 | +#define SIMPAD_SWITCH_LEFT 0x80 | 31 | +#define SIMPAD_SWITCH_LEFT 0x80 |
32 | +#define SIMPAD_SWITCH_RIGHT 0x100 | 32 | +#define SIMPAD_SWITCH_RIGHT 0x100 |
33 | +#define SIMPAD_SWITCH_LOWER 0x8 | 33 | +#define SIMPAD_SWITCH_LOWER 0x8 |
34 | + | 34 | + |
35 | +class QWSsimpadButtonsHandler : public QWSKeyboardHandler | 35 | +class QWSsimpadButtonsHandler : public QWSKeyboardHandler |
36 | +{ | 36 | +{ |
37 | + Q_OBJECT | 37 | + Q_OBJECT |
38 | + | 38 | + |
39 | + public: | 39 | + public: |
40 | + QWSsimpadButtonsHandler(); | 40 | + QWSsimpadButtonsHandler(); |
41 | + virtual ~QWSsimpadButtonsHandler(); | 41 | + virtual ~QWSsimpadButtonsHandler(); |
42 | + | 42 | + |
43 | + bool isOpen() { return fd > 0; } | 43 | + bool isOpen() { return fd > 0; } |
44 | + | 44 | + |
45 | + private slots: | 45 | + private slots: |
46 | + void readSwitchesData(); | 46 | + void readSwitchesData(); |
47 | + void autoRepeat(); | 47 | + void autoRepeat(); |
48 | + | 48 | + |
49 | + private: | 49 | + private: |
50 | + switches_mask_t switches; | 50 | + switches_mask_t switches; |
51 | + | 51 | + |
52 | + int fd; | 52 | + int fd; |
53 | + int repeatdelay; | 53 | + int repeatdelay; |
54 | + int repeatperiod; | 54 | + int repeatperiod; |
55 | + | 55 | + |
56 | + int lastCode; // last native code | 56 | + int lastCode; // last native code |
57 | + int lastPress; // last press/release state | 57 | + int lastPress; // last press/release state |
58 | + | 58 | + |
59 | + int k; // last emitted Qt key code | 59 | + int k; // last emitted Qt key code |
60 | + int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released | 60 | + int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released |
61 | + bool shiftUsed; // true if SHIFT has been used | 61 | + bool shiftUsed; // true if SHIFT has been used |
62 | + | 62 | + |
63 | + QTime eventTimer; // tracks time between raw events | 63 | + QTime eventTimer; // tracks time between raw events |
64 | + QTimer* repeater; | 64 | + QTimer* repeater; |
65 | + QSocketNotifier *notifier; | 65 | + QSocketNotifier *notifier; |
66 | +}; | 66 | +}; |
67 | + | 67 | + |
68 | #ifdef QT_QWS_SL5XXX | 68 | #ifdef QT_QWS_SL5XXX |
69 | static const QWSServer::KeyMap keyM[] = { | 69 | static const QWSServer::KeyMap keyM[] = { |
70 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00 | 70 | { Qt::Key_unknown,0xffff , 0xffff , 0xffff }, // 00 |
71 | @@ -1440,7 +1494,11 @@ | 71 | @@ -1444,7 +1498,11 @@ |
72 | } else { | 72 | } else { |
73 | type = spec; | 73 | type = spec; |
74 | } | 74 | } |
75 | - | 75 | - |
76 | + if ( type == "SIMpad" ) | 76 | + if ( type == "SIMpad" ) |
77 | + { | 77 | + { |
78 | + qDebug( "QWSKeyboardHandler: using SIMpad keyboard handler..." ); | 78 | + qDebug( "QWSKeyboardHandler: using SIMpad keyboard handler..." ); |
79 | + handler = new QWSsimpadButtonsHandler(); | 79 | + handler = new QWSsimpadButtonsHandler(); |
80 | + } | 80 | + } |
81 | if ( type == "Buttons" ) { | 81 | if ( type == "Buttons" ) { |
82 | #if defined(QT_QWS_YOPY) | 82 | #if defined(QT_QWS_YOPY) |
83 | handler = new QWSyopyButtonsHandler(); | 83 | handler = new QWSyopyButtonsHandler(); |
84 | @@ -1469,6 +1527,217 @@ | 84 | @@ -1473,6 +1531,217 @@ |
85 | return keyM; | 85 | return keyM; |
86 | } | 86 | } |
87 | 87 | ||
88 | -#endif // QT_NO_QWS_KEYBOARD | 88 | -#endif // QT_NO_QWS_KEYBOARD |
89 | 89 | ||
90 | +/* | 90 | +/* |
91 | + * SIMpad switches handler | 91 | + * SIMpad switches handler |
92 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 92 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
93 | + */ | 93 | + */ |
94 | + | 94 | |
95 | + | 95 | + |
96 | +QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() | 96 | +QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() |
97 | + :QWSKeyboardHandler(), fd( -1 ), | 97 | + :QWSKeyboardHandler(), fd( -1 ), |
98 | + repeatdelay( 700 ), repeatperiod( 80 ), | 98 | + repeatdelay( 700 ), repeatperiod( 80 ), |
99 | + lastCode( 0 ), lastPress( 0 ), | 99 | + lastCode( 0 ), lastPress( 0 ), |
100 | + k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false ) | 100 | + k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false ) |
101 | +{ | 101 | +{ |
102 | + qDebug( "SimpadButtonsHandler() - V4.1" ); | 102 | + qDebug( "SimpadButtonsHandler() - V4.1" ); |
103 | + fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); | 103 | + fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); |
104 | + if ( fd < 0 ) | 104 | + if ( fd < 0 ) |
105 | + { | 105 | + { |
106 | + qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE ); | 106 | + qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE ); |
107 | + return; | 107 | + return; |
108 | + } | 108 | + } |
109 | 109 | + | |
110 | + notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); | 110 | + notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); |
111 | + connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); | 111 | + connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); |
112 | + | 112 | + |
113 | + repeater = new QTimer(this); | 113 | + repeater = new QTimer(this); |
114 | + connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); | 114 | + connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); |
115 | + | 115 | + |
116 | +} | 116 | +} |
117 | + | 117 | + |
118 | + | 118 | + |
119 | +QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() | 119 | +QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() |
120 | +{ | 120 | +{ |
121 | + qDebug( "~SimpadButtonsHandler()" ); | 121 | + qDebug( "~SimpadButtonsHandler()" ); |
122 | + if ( fd > 0 ) | 122 | + if ( fd > 0 ) |
123 | + { | 123 | + { |
124 | + ::close( fd ); | 124 | + ::close( fd ); |
125 | + fd = -1; | 125 | + fd = -1; |
126 | + } | 126 | + } |
127 | +} | 127 | +} |
128 | + | 128 | + |
129 | + | 129 | + |
130 | +void QWSsimpadButtonsHandler::readSwitchesData() | 130 | +void QWSsimpadButtonsHandler::readSwitchesData() |
131 | +{ | 131 | +{ |
132 | + qDebug( "SimpadButtonsHandler() - detected switches action" ); | 132 | + qDebug( "SimpadButtonsHandler() - detected switches action" ); |
133 | + | 133 | + |
134 | + if ( ::read( fd, &switches, sizeof switches ) < 0 ) | 134 | + if ( ::read( fd, &switches, sizeof switches ) < 0 ) |
135 | + { | 135 | + { |
136 | + qWarning( "SimpadButtonsHandler() - switches read error!" ); | 136 | + qWarning( "SimpadButtonsHandler() - switches read error!" ); |
137 | + return; | 137 | + return; |
138 | + } | 138 | + } |
139 | + | 139 | + |
140 | + qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x", | 140 | + qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x", |
141 | + shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] ); | 141 | + shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] ); |
142 | + | 142 | + |
143 | + bool press = switches.states[0]; // == switches.event[0]; | 143 | + bool press = switches.states[0]; // == switches.event[0]; |
144 | + int code = switches.events[0]; | 144 | + int code = switches.events[0]; |
145 | + | 145 | + |
146 | + //========================================================================= | 146 | + //========================================================================= |
147 | + | 147 | + |
148 | + /** | 148 | + /** |
149 | + * Work around a bug in the kernel keyboard driver emitting | 149 | + * Work around a bug in the kernel keyboard driver emitting |
150 | + * bogus events when pressing multiple switches at once | 150 | + * bogus events when pressing multiple switches at once |
151 | + **/ | 151 | + **/ |
152 | + | 152 | + |
153 | + if ( lastCode == 0 ) | 153 | + if ( lastCode == 0 ) |
154 | + { | 154 | + { |
155 | + // first press ever | 155 | + // first press ever |
156 | + eventTimer.start(); | 156 | + eventTimer.start(); |
157 | + lastPress = press; | 157 | + lastPress = press; |
158 | + lastCode = code; | 158 | + lastCode = code; |
159 | + } | 159 | + } |
160 | + else | 160 | + else |
161 | + { | 161 | + { |
162 | + int interval = eventTimer.restart(); | 162 | + int interval = eventTimer.restart(); |
163 | + qDebug( "event interval = %d", interval ); | 163 | + qDebug( "event interval = %d", interval ); |
164 | + if ( code == lastCode && interval < 10 ) | 164 | + if ( code == lastCode && interval < 10 ) |
165 | + { | 165 | + { |
166 | + qDebug( "event interval too small - ignoring bogus event" ); | 166 | + qDebug( "event interval too small - ignoring bogus event" ); |
167 | + qDebug( "did I say i hate buggy kernel drivers? :-D" ); | 167 | + qDebug( "did I say i hate buggy kernel drivers? :-D" ); |
168 | + return; | 168 | + return; |
169 | + } | 169 | + } |
170 | + | 170 | + |
171 | + lastPress = press; | 171 | + lastPress = press; |
172 | + lastCode = code; | 172 | + lastCode = code; |
173 | + } | 173 | + } |
174 | + | 174 | + |
175 | + /** | 175 | + /** |
176 | + * Actually it may also be a hardware problem, but I really don't like | 176 | + * Actually it may also be a hardware problem, but I really don't like |
177 | + * to review kernel code for further inquiry. So just being lazy and | 177 | + * to review kernel code for further inquiry. So just being lazy and |
178 | + * do the workaround in user space :-D | 178 | + * do the workaround in user space :-D |
179 | + **/ | 179 | + **/ |
180 | + | 180 | + |
181 | + //===================================================================== | 181 | + //===================================================================== |
182 | + | 182 | + |
183 | + if ( shiftKeyPressed ) | 183 | + if ( shiftKeyPressed ) |
184 | + { | 184 | + { |
185 | + // a shift key obviously is being held | 185 | + // a shift key obviously is being held |
186 | + qDebug( "while shift key is being held..." ); | 186 | + qDebug( "while shift key is being held..." ); |
187 | + | 187 | + |
188 | + if ( code != shiftKeyPressed ) | 188 | + if ( code != shiftKeyPressed ) |
189 | + { | 189 | + { |
190 | + // another key is being touched - that means shift mode for us! | 190 | + // another key is being touched - that means shift mode for us! |
191 | + qDebug( " another key is being touched -> shift use now = true" ); | 191 | + qDebug( " another key is being touched -> shift use now = true" ); |
192 | + | 192 | + |
193 | + shiftUsed = true; | 193 | + shiftUsed = true; |
194 | + | 194 | + |
195 | + if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1 | 195 | + if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1 |
196 | + { | 196 | + { |
197 | + qDebug( " shift mode 1" ); | 197 | + qDebug( " shift mode 1" ); |
198 | + switch(code) | 198 | + switch(code) |
199 | + { | 199 | + { |
200 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar | 200 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar |
201 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts | 201 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts |
202 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail | 202 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail |
203 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu | 203 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu |
204 | + case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home | 204 | + case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home |
205 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break; | 205 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break; |
@@ -207,96 +207,161 @@ | |||
207 | + } | 207 | + } |
208 | + else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2 | 208 | + else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2 |
209 | + { | 209 | + { |
210 | + qDebug( " shift mode 2" ); | 210 | + qDebug( " shift mode 2" ); |
211 | + switch(code) | 211 | + switch(code) |
212 | + { | 212 | + { |
213 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5 | 213 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5 |
214 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6 | 214 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6 |
215 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7 | 215 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7 |
216 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8 | 216 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8 |
217 | + case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9 | 217 | + case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9 |
218 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break; | 218 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break; |
219 | + } | 219 | + } |
220 | + } | 220 | + } |
221 | + } | 221 | + } |
222 | + else | 222 | + else |
223 | + { | 223 | + { |
224 | + qDebug( " shift key has been released. checking if being used..." ); | 224 | + qDebug( " shift key has been released. checking if being used..." ); |
225 | + shiftKeyPressed = 0; | 225 | + shiftKeyPressed = 0; |
226 | + | 226 | + |
227 | + if ( !shiftUsed ) | 227 | + if ( !shiftUsed ) |
228 | + { | 228 | + { |
229 | + qDebug( " ... has _not_ being used -> really emit the key" ); | 229 | + qDebug( " ... has _not_ being used -> really emit the key" ); |
230 | + k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return ); | 230 | + k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return ); |
231 | + qDebug( "Emitting key = %d (pressed)", k ); | 231 | + qDebug( "Emitting key = %d (pressed)", k ); |
232 | + processKeyEvent( 0, k, 0, true, true ); | 232 | + processKeyEvent( 0, k, 0, true, true ); |
233 | + qDebug( "Emitting key = %d (released)", k ); | 233 | + qDebug( "Emitting key = %d (released)", k ); |
234 | + processKeyEvent( 0, k, 0, false, true ); | 234 | + processKeyEvent( 0, k, 0, false, true ); |
235 | + return; | 235 | + return; |
236 | + } | 236 | + } |
237 | + else | 237 | + else |
238 | + { | 238 | + { |
239 | + qDebug( " ... has being used -> doing nothing" ); | 239 | + qDebug( " ... has being used -> doing nothing" ); |
240 | + return; | 240 | + return; |
241 | + } | 241 | + } |
242 | + } | 242 | + } |
243 | + } | 243 | + } |
244 | + else | 244 | + else |
245 | + { | 245 | + { |
246 | + qDebug( "standard mode - no shift yet..." ); | 246 | + qDebug( "standard mode - no shift yet..." ); |
247 | + | 247 | + |
248 | + switch(code) | 248 | + switch(code) |
249 | + { | 249 | + { |
250 | + case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break; | 250 | + case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break; |
251 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break; | 251 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break; |
252 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break; | 252 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break; |
253 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break; | 253 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break; |
254 | + | 254 | + |
255 | + case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; | 255 | + case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; |
256 | + case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; | 256 | + case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; |
257 | + | 257 | + |
258 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; | 258 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; |
259 | + } | 259 | + } |
260 | + } | 260 | + } |
261 | + | 261 | + |
262 | + if ( k == -1 ) | 262 | + if ( k == -1 ) |
263 | + { | 263 | + { |
264 | + qDebug( "no key to emit - returning." ); | 264 | + qDebug( "no key to emit - returning." ); |
265 | + return; | 265 | + return; |
266 | + } | 266 | + } |
267 | + | 267 | + |
268 | + bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down || | 268 | + bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down || |
269 | + k == Qt::Key_Right || k == Qt::Key_Left ); | 269 | + k == Qt::Key_Right || k == Qt::Key_Left ); |
270 | + | 270 | + |
271 | + qDebug( "key to emit = %d [%s] [repeat=%s]", k, | 271 | + qDebug( "key to emit = %d [%s] [repeat=%s]", k, |
272 | + press ? "press" : "release", | 272 | + press ? "press" : "release", |
273 | + repeatable ? "true":"false" ); | 273 | + repeatable ? "true":"false" ); |
274 | + | 274 | + |
275 | + if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down ) | 275 | + if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down ) |
276 | + { | 276 | + { |
277 | + qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." ); | 277 | + qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." ); |
278 | + int oldK = k; | 278 | + int oldK = k; |
279 | + k = xform_dirkey( k ); | 279 | + k = xform_dirkey( k ); |
280 | + qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k ); | 280 | + qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k ); |
281 | + } | 281 | + } |
282 | + | 282 | + |
283 | + if ( repeatable && press ) | 283 | + if ( repeatable && press ) |
284 | + repeater->start( repeatdelay, true ); | 284 | + repeater->start( repeatdelay, true ); |
285 | + else | 285 | + else |
286 | + repeater->stop(); | 286 | + repeater->stop(); |
287 | + | 287 | + |
288 | + qwsServer->processKeyEvent( 0, k, 0, press, false ); | 288 | + qwsServer->processKeyEvent( 0, k, 0, press, false ); |
289 | +} | 289 | +} |
290 | + | 290 | + |
291 | + | 291 | + |
292 | +void QWSsimpadButtonsHandler::autoRepeat() | 292 | +void QWSsimpadButtonsHandler::autoRepeat() |
293 | +{ | 293 | +{ |
294 | + qDebug( "Emitting key = %d (released)", k ); | 294 | + qDebug( "Emitting key = %d (released)", k ); |
295 | + processKeyEvent( 0, k, 0, false, true ); | 295 | + processKeyEvent( 0, k, 0, false, true ); |
296 | + qDebug( "Emitting key = %d (pressed)", k ); | 296 | + qDebug( "Emitting key = %d (pressed)", k ); |
297 | + processKeyEvent( 0, k, 0, true, true ); | 297 | + processKeyEvent( 0, k, 0, true, true ); |
298 | + repeater->start(repeatperiod); | 298 | + repeater->start(repeatperiod); |
299 | +} | 299 | +} |
300 | + | 300 | + |
301 | + | 301 | + |
302 | +#endif // QT_NO_QWS_KEYBOARD | 302 | +#endif // QT_NO_QWS_KEYBOARD |
303 | --- qt-2.3.5/src/kernel/qwsmouse_qws.cpp~qte234-for-opie091-simpad2003-04-02 03:26:52.000000000 +0200 | ||
304 | +++ qt-2.3.5/src/kernel/qwsmouse_qws.cpp2003-06-13 16:59:33.000000000 +0200 | ||
305 | @@ -47,6 +47,7 @@ | ||
306 | #include <stdlib.h> | ||
307 | #include <stdio.h> | ||
308 | #include <sys/ioctl.h> | ||
309 | +#include <sys/time.h> | ||
310 | #include <sys/types.h> | ||
311 | #include <sys/stat.h> | ||
312 | #include <fcntl.h> | ||
313 | @@ -67,6 +68,7 @@ | ||
314 | unsigned short x; | ||
315 | unsigned short y; | ||
316 | unsigned short pad; | ||
317 | + struct timeval stamp; | ||
318 | } TS_EVENT; | ||
319 | #elif defined(QT_QWS_SL5XXX) | ||
320 | #define QT_QWS_SL5XXX_RAW | ||
321 | @@ -1238,29 +1240,11 @@ | ||
322 | : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0), | ||
323 | numSamples(0), skipCount(0) | ||
324 | { | ||
325 | -#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | ||
326 | -#if defined(QT_QWS_IPAQ) | ||
327 | -# ifdef QT_QWS_IPAQ_RAW | ||
328 | - if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) { | ||
329 | -# else | ||
330 | - if ((mouseFD = open( "/dev/h3600_ts", O_RDONLY | O_NDELAY)) < 0) { | ||
331 | -# endif | ||
332 | - qWarning( "Cannot open /dev/h3600_ts (%s)", strerror(errno)); | ||
333 | +#ifdef QT_QWS_SIMPAD | ||
334 | + if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) { | ||
335 | + qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno)); | ||
336 | return; | ||
337 | } | ||
338 | -#elif defined(QT_QWS_SL5XXX) | ||
339 | -//# ifdef QT_QWS_SL5XXX_TSRAW | ||
340 | -# if 0 | ||
341 | - if ((mouseFD = open( "/dev/tsraw", O_RDONLY | O_NDELAY)) < 0) { | ||
342 | - qWarning( "Cannot open /dev/tsraw (%s)", strerror(errno)); | ||
343 | - return; | ||
344 | - } | ||
345 | -# else | ||
346 | - if ((mouseFD = open( "/dev/ts", O_RDONLY | O_NDELAY)) < 0) { | ||
347 | - qWarning( "Cannot open /dev/ts (%s)", strerror(errno)); | ||
348 | - return; | ||
349 | - } | ||
350 | -# endif | ||
351 | #endif | ||
352 | |||
353 | QSocketNotifier *mouseNotifier; | ||
354 | @@ -1269,12 +1253,11 @@ | ||
355 | connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); | ||
356 | waspressed=FALSE; | ||
357 | mouseIdx = 0; | ||
358 | -#endif | ||
359 | } | ||
360 | |||
361 | QTPanelHandlerPrivate::~QTPanelHandlerPrivate() | ||
362 | { | ||
363 | -#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | ||
364 | +#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_SIMPAD) | ||
365 | if (mouseFD >= 0) | ||
366 | close(mouseFD); | ||
367 | #endif | ||