summaryrefslogtreecommitdiff
path: root/recipes/qte/qte-2.3.10/remove-unused-kbdhandler.patch
blob: 2bebb020f3abdbcddb2e8a56a921352d801c8f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
--- qt-2.3.10.orig/src/kernel/qkeyboard_qws.cpp.org	2007-07-19 11:00:39.000000000 +0300
+++ qt-2.3.10/src/kernel/qkeyboard_qws.cpp	2007-07-19 12:14:48.000000000 +0300
@@ -853,417 +853,6 @@
 
 void QWSPC101KeyboardHandler::doKey(uchar code)
 {
-    const QWSServer::KeyMap *currentKey = 0;
-    int keyCode = Qt::Key_unknown;
-    bool release = false;
-    int keypad = 0;
-
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // need autorepeat implemented here?
-        bool repeatable = TRUE;
-
-#ifndef QT_QWS_USE_KEYCODES
-#if defined(QT_QWS_IPAQ)
-    // map ipaq 'action' key (0x60, 0xe0)
-    if ((code & 0x7f) == 0x60) {
-#if defined(QT_KEYPAD_MODE)
-	// to keycode for select (keypad mode)
-	code = (code & 0x80) | 116;
-#else
-	// to keycode for space. (no keypad mode0
-	code = (code & 0x80) | 57;
-#endif
-    }
-#endif
-
-#if !defined(QT_QWS_SL5XXX)
-    if (code == 224
-#if defined(QT_QWS_IPAQ) 
-	&& !ipaq_return_pressed
-#endif
-	) {
-	// extended
-	extended = 1;
-	return;
-    }
-    else if (code == 225) {
-    	// extended 2
-    	extended = 2;
-    	return;
-    }
-#endif
-#endif
-
-
-    /*------------------------------------------------------------------
-      First find the Qt KeyCode
-      ------------------------------------------------------------------*/
-
-    if (code & 0x80) {
-	release = true;
-	code &= 0x7f;
-    }
-
-#ifndef QT_QWS_USE_KEYCODES
-    if (extended == 1) {
-	currentKey = overrideMap ? overrideMap->find( code+0xe000 ) : 0;
-	if ( currentKey )
-	    keyCode = currentKey->key_code;
-	else
-	    switch (code) {
-	    case 72:
-		keyCode = Qt::Key_Up;
-		break;
-	    case 75:
-		keyCode = Qt::Key_Left;
-		break;
-	    case 77:
-		keyCode = Qt::Key_Right;
-		break;
-	    case 80:
-		keyCode = Qt::Key_Down;
-		break;
-	    case 82:
-		keyCode = Qt::Key_Insert;
-		break;
-	    case 71:
-		keyCode = Qt::Key_Home;
-		break;
-	    case 73:
-		keyCode = Qt::Key_Prior;
-		break;
-	    case 83:
-		keyCode = Qt::Key_Delete;
-		break;
-	    case 79:
-		keyCode = Qt::Key_End;
-		break;
-	    case 81:
-		keyCode = Qt::Key_Next;
-		break;
-	    case 28:
-		keyCode = Qt::Key_Enter;
-		break;
-	    case 53:
-		keyCode = Qt::Key_Slash;
-		break;
-	    case 0x1d:
-		keyCode = Qt::Key_Control;
-		break;
-	    case 0x2a:
-		keyCode = Qt::Key_SysReq;
-		break;
-	    case 0x38:
-		keyCode = Qt::Key_Alt;
-		break;
-	    case 0x5b:
-		keyCode = Qt::Key_Super_L;
-		break;
-	    case 0x5c:
-		keyCode = Qt::Key_Super_R;
-		break;
-	    case 0x5d:
-		keyCode = Qt::Key_Menu;
-		break;
-	    }
-    } else if ( extended == 2 ) {
-	switch (code) {
-	case 0x1d: 
-	    return;
-	case 0x45:
-	    keyCode = Qt::Key_Pause;
-	    break;
-	}
-    } else
-#endif
-    {
-#if defined(QT_QWS_SL5XXX)
-	if ( fn && !meta && (code >= 0x42 && code <= 0x52) ) {
-	    ushort unicode=0xffff;
-	    int scan=0;
-	    if ( code == 0x42 ) { unicode='X'-'@'; scan=Key_X; } // Cut
-	    else if ( code == 0x43 ) { unicode='C'-'@'; scan=Key_C; } // Copy
-	    else if ( code == 0x44 ) { unicode='V'-'@'; scan=Key_V; } // Paste
-	    else if ( code == 0x52 ) { unicode='Z'-'@'; scan=Key_Z; } // Undo
-	    if ( scan ) {
-		processKeyEvent( unicode, scan, ControlButton, !release, FALSE );
-		return;
-	    }
-	}
-#endif
-	currentKey = overrideMap ? overrideMap->find( code ) : 0;
-	if ( !currentKey && code < keyMSize ) {
-	    currentKey = &QWSServer::keyMap()[code];
-	}
-	if ( currentKey )
-	    keyCode = currentKey->key_code;
-
-#if defined(QT_QWS_IPAQ)
-	switch (code) {
-#if defined(QT_QWS_SL5XXX)
-#if defined(QT_KEYPAD_MODE)
-	case 0x7a:
-	    keyCode = Key_Call;
-	    repeatable = FALSE;
-	    break;
-	case 0x7b:
-	    keyCode = Key_Context1;
-	    repeatable = FALSE;
-	    break;
-	case 0x7c:
-	    keyCode = Key_Back;
-	    repeatable = FALSE;
-	    break;
-	case 0x7d:
-	    keyCode = Key_Hangup;
-	    repeatable = FALSE;
-	    break;
-#else
-	case 0x7a: case 0x7b: case 0x7c: case 0x7d:
-	    keyCode = code - 0x7a + Key_F9;
-	    repeatable = FALSE;
-	    break;
-#endif
-	case 0x79:
-	    keyCode = Key_F34;
-	    repeatable = FALSE;
-	    break;
-#endif
-
-	case 0x74: // kernel KEY_POWER
-	    keyCode = Key_F34;
-	    repeatable = FALSE;
-	    break;
-	case 89: // kernel KEY_RO
-	    keyCode = Key_F24;
-	    repeatable = FALSE;
-	    break;
-
-	case 0x78:
-# if defined(QT_QWS_IPAQ)
-	    keyCode = Key_F24;  // record
-# else
-	    keyCode = Key_Escape;
-# endif
-	    repeatable = FALSE;
-	    break;
-	case 0x60:
-	    keyCode = Key_Return;
-# ifdef QT_QWS_IPAQ
-	    ipaq_return_pressed = !release;
-# endif
-	    break;
-	case 0x67:
-	    keyCode = Key_Right;
-	    break;
-	case 0x69:
-	    keyCode = Key_Up;
-	    break;
-	case 0x6a:
-	    keyCode = Key_Down;
-	    break;
-	case 0x6c:
-	    keyCode = Key_Left;
-	    break;
-	}
-#endif
-
-	/*------------------------------------------------------------------
-	  Then do special processing of magic keys
-	  ------------------------------------------------------------------*/
-
-
-#if defined(QT_QWS_SL5XXX)
-	if ( release && ( keyCode == Key_F34 || keyCode == Key_F35 ) )
-	    return; // no release for power and light keys
-	if ( keyCode >= Key_F1 && keyCode <= Key_F35
-	     || keyCode == Key_Escape || keyCode == Key_Home
-	     || keyCode == Key_Shift || keyCode == Key_Meta )
-	    repeatable = FALSE;
-#endif
-
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
-	if ( qt_screen->isTransformed()
-	     && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down )
-	    {
-		keyCode = xform_dirkey(keyCode);
-	    }
-#endif
-	
-#endif
-	/*
-	  Translate shift+Key_Tab to Key_Backtab
-	*/
-	if (( keyCode == Key_Tab ) && shift )
-	    keyCode = Key_Backtab;
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
-    }
-#endif
-
-#ifndef QT_QWS_USE_KEYCODES
-    /*
-      Keypad consists of extended keys 53 and 28,
-      and non-extended keys 55 and 71 through 83.
-    */
-    if (( extended == 1 ) ? (code == 53 || code == 28) :
-	(code == 55 || ( code >= 71 && code <= 83 )) )
-	keypad = Qt::Keypad;
-#else
-    if ( code == 55 || code >= 71 && code <= 83 || code == 96
-	    || code == 98 || code == 118 )
-	keypad = Qt::Keypad;
-#endif
-
-    // Virtual console switching
-    int term = 0;
-    if (ctrl && alt && keyCode >= Qt::Key_F1 && keyCode <= Qt::Key_F10)
-	term = keyCode - Qt::Key_F1 + 1;
-    else if (ctrl && alt && keyCode == Qt::Key_Left)
-	term = QMAX(vtQws - 1, 1);
-    else if (ctrl && alt && keyCode == Qt::Key_Right)
-	term = QMIN(vtQws + 1, 10);
-    if (term && !release) {
-	ctrl = false;
-	alt = false;
-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
-	ioctl(kbdFD, VT_ACTIVATE, term);
-#endif
-	return;
-    }
-
-#if defined(QT_QWS_SL5XXX)
-    // Ctrl-Alt-Delete exits qws
-    if (ctrl && alt && keyCode == Qt::Key_Delete) {
-	qApp->quit();
-    }
-#else
-    // Ctrl-Alt-Backspace exits qws
-    if (ctrl && alt && keyCode == Qt::Key_Backspace) {
-	qApp->quit();
-    }
-#endif
-
-#if defined(QT_QWS_SL5XXX)
-    if (keyCode == Qt::Key_F22) { /* Fn key */
-	fn = !release;
-    } else if ( keyCode == Key_NumLock ) {
-	if ( release )
-	    numLock = !numLock;
-    } else
-#endif
-
-	if (keyCode == Qt::Key_Alt) {
-	    alt = !release;
-	} else if (keyCode == Qt::Key_Control) {
-	    ctrl = !release;
-	} else if (keyCode == Qt::Key_Shift) {
-	    shift = !release;
-#if defined(QT_QWS_SL5XXX)
-	} else if (keyCode == Qt::Key_Meta) {
-	    meta = !release;
-#endif
-	} else if ( keyCode == Qt::Key_CapsLock && release ) {
-	    caps = !caps;
-#if defined(_OS_LINUX_) && !defined(QT_QWS_SL5XXX)
-	    char leds;
-	    ioctl(0, KDGETLED, &leds);
-	    leds = leds & ~LED_CAP;
-	    if ( caps ) leds |= LED_CAP;
-	    ioctl(0, KDSETLED, leds);
-#endif
-	}
-
-    /*------------------------------------------------------------------
-      Then find the Unicode value and send the event
-      ------------------------------------------------------------------*/
-    //If we map the keyboard to a non-latin1 layout, we may have
-    //valid keys with unknown key codes.
-    if ( currentKey || keyCode != Qt::Key_unknown ) {
-	bool bAlt = alt;
-	bool bCtrl = ctrl;
-	bool bShift = shift;
-	int unicode = 0xffff;
-	if ( currentKey ) {
-#if !defined(QT_QWS_SL5XXX)
-	    bool bCaps = shift ||
-			 (caps ? QChar(QWSServer::keyMap()[code].unicode).isLetter() : FALSE);
-#else
-	    bool bCaps = caps ^ shift;
-	    if (fn) {
-		if ( shift ) {
-		    bCaps = bShift = FALSE;
-		    bCtrl = TRUE;
-		}
-		if ( meta ) {
-		    bCaps = bShift = TRUE;
-		    bAlt = TRUE;
-		}
-	    } else if ( meta ) {
-		bCaps = bShift = TRUE;
-	    }
-	    if ( code > 40 && caps ) {
-		// fn-keys should only react to shift, not caps
-		bCaps = bShift = shift;
-	    }
-	    if ( numLock ) {
-		if ( keyCode != Key_Space && keyCode != Key_Tab )
-		    bCaps = bShift = FALSE;
-	    }
-	    if ( keyCode == Key_Delete && (bAlt || bCtrl) ) {
-		keyCode = Key_BraceLeft;
-		unicode = '[';
-		bCaps = bShift = bAlt = bCtrl = FALSE;
-	    } else if (keyCode == Qt::Key_F31 && bCtrl) {
-		keyCode = Key_QuoteLeft;
-		unicode = '`';
-	    } else
-#endif
-		
-		if (bCtrl)
-		    unicode = currentKey->ctrl_unicode;
-		else if (bCaps)
-		    unicode = currentKey->shift_unicode;
-		else
-		    unicode = currentKey->unicode;
-#ifndef QT_QWS_USE_KEYCODES
-	} else if ( extended == 1 ) {
-	    if ( keyCode == Qt::Key_Slash )
-		unicode = '/';
-	    else if ( keyCode == Qt::Key_Enter )
-		unicode = 0xd;
-#endif
-	}
-
-	modifiers = 0;
-	if ( bAlt ) modifiers |= AltButton;
-	if ( bCtrl ) modifiers |= ControlButton;
-	if ( bShift ) modifiers |= ShiftButton;
-	if ( keypad ) modifiers |= Keypad;
-
-	// looks wrong -- WWA
-	bool repeat = FALSE;
-	if (prevuni == unicode && prevkey == keyCode && !release)
-	    repeat = TRUE;
-
-	processKeyEvent( unicode, keyCode, modifiers, !release, repeat );
-
-	if (!release) {
-	    prevuni = unicode;
-	    prevkey = keyCode;
-	} else {
-	    prevkey = prevuni = 0;
-	}
-
-#ifdef QT_QWS_AUTOREPEAT_MANUALLY
-        if ( repeatable && !release )
-            rep->start(prevuni,prevkey,modifiers);
-        else
-            rep->stop();
-#endif
-
-    }
-#ifndef QT_QWS_USE_KEYCODES
-    extended = 0;
-#endif
 }