author | arunabha |
Tue, 21 Sep 2010 17:05:59 +0100 | |
branch | BYD_LCD_Integration |
changeset 81 | 8b0d299f2a61 |
parent 21 | 524118fd998f |
permissions | -rwxr-xr-x |
0 | 1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// omap3530/beagle_drivers/keytran/keymap.cpp |
|
15 |
// This file is part of the Beagle Base port |
|
16 |
// The keyboard lookup tables giving the function to be carried out |
|
17 |
// and the new state of the keyboard |
|
18 |
// |
|
19 |
||
20 |
||
21 |
#include <k32keys.h> |
|
22 |
||
23 |
#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0])) |
|
24 |
||
25 |
||
26 |
// |
|
27 |
// Scancode conversion tables |
|
28 |
// -------------------------- |
|
29 |
// The scancode conversion is arranged as a tree of tables which are used to |
|
30 |
// convert a scancode to a keycode, taking into account the modifier state |
|
31 |
// (shift, control, fn) |
|
32 |
// |
|
33 |
// How the tables work: |
|
34 |
// -------------------- |
|
35 |
// Firstly, there is a distinction between the "scancodes" used in scanning |
|
36 |
// the keyboard, and the "scancodes" used in this files. |
|
37 |
// |
|
38 |
// Typically the keyboard driver already contains a table to convert hardware |
|
39 |
// key location codes produced during keyboard scanning into EPOC "scancodes". |
|
40 |
// EPOC scancodes are defined for "standard" keys like shift, backspace, |
|
41 |
// escape, in the TStdScanCode enum (see E32KEYS.H), and should be ASCII codes |
|
42 |
// for normal characters. The keyboard driver should add these EPOC scancodes |
|
43 |
// to the event queue, not hardware-dependant key locations. |
|
44 |
// |
|
45 |
// For now on "scancode" refers to EPOC scancodes: |
|
46 |
// |
|
47 |
// The keyboard is divided into a number of "blocks" of contiguous scancodes |
|
48 |
// |
|
49 |
// Blocks map to keycodes in a keycode table, and several blocks can be |
|
50 |
// grouped and map to a single keycode table. Blocks map into the keycode |
|
51 |
// table in the order they are declared. For example, if two scancode blocks |
|
52 |
// with a range of 5 scancodes map to a single 10-entry keycode table, scancodes |
|
53 |
// which fall in the first block will map to the first 5 entries in the keycode |
|
54 |
// table, scancodes falling in the second block map the the next 5 entries in |
|
55 |
// the keycode table. |
|
56 |
// |
|
57 |
// In theory it is possible to have multiple [keycode,scancode blocks] groups |
|
58 |
// but there is little point doing this - grouping all the scancode blocks |
|
59 |
// with a single keycode table holding all possible keycode values is usually |
|
60 |
// sufficient (and simpler). However, there are some special cases where this |
|
61 |
// is useful - the most obvious example is handling of shift and caps lock. |
|
62 |
// The shift key implies everything that the caps-lock key does (upper case |
|
63 |
// letters) plus some shifted characters for other keys. This is done by |
|
64 |
// defining two tables - the first handles only caps-lock (upper case), the |
|
65 |
// second handles all other keys that are affected only by shift. If caps- |
|
66 |
// lock is active, only the caps-lock table is used. If shift is pressed both |
|
67 |
// the caps-lock and shift tables are scanned for the conversion. This allows |
|
68 |
// a base table to be extended with "extras", much like deriving a class from |
|
69 |
// base class and extending it. |
|
70 |
// |
|
71 |
// |
|
72 |
// There is one or more [keycode table, scancode blocks] group for each |
|
73 |
// modifier state - e.g. a lower-case table, upper-case, ctrl, ctrl-shift. |
|
74 |
// This is the root of the table. |
|
75 |
// |
|
76 |
// When converting a scancode the key translator first obtains the correct |
|
77 |
// conversion tables for the modifier state. It then traverses all the scancode |
|
78 |
// blocks looking for one which contains the scancode being converted. Once |
|
79 |
// a matching scancode range is located, the key translator maps this into |
|
80 |
// its position in the associated keycode table to obtain the converted keycode. |
|
81 |
// |
|
82 |
// The key tables below appear more complicated than they really are because of |
|
83 |
// the intermediate structures that hold pointers to other structures. The |
|
84 |
// important structures are: |
|
85 |
// SScanCodeBlock - contains a "start" and "end" for a scancode range |
|
86 |
// SConvSubTable - groups a number of scanode blocks with a keycode table |
|
87 |
// SConvTableNode - points to SConvSubTables for each modifier state |
|
88 |
// SConvTable - the root of the translation table - points to 1..n SConvTableNode |
|
89 |
// |
|
90 |
// The keycode tables are just an array of TUint16. |
|
91 |
// |
|
92 |
||
93 |
||
94 |
// |
|
95 |
// TO DO: (optional) |
|
96 |
// |
|
97 |
// Keys which are not affected by modifier state |
|
98 |
// |
|
99 |
||
100 |
// |
|
101 |
// This is a simple example of scancode to keycode mapping. The first block |
|
102 |
// in scanCodeBlock_unmodifiable is a range of several scancodes, so maps to |
|
103 |
// several entries in the keycode table convKeyCodes_unmodifiable. |
|
104 |
// EStdKeyLeftShift -> maps to -> EKeyLeftShift |
|
105 |
// EStdKeyRightShift -> maps to -> EKeyRightShift |
|
106 |
// ... |
|
107 |
// EStdKeyScrollLock -> maps to -> EKeyScrollLock |
|
108 |
// |
|
109 |
LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]= |
|
110 |
{ |
|
111 |
{EStdKeyLeftShift, EStdKeyScrollLock}, // range 1: left shift to scroll lock |
|
112 |
}; |
|
113 |
||
114 |
LOCAL_D const TUint16 convKeyCodes_unmodifiable[]= |
|
115 |
{ |
|
116 |
EKeyLeftShift, |
|
117 |
EKeyRightShift, |
|
118 |
EKeyLeftAlt, |
|
119 |
EKeyRightAlt, |
|
120 |
EKeyLeftCtrl, |
|
121 |
EKeyRightCtrl, |
|
122 |
EKeyLeftFunc, |
|
123 |
EKeyRightFunc, |
|
124 |
EKeyCapsLock, |
|
125 |
EKeyNumLock, |
|
126 |
EKeyScrollLock |
|
127 |
}; |
|
128 |
||
129 |
||
130 |
||
131 |
// |
|
132 |
// TO DO: (optional) |
|
133 |
// |
|
134 |
// Base conversion table |
|
135 |
// this table traps all of the keyboard's scanCodes except those in |
|
136 |
// convKeyCodes_unmodifiable. It appears last in the top-level table and |
|
137 |
// is used to convert any scancode that is not converted by any of the |
|
138 |
// other tables |
|
139 |
// |
|
140 |
LOCAL_D const SScanCodeBlock scanCodeBlock_base[]= |
|
141 |
{ |
|
142 |
{EStdKeyNull, EStdKeyDownArrow}, // scancode range 1 |
|
143 |
{'0', '9'}, // scancode range 2 |
|
144 |
{'A', 'Z'}, // scancode range 3 |
|
145 |
{EStdKeyF1, EStdKeyDictaphoneRecord}, // scancode range 4 |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
146 |
{EStdKeyDevice0,EStdKeyDeviceF}, |
0 | 147 |
}; |
148 |
||
149 |
LOCAL_D const TUint16 convKeyCodes_base[]= |
|
150 |
{ |
|
151 |
EKeyNull, // scancode range 1 mapping starts here |
|
152 |
EKeyBackspace, |
|
153 |
EKeyTab, |
|
154 |
EKeyEnter, |
|
155 |
EKeyEscape, |
|
156 |
' ', |
|
157 |
EKeyPrintScreen, |
|
158 |
EKeyPause, |
|
159 |
EKeyHome, |
|
160 |
EKeyEnd, |
|
161 |
EKeyPageUp, |
|
162 |
EKeyPageDown, |
|
163 |
EKeyInsert, |
|
164 |
EKeyDelete, |
|
165 |
EKeyLeftArrow, |
|
166 |
EKeyRightArrow, |
|
167 |
EKeyUpArrow, |
|
168 |
EKeyDownArrow, |
|
169 |
'0', // scancode range 2 mapping starts here |
|
170 |
'1', |
|
171 |
'2', |
|
172 |
'3', |
|
173 |
'4', |
|
174 |
'5', |
|
175 |
'6', |
|
176 |
'7', |
|
177 |
'8', |
|
178 |
'9', |
|
179 |
'a', // scancode range 3 mapping starts here |
|
180 |
'b', |
|
181 |
'c', |
|
182 |
'd', |
|
183 |
'e', |
|
184 |
'f', |
|
185 |
'g', |
|
186 |
'h', |
|
187 |
'i', |
|
188 |
'j', |
|
189 |
'k', |
|
190 |
'l', |
|
191 |
'm', |
|
192 |
'n', |
|
193 |
'o', |
|
194 |
'p', |
|
195 |
'q', |
|
196 |
'r', |
|
197 |
's', |
|
198 |
't', |
|
199 |
'u', |
|
200 |
'v', |
|
201 |
'w', |
|
202 |
'x', |
|
203 |
'y', |
|
204 |
'z', |
|
205 |
EKeyF1, // scancode range 4 mapping starts here |
|
206 |
EKeyF2, |
|
207 |
EKeyF3, |
|
208 |
EKeyF4, |
|
209 |
EKeyF5, |
|
210 |
EKeyF6, |
|
211 |
EKeyF7, |
|
212 |
EKeyF8, |
|
213 |
EKeyF9, |
|
214 |
EKeyF10, |
|
215 |
EKeyF11, |
|
216 |
EKeyF12, |
|
217 |
EKeyF13, |
|
218 |
EKeyF14, |
|
219 |
EKeyF15, |
|
220 |
EKeyF16, |
|
221 |
EKeyF17, |
|
222 |
EKeyF18, |
|
223 |
EKeyF19, |
|
224 |
EKeyF20, |
|
225 |
EKeyF21, |
|
226 |
EKeyF22, |
|
227 |
EKeyF23, |
|
228 |
EKeyF24, |
|
229 |
'`', |
|
230 |
',', |
|
231 |
'.', |
|
232 |
'/', |
|
233 |
'\\', |
|
234 |
';', |
|
235 |
'\'', |
|
236 |
'#', |
|
237 |
'[', |
|
238 |
']', |
|
239 |
'-', |
|
240 |
'=', |
|
241 |
'/', |
|
242 |
'*', |
|
243 |
'-', |
|
244 |
'+', |
|
245 |
EKeyEnter, |
|
246 |
EKeyEnd, |
|
247 |
EKeyDownArrow, |
|
248 |
EKeyPageDown, |
|
249 |
EKeyLeftArrow, |
|
250 |
EKeyNull, // numeric keypad '5' |
|
251 |
EKeyRightArrow, |
|
252 |
EKeyHome, |
|
253 |
EKeyUpArrow, |
|
254 |
EKeyPageUp, |
|
255 |
EKeyInsert, |
|
256 |
EKeyDelete, |
|
257 |
EKeyMenu, |
|
258 |
EKeyBacklightOn, |
|
259 |
EKeyBacklightOff, |
|
260 |
EKeyBacklightToggle, |
|
261 |
EKeyIncContrast, |
|
262 |
EKeyDecContrast, |
|
263 |
EKeySliderDown, |
|
264 |
EKeySliderUp, |
|
265 |
EKeyDictaphonePlay, |
|
266 |
EKeyDictaphoneStop, |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
267 |
EKeyDictaphoneRecord, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
268 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
269 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
270 |
EKeyDevice0, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
271 |
EKeyDevice1, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
272 |
EKeyDevice2, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
273 |
EKeyDevice3, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
274 |
EKeyDevice4, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
275 |
EKeyDevice5, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
276 |
EKeyDevice6, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
277 |
EKeyDevice7, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
278 |
EKeyDevice8, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
279 |
EKeyDevice9, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
280 |
EKeyDeviceA, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
281 |
EKeyDeviceB, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
282 |
EKeyDeviceC, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
283 |
EKeyDeviceE, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
284 |
EKeyDeviceE, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
285 |
EKeyDeviceF, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
286 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
287 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
288 |
EKeyApplication0, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
289 |
EKeyApplication1, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
290 |
EKeyApplication2, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
291 |
EKeyApplication3, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
292 |
EKeyApplication4, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
293 |
EKeyApplication5, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
294 |
EKeyApplication6, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
295 |
EKeyApplication7, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
296 |
EKeyApplication8, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
297 |
EKeyApplication9, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
298 |
EKeyApplicationA, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
299 |
EKeyApplicationB, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
300 |
EKeyApplicationC, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
301 |
EKeyApplicationD, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
302 |
EKeyApplicationE, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
303 |
EKeyApplicationF, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
304 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
305 |
EKeyYes, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
306 |
EKeyNo, |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
307 |
|
0 | 308 |
}; |
309 |
||
310 |
||
311 |
// |
|
312 |
// TO DO: (optional) |
|
313 |
// |
|
314 |
// caps-lock: this table traps those scanCodes which are affected by caps-lock |
|
315 |
// |
|
316 |
LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]= |
|
317 |
{ |
|
318 |
{'A', 'Z'} // only alpha keys are affected by caps-lock |
|
319 |
}; |
|
320 |
||
321 |
LOCAL_D const TUint16 convKeyCodes_capsLock[]= |
|
322 |
{ |
|
323 |
'A', |
|
324 |
'B', |
|
325 |
'C', |
|
326 |
'D', |
|
327 |
'E', |
|
328 |
'F', |
|
329 |
'G', |
|
330 |
'H', |
|
331 |
'I', |
|
332 |
'J', |
|
333 |
'K', |
|
334 |
'L', |
|
335 |
'M', |
|
336 |
'N', |
|
337 |
'O', |
|
338 |
'P', |
|
339 |
'Q', |
|
340 |
'R', |
|
341 |
'S', |
|
342 |
'T', |
|
343 |
'U', |
|
344 |
'V', |
|
345 |
'W', |
|
346 |
'X', |
|
347 |
'Y', |
|
348 |
'Z' |
|
349 |
}; |
|
350 |
||
351 |
// |
|
352 |
// TO DO: (optional) |
|
353 |
// |
|
354 |
// shift: this table traps those scanCodes which are affected |
|
355 |
// by normal shift key EXCEPT for those scanCodes affected by caps-lock |
|
356 |
// |
|
357 |
||
358 |
LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]= |
|
359 |
{ |
|
360 |
{'0', '9'}, |
|
361 |
{EStdKeyXXX, EStdKeyEquals}, |
|
362 |
}; |
|
363 |
||
364 |
LOCAL_D const TUint16 convKeyCodes_shift[]= |
|
365 |
{ |
|
366 |
')', |
|
367 |
'!', |
|
368 |
'@',/*'"',*/ |
|
369 |
'#', /*ELatin1Pound,*/ |
|
370 |
'$', |
|
371 |
'%', |
|
372 |
'^', |
|
373 |
'&', |
|
374 |
'*', |
|
375 |
'(', |
|
376 |
'~', /*ELatin1LogicNot,*/ |
|
377 |
'<', |
|
378 |
'>', |
|
379 |
'?', |
|
380 |
'|', |
|
381 |
':', |
|
382 |
'"', |
|
383 |
'|', /*'~',*/ |
|
384 |
'{', |
|
385 |
'}', |
|
386 |
'_', |
|
387 |
'+' |
|
388 |
}; |
|
389 |
||
390 |
// |
|
391 |
// TO DO: (optional) |
|
392 |
// |
|
393 |
// func: this table traps those scanCodes which are affected |
|
394 |
// by the func key but not shift |
|
395 |
// |
|
396 |
LOCAL_D const SScanCodeBlock scanCodeBlock_func[]= |
|
397 |
{ |
|
398 |
{EStdKeyEscape, EStdKeyEscape}, |
|
399 |
{'M', 'M'}, |
|
400 |
{EStdKeyComma, EStdKeyComma}, |
|
401 |
{EStdKeyLeftArrow, EStdKeyDownArrow}, |
|
402 |
}; |
|
403 |
||
404 |
LOCAL_D const TUint16 convKeyCodes_func[]= |
|
405 |
{ |
|
406 |
EKeyOff, |
|
407 |
EKeyDecContrast, |
|
408 |
EKeyIncContrast, |
|
409 |
EKeyHome, |
|
410 |
EKeyEnd, |
|
411 |
EKeyPageUp, |
|
412 |
EKeyPageDown, |
|
413 |
}; |
|
414 |
||
415 |
// |
|
416 |
// TO DO: (optional) |
|
417 |
// |
|
418 |
// func: this table traps those scanCodes which are affected |
|
419 |
// by func and shift - this is for func pressed, shift not pressed |
|
420 |
// |
|
421 |
//LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]= |
|
422 |
// { |
|
423 |
// {'E', 'E'}, |
|
424 |
// }; |
|
425 |
||
426 |
//LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]= |
|
427 |
// { |
|
428 |
// ELatin1LcEacute, |
|
429 |
// }; |
|
430 |
||
431 |
// |
|
432 |
// TO DO: (optional) |
|
433 |
// |
|
434 |
// func: this table traps those scanCodes which are affected |
|
435 |
// by func and shift - this is for func and shift both pressed |
|
436 |
// |
|
437 |
//LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]= |
|
438 |
// { |
|
439 |
// {'E', 'E'}, |
|
440 |
// }; |
|
441 |
||
442 |
//LOCAL_D const TUint16 convKeyCodes_funcShifted[]= |
|
443 |
// { |
|
444 |
// ELatin1UcEacute, |
|
445 |
// }; |
|
446 |
||
447 |
// |
|
448 |
// TO DO: (optional) |
|
449 |
// |
|
450 |
// ctrl: this table traps those scanCodes which are affected by ctrl |
|
451 |
// |
|
452 |
LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]= |
|
453 |
{ |
|
454 |
// |
|
455 |
// NOTE: The space key gets handled elsewhere, otherwise it gets |
|
456 |
// thrown away as a NULL key |
|
457 |
// {EStdKeySpace, EStdKeySpace}, |
|
458 |
||
459 |
{'A', 'Z'}, |
|
460 |
{EStdKeyComma, EStdKeyComma}, |
|
461 |
}; |
|
462 |
||
463 |
LOCAL_D const TUint16 convKeyCodes_ctrl[]= |
|
464 |
{ |
|
465 |
// 0, |
|
466 |
1, |
|
467 |
2, |
|
468 |
3, |
|
469 |
4, |
|
470 |
5, |
|
471 |
6, |
|
472 |
7, |
|
473 |
8, |
|
474 |
9, |
|
475 |
10, |
|
476 |
11, |
|
477 |
12, |
|
478 |
13, |
|
479 |
14, |
|
480 |
15, |
|
481 |
16, |
|
482 |
17, |
|
483 |
18, |
|
484 |
19, |
|
485 |
20, |
|
486 |
21, |
|
487 |
22, |
|
488 |
23, |
|
489 |
24, |
|
490 |
25, |
|
491 |
26, |
|
492 |
',', |
|
493 |
}; |
|
494 |
||
495 |
||
496 |
||
497 |
// |
|
498 |
// TO DO: (optional) |
|
499 |
// |
|
500 |
// Each set of scancode+keycode tables must be grouped into a SConvSubTable. |
|
501 |
// The lines below define a number of SConvSubTables for each of the groups |
|
502 |
// above. |
|
503 |
// |
|
504 |
LOCAL_D const SConvSubTable |
|
505 |
convSubTable_unmodifiable= // table for unmodifiable keys |
|
506 |
{ |
|
507 |
&convKeyCodes_unmodifiable[0], // the keycode table |
|
508 |
{ |
|
509 |
ARRAY_LENGTH(scanCodeBlock_unmodifiable), // number of scancode blocks |
|
510 |
&scanCodeBlock_unmodifiable[0] // pointer to scancode blocks |
|
511 |
} |
|
512 |
}, |
|
513 |
convSubTable_base= // table for base keys |
|
514 |
{ |
|
515 |
&convKeyCodes_base[0], // keycode table |
|
516 |
{ |
|
517 |
ARRAY_LENGTH(scanCodeBlock_base), // number of scancode blocks |
|
518 |
&scanCodeBlock_base[0] // pointer to scancode blocks |
|
519 |
} |
|
520 |
}, |
|
521 |
convSubTable_capsLock= |
|
522 |
{ |
|
523 |
&convKeyCodes_capsLock[0], |
|
524 |
{ |
|
525 |
ARRAY_LENGTH(scanCodeBlock_capsLock), |
|
526 |
&scanCodeBlock_capsLock[0] |
|
527 |
} |
|
528 |
}, |
|
529 |
convSubTable_shift= |
|
530 |
{ |
|
531 |
&convKeyCodes_shift[0], |
|
532 |
{ |
|
533 |
ARRAY_LENGTH(scanCodeBlock_shift), |
|
534 |
&scanCodeBlock_shift[0] |
|
535 |
} |
|
536 |
}, |
|
537 |
convSubTable_func= |
|
538 |
{ |
|
539 |
&convKeyCodes_func[0], |
|
540 |
{ |
|
541 |
ARRAY_LENGTH(scanCodeBlock_func), |
|
542 |
&scanCodeBlock_func[0] |
|
543 |
} |
|
544 |
}, |
|
545 |
// convSubTable_funcUnshifted= |
|
546 |
// { |
|
547 |
// &convKeyCodes_funcUnshifted[0], |
|
548 |
// { |
|
549 |
// ARRAY_LENGTH(scanCodeBlock_funcUnshifted), |
|
550 |
// &scanCodeBlock_funcUnshifted[0] |
|
551 |
// } |
|
552 |
// }, |
|
553 |
// convSubTable_funcShifted= |
|
554 |
// { |
|
555 |
// &convKeyCodes_funcShifted[0], |
|
556 |
// { |
|
557 |
// ARRAY_LENGTH(scanCodeBlock_funcShifted), |
|
558 |
// &scanCodeBlock_funcShifted[0] |
|
559 |
// } |
|
560 |
// }, |
|
561 |
convSubTable_ctrl= |
|
562 |
{ |
|
563 |
&convKeyCodes_ctrl[0], |
|
564 |
{ |
|
565 |
ARRAY_LENGTH(scanCodeBlock_ctrl), |
|
566 |
&scanCodeBlock_ctrl[0] |
|
567 |
} |
|
568 |
}; |
|
569 |
||
570 |
// |
|
571 |
// TO DO: (optional) |
|
572 |
// |
|
573 |
// We need to declare arrays of SConvSubTable for each modifier state we |
|
574 |
// are going to handle. As mentioned above, it is possible to have several |
|
575 |
// [keycode table, scancode blocks] groups scanned for each keyboard state. |
|
576 |
// |
|
577 |
// Some modifier states use more than one conversion group. The simple example |
|
578 |
// is handling of caps-lock and shift. |
|
579 |
// |
|
580 |
// Caps-lock means all letters are upper-case |
|
581 |
// shift means all letters are upper case AND some other keys return control characters |
|
582 |
// |
|
583 |
// Obviously the shift key means everything cpas-lock means PLUS a bit more. So |
|
584 |
// we define two tables, the caps-lock table defines only the uppercase conversion, |
|
585 |
// and the shift table defines all OTHER shifted keys not already handled by |
|
586 |
// caps-lock. The caps-lock modifier state then only scans the caps-lock table, and |
|
587 |
// the shift state scans both tables. |
|
588 |
// |
|
589 |
LOCAL_D const SConvSubTable |
|
590 |
* const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable}, |
|
591 |
* const convSubTableArray_base[]={&convSubTable_base}, |
|
592 |
||
593 |
// |
|
594 |
// The caps-lock state scans only the caps-lock table, to handle |
|
595 |
// conversion to upper case |
|
596 |
// |
|
597 |
* const convSubTableArray_capsLock[]={&convSubTable_capsLock}, |
|
598 |
// |
|
599 |
// The shift table scans the caps-lock table to handle upper case, |
|
600 |
// and also the shift table which handles some keys that are not affected |
|
601 |
// by caps lock (such as 0-9). |
|
602 |
// |
|
603 |
* const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift}, |
|
604 |
// |
|
605 |
// Pressing shift with caps-lock active reverts to lower-case letters, |
|
606 |
// but other keys remain shifted. This time we only scan the shift table |
|
607 |
// so only the non-alpha keys will be shifted |
|
608 |
// |
|
609 |
* const convSubTableArray_capsLockShift[]={&convSubTable_shift}, |
|
610 |
||
611 |
// |
|
612 |
// Like the shift/caps-lock situation, the function key has two states, |
|
613 |
// shifted and unshifted. Also, some keys may be independant of whether |
|
614 |
// the shift key is pressed. So there are three tables defined. One declares |
|
615 |
// all keys that are independant of shift state, the other two tables handle |
|
616 |
// shifted and unshifted func. |
|
617 |
// |
|
618 |
// Unshifted func uses the independant set + funcUnshifted |
|
619 |
// |
|
620 |
// * const convSubTableArray_func[]={&convSubTable_func, &convSubTable_funcUnshifted}, |
|
621 |
* const convSubTableArray_func[]={&convSubTable_func}, |
|
622 |
// |
|
623 |
// Shifted func uses the independant set + funcShifted |
|
624 |
// |
|
625 |
// * const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted}, |
|
626 |
// |
|
627 |
// This keyboard table makes control independant of func and shift |
|
628 |
// |
|
629 |
* const convSubTableArray_ctrl[]={&convSubTable_ctrl}; |
|
630 |
||
631 |
// |
|
632 |
// TO DO: (optional) |
|
633 |
// |
|
634 |
// This is the top of the scancode conversion tree. It is a set of pointers |
|
635 |
// to the SConvSubTable arrays declared above. |
|
636 |
// |
|
637 |
// The order of these nodes is VITAL, as the scanCode/modifiers are |
|
638 |
// searched for a match in this order |
|
639 |
// |
|
640 |
// The modifier state is matched by using a mask and a compare value. This is |
|
641 |
// used as follows: |
|
642 |
// |
|
643 |
// match is true if ( (modifierState & mask) == compareValue |
|
644 |
// |
|
645 |
// For example, if the mask is (EModifierFunc|EModifierShift) and the |
|
646 |
// compare value is EModifierFunc, this will match ANY combination of |
|
647 |
// modifiers that has func pressed and shift not pressed |
|
648 |
// |
|
649 |
LOCAL_D const SConvTableNode convTableNodes[]= |
|
650 |
{ |
|
651 |
{ |
|
652 |
{ |
|
653 |
0, // modifier mask = no modifiers |
|
654 |
0 // modifier compare = no modifiers |
|
655 |
}, |
|
656 |
ARRAY_LENGTH(convSubTableArray_unmodifiable), // number of SConvSubTables |
|
657 |
&convSubTableArray_unmodifiable[0] // pointer to SConvSubTable array |
|
658 |
}, |
|
659 |
{ |
|
660 |
{ |
|
661 |
EModifierCtrl, // modifier mask = check for ctrl |
|
662 |
EModifierCtrl // modifier compare = anything with ctrl pressed |
|
663 |
}, |
|
664 |
ARRAY_LENGTH(convSubTableArray_ctrl), |
|
665 |
&convSubTableArray_ctrl[0] |
|
666 |
}, |
|
667 |
{ |
|
668 |
{ |
|
669 |
// |
|
670 |
// Check for Func pressed |
|
671 |
// |
|
672 |
EModifierFunc, |
|
673 |
EModifierFunc |
|
674 |
}, |
|
675 |
ARRAY_LENGTH(convSubTableArray_func), |
|
676 |
&convSubTableArray_func[0] |
|
677 |
}, |
|
678 |
{ |
|
679 |
{ |
|
680 |
// |
|
681 |
// Check for caps-lock pressed, shift not pressed |
|
682 |
// |
|
683 |
EModifierCapsLock|EModifierShift, |
|
684 |
EModifierCapsLock |
|
685 |
}, |
|
686 |
ARRAY_LENGTH(convSubTableArray_capsLock), |
|
687 |
&convSubTableArray_capsLock[0] |
|
688 |
}, |
|
689 |
{ |
|
690 |
{ |
|
691 |
// |
|
692 |
// Check for caps-lock not pressed, shift pressed |
|
693 |
// |
|
694 |
EModifierShift|EModifierCapsLock, |
|
695 |
EModifierShift |
|
696 |
}, |
|
697 |
ARRAY_LENGTH(convSubTableArray_shift), |
|
698 |
&convSubTableArray_shift[0] |
|
699 |
}, |
|
700 |
{ |
|
701 |
{ |
|
702 |
// |
|
703 |
// Check for caps-lock pressed, shift pressed |
|
704 |
// |
|
705 |
EModifierCapsLock|EModifierShift, |
|
706 |
EModifierCapsLock|EModifierShift |
|
707 |
}, |
|
708 |
ARRAY_LENGTH(convSubTableArray_capsLockShift), |
|
709 |
&convSubTableArray_capsLockShift[0] |
|
710 |
}, |
|
711 |
{ |
|
712 |
// |
|
713 |
// This is the base table. It must appear last so that it can |
|
714 |
// provide a default conversion for any scancodes that are not |
|
715 |
// handled by any of the tables above |
|
716 |
// |
|
717 |
{ |
|
718 |
0, |
|
719 |
0 |
|
720 |
}, |
|
721 |
ARRAY_LENGTH(convSubTableArray_base), |
|
722 |
&convSubTableArray_base[0] |
|
723 |
} |
|
724 |
}; |
|
725 |
||
726 |
// |
|
727 |
// The top-level exported data structure of all the conversion tables |
|
728 |
// This just points to the SConvTableNodes above |
|
729 |
// |
|
730 |
LOCAL_D const SConvTable ConvTable= |
|
731 |
{ |
|
732 |
ARRAY_LENGTH(convTableNodes), |
|
733 |
&convTableNodes[0] |
|
734 |
}; |
|
735 |
||
736 |
// The list of scan-codes on the numeric keypad |
|
737 |
LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]= |
|
738 |
{ |
|
739 |
{EStdKeyNumLock, EStdKeyNumLock}, |
|
740 |
{EStdKeyNkpForwardSlash, EStdKeyNkpFullStop} |
|
741 |
}; |
|
742 |
||
743 |
LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes= |
|
744 |
{ |
|
745 |
ARRAY_LENGTH(keypadScanCodeBlockArray), |
|
746 |
&keypadScanCodeBlockArray[0] |
|
747 |
}; |
|
748 |
||
749 |
// |
|
750 |
// TO DO: (optional) |
|
751 |
// |
|
752 |
// List of keycodes that do not autorepeat |
|
753 |
// |
|
754 |
// These are usually control keys like shift, ctrl, escape |
|
755 |
// |
|
756 |
LOCAL_D const TUint16 nonAutorepKeyCodeArray[]= |
|
757 |
{ |
|
758 |
EKeyEscape, |
|
759 |
EKeyPrintScreen, |
|
760 |
EKeyPause, |
|
761 |
EKeyInsert, |
|
762 |
EKeyLeftShift, |
|
763 |
EKeyRightShift, |
|
764 |
EKeyLeftAlt, |
|
765 |
EKeyRightAlt, |
|
766 |
EKeyLeftCtrl, |
|
767 |
EKeyRightCtrl, |
|
768 |
EKeyLeftFunc, |
|
769 |
EKeyRightFunc, |
|
770 |
EKeyCapsLock, |
|
771 |
EKeyNumLock, |
|
772 |
EKeyScrollLock, |
|
773 |
EKeyMenu, |
|
774 |
EKeyDictaphonePlay, |
|
775 |
EKeyDictaphoneStop, |
|
776 |
EKeyDictaphoneRecord |
|
777 |
}; |
|
778 |
||
779 |
// |
|
780 |
// TO DO: (optional) |
|
781 |
// |
|
782 |
// Declare blocks of non-autorepeating keycodes |
|
783 |
// |
|
784 |
LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes= |
|
785 |
{ |
|
786 |
ARRAY_LENGTH(nonAutorepKeyCodeArray), // number of keycode arrays |
|
787 |
&nonAutorepKeyCodeArray[0] // pointer to arrays |
|
788 |
}; |
|
789 |
||
790 |
||
791 |
||
792 |
||
793 |
||
794 |
||
795 |
///////////////////////////////////////////////////////////////////// |
|
796 |
// Keyboard state tables |
|
797 |
// |
|
798 |
||
799 |
// What these tables do |
|
800 |
// -------------------- |
|
801 |
// |
|
802 |
// These tables control the way "special" keystrokes modify the behaviour |
|
803 |
// of the keyboard. There are two major uses for this: |
|
804 |
// |
|
805 |
// - handling modifier keys e.g. caps-lock, shift, alt, fn and defining |
|
806 |
// what modifier flags are affected by these keypresses |
|
807 |
// |
|
808 |
// - switching the keyboard into special states (see below) |
|
809 |
// |
|
810 |
// Keyboard states |
|
811 |
// --------------- |
|
812 |
// |
|
813 |
// Keyboard states are used to switch the keyboard into a special mode where it |
|
814 |
// can be used to enter unusual characters. There are two uses for this: |
|
815 |
// |
|
816 |
// - entering numeric codes, by pressing ctrl and typing the decimal code |
|
817 |
// - entering accented characters by pressing a key combination which |
|
818 |
// enters "accented mode" then pressing a key. There can be multiple |
|
819 |
// accented modes. |
|
820 |
// |
|
821 |
// You can see an example of accented modes on a Psion Series 5 by |
|
822 |
// pressing Fn+Z, followed by A - this will produce an a with an umlaut (ä) |
|
823 |
// |
|
824 |
// These tables are also used to select simpler states such as caps-lock |
|
825 |
// and num-lock. |
|
826 |
// |
|
827 |
// |
|
828 |
// The main data structure is a SFuncTableEntry. Each of these contains |
|
829 |
// three fields: |
|
830 |
// |
|
831 |
// 1. modifier match - this works the same way as the scancode conversion |
|
832 |
// tables above, there is a mask and a compare value |
|
833 |
// |
|
834 |
// 2. a keycode patters - this is used to match with the keycode or keycodes |
|
835 |
// that the state should respond to. This is a TKeyCodePattern structure |
|
836 |
// which defines what sort of match should be performed. |
|
837 |
// |
|
838 |
// 3. a function and state change structure, SFuncAndState. This defines the |
|
839 |
// state to change to, the function to perform, and a parameter for the |
|
840 |
// function if required. |
|
841 |
// |
|
842 |
// TKeyCodePattern structures have two fields. The first is a keycode value |
|
843 |
// and is only used for some match types. The second field select the type |
|
844 |
// of match to perform: |
|
845 |
// |
|
846 |
// EAnyKey - match any key |
|
847 |
// EAnyAlphaNumeric - match any alpha or numeric key |
|
848 |
// EAnyAlpha - match any alpha key |
|
849 |
// EAnyAlphaLowerCase - match any lower-case key |
|
850 |
// EAnyAlphaUpperCase - match any upper-case key |
|
851 |
// EAnyDecimalDigit - match any decimal digit |
|
852 |
// EAnyModifierKey - match any modifier key (e.g. alt, fn, ctrl) |
|
853 |
// EMatchKey - match if equal to keycode value in first field |
|
854 |
// EMatchLeftOrRight - match if equal to keycode value or (keycode value + 1) |
|
855 |
// EMatchKeyCaseInsens - like EMatchKey but perform case-insensitive comparison |
|
856 |
// |
|
857 |
// |
|
858 |
||
859 |
// the "array" parameter must be a true array and not a pointer |
|
860 |
#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0])) |
|
861 |
||
862 |
#define TABLE_ENTRY_ANOTHER_CTRL_DIGIT \ |
|
863 |
{ \ |
|
864 |
{ \ |
|
865 |
EModifierKeyUp|EModifierFunc, \ |
|
866 |
0 \ |
|
867 |
}, \ |
|
868 |
{ \ |
|
869 |
EKeyNull, \ |
|
870 |
EAnyDigitGivenRadix \ |
|
871 |
}, \ |
|
872 |
{ \ |
|
873 |
EStateCtrlDigits, \ |
|
874 |
EAddOnCtrlDigit, \ |
|
875 |
0 \ |
|
876 |
} \ |
|
877 |
} |
|
878 |
||
879 |
// |
|
880 |
// TO DO: (optional) |
|
881 |
// |
|
882 |
// This table is searched for a match if a match has not been |
|
883 |
// found in the current state's table |
|
884 |
// |
|
885 |
||
886 |
LOCAL_D const SFuncTableEntry defaultTable[]= |
|
887 |
{ |
|
888 |
{ |
|
889 |
// |
|
890 |
// prevent key up events generating keycodes |
|
891 |
// |
|
892 |
{ |
|
893 |
EModifierKeyUp, // mask = key up |
|
894 |
EModifierKeyUp // match = key up - i.e. accept any key up event |
|
895 |
}, |
|
896 |
{ |
|
897 |
EKeyNull, // dummy value, not used |
|
898 |
EAnyKey // accept any key |
|
899 |
}, |
|
900 |
{ |
|
901 |
EStateUnchanged, // state will not change |
|
902 |
EDoNothing, // no action to perform |
|
903 |
0 |
|
904 |
} |
|
905 |
}, |
|
906 |
{ |
|
907 |
// |
|
908 |
// prevent any modifier key (e.g. shift, ctrl) from changing state |
|
909 |
// |
|
910 |
{ |
|
911 |
0, // match any modifier state |
|
912 |
0 |
|
913 |
}, |
|
914 |
{ |
|
915 |
EKeyNull, // dummy value |
|
916 |
EAnyModifierKey // match any modifier key |
|
917 |
}, |
|
918 |
{ |
|
919 |
EStateUnchanged, // don't change state |
|
920 |
EDoNothing, // nothing to do |
|
921 |
0 |
|
922 |
} |
|
923 |
}, |
|
924 |
{ |
|
925 |
// |
|
926 |
// filter out any unprocessed codes |
|
927 |
// |
|
928 |
{ |
|
929 |
0, // match any modifier state |
|
930 |
0 |
|
931 |
}, |
|
932 |
{ |
|
933 |
EKeyNull, // dummy value |
|
934 |
EAnyKey // match any key |
|
935 |
}, |
|
936 |
{ |
|
937 |
EStateNormal, // switch back to normal keyboard state |
|
938 |
EDoNothing, // nothing to do |
|
939 |
0 |
|
940 |
} |
|
941 |
} |
|
942 |
}; |
|
943 |
||
944 |
// |
|
945 |
// TO DO: (optional) |
|
946 |
// |
|
947 |
// This table controls which keys change which modifiers; |
|
948 |
// NOTE: the state field in this table is ignored |
|
949 |
// |
|
950 |
||
951 |
LOCAL_D const SFuncTableEntry modifierTable[]= |
|
952 |
{ |
|
953 |
{ |
|
954 |
{ |
|
955 |
EModifierKeyUp, // check key-up modifier flag |
|
956 |
0 // make sure it's zero (i.e. ignore key-up events) |
|
957 |
}, |
|
958 |
{ |
|
959 |
// |
|
960 |
// Here we want to match only the caps-lock key. We specify the |
|
961 |
// keycode we are looking for in the first field, and EMatchKey |
|
962 |
// in the second field |
|
963 |
// |
|
964 |
EKeyCapsLock, // we want to respond to caps-lock key |
|
965 |
EMatchKey // match caps-lock only |
|
966 |
}, |
|
967 |
{ |
|
968 |
EStateUnchanged, // ignored |
|
969 |
EToggleModifier, // function = toggle modifier state |
|
970 |
EModifierCapsLock // this is the modifier to toggle |
|
971 |
} |
|
972 |
}, |
|
973 |
{ |
|
974 |
{ |
|
975 |
EModifierKeyUp, |
|
976 |
0 |
|
977 |
}, |
|
978 |
{ |
|
979 |
EKeyNumLock, // this one matched num-lock |
|
980 |
EMatchKey // match only num-lock |
|
981 |
}, |
|
982 |
{ |
|
983 |
EStateUnchanged, // ignored |
|
984 |
EToggleModifier, // function = toggle modifier state |
|
985 |
EModifierNumLock // this is the modifier to toggle |
|
986 |
} |
|
987 |
}, |
|
988 |
{ |
|
989 |
{ |
|
990 |
EModifierKeyUp, |
|
991 |
0 |
|
992 |
}, |
|
993 |
{ |
|
994 |
EKeyScrollLock, // match scroll-lock key |
|
995 |
EMatchKey |
|
996 |
}, |
|
997 |
{ |
|
998 |
EStateUnchanged, |
|
999 |
EToggleModifier, // function = toggle modifier |
|
1000 |
EModifierScrollLock // modifier to toggle |
|
1001 |
} |
|
1002 |
}, |
|
1003 |
{ |
|
1004 |
{ |
|
1005 |
EModifierKeyUp, |
|
1006 |
0 |
|
1007 |
}, |
|
1008 |
{ |
|
1009 |
EKeyLeftAlt, // match left alt key |
|
1010 |
EMatchKey |
|
1011 |
}, |
|
1012 |
{ |
|
1013 |
EStateUnchanged, // ignored |
|
1014 |
ETurnOnModifier, // function = turn on a modifier |
|
1015 |
EModifierAlt|EModifierLeftAlt // alt turns on this modifier combination |
|
1016 |
} |
|
1017 |
}, |
|
1018 |
{ |
|
1019 |
{ |
|
1020 |
EModifierKeyUp, // goes with previous table, this handles the alt |
|
1021 |
EModifierKeyUp // key being released |
|
1022 |
}, |
|
1023 |
{ |
|
1024 |
EKeyLeftAlt, // match left alt key again |
|
1025 |
EMatchKey |
|
1026 |
}, |
|
1027 |
{ |
|
1028 |
EStateUnchanged, |
|
1029 |
ETurnOffModifier, // function = turn off the modifier |
|
1030 |
EModifierLeftAlt // modifier to turn off |
|
1031 |
} |
|
1032 |
}, |
|
1033 |
{ |
|
1034 |
{ |
|
1035 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1036 |
0 |
|
1037 |
}, |
|
1038 |
{ |
|
1039 |
EKeyLeftFunc, // match left fn key |
|
1040 |
EMatchKey |
|
1041 |
}, |
|
1042 |
{ |
|
1043 |
EStateUnchanged, // ignored |
|
1044 |
ETurnOnModifier, // function = turn on modifier |
|
1045 |
EModifierFunc|EModifierLeftFunc // modifier combination to turn on |
|
1046 |
} |
|
1047 |
}, |
|
1048 |
{ |
|
1049 |
{ |
|
1050 |
EModifierKeyUp, // goes with above table, this matched the |
|
1051 |
EModifierKeyUp // left-fn key up event |
|
1052 |
}, |
|
1053 |
{ |
|
1054 |
EKeyLeftFunc, // match left fn key |
|
1055 |
EMatchKey |
|
1056 |
}, |
|
1057 |
{ |
|
1058 |
EStateUnchanged, // ignored |
|
1059 |
ETurnOffModifier, // function = turn off modifier |
|
1060 |
EModifierLeftFunc // modifier to turn off |
|
1061 |
} |
|
1062 |
}, |
|
1063 |
{ |
|
1064 |
{ |
|
1065 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1066 |
0 |
|
1067 |
}, |
|
1068 |
{ |
|
1069 |
EKeyLeftShift, // match left shift key |
|
1070 |
EMatchKey |
|
1071 |
}, |
|
1072 |
{ |
|
1073 |
EStateUnchanged, // ignored |
|
1074 |
ETurnOnModifier, // function = turn on modifier |
|
1075 |
EModifierShift|EModifierLeftShift // modifier combination to turn on |
|
1076 |
} |
|
1077 |
}, |
|
1078 |
{ |
|
1079 |
{ |
|
1080 |
EModifierKeyUp, // goes with above table, matches left shift |
|
1081 |
EModifierKeyUp // key up event |
|
1082 |
}, |
|
1083 |
{ |
|
1084 |
EKeyLeftShift, // match left shift key |
|
1085 |
EMatchKey |
|
1086 |
}, |
|
1087 |
{ |
|
1088 |
EStateUnchanged, // ignored |
|
1089 |
ETurnOffModifier, // turn off modifier |
|
1090 |
EModifierLeftShift // modifier to turn off |
|
1091 |
} |
|
1092 |
}, |
|
1093 |
{ |
|
1094 |
{ |
|
1095 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1096 |
0 |
|
1097 |
}, |
|
1098 |
{ |
|
1099 |
EKeyLeftCtrl, // match left ctrl key |
|
1100 |
EMatchKey |
|
1101 |
}, |
|
1102 |
{ |
|
1103 |
EStateUnchanged, // ignored |
|
1104 |
ETurnOnModifier, // function = turn on modifier |
|
1105 |
EModifierCtrl|EModifierLeftCtrl // modifier combination to turn on |
|
1106 |
} |
|
1107 |
}, |
|
1108 |
{ |
|
1109 |
{ |
|
1110 |
EModifierKeyUp, // goes with above table, matches left ctrl |
|
1111 |
EModifierKeyUp // key up event |
|
1112 |
}, |
|
1113 |
{ |
|
1114 |
EKeyLeftCtrl, // match left ctrl key |
|
1115 |
EMatchKey |
|
1116 |
}, |
|
1117 |
{ |
|
1118 |
EStateUnchanged, // ignored |
|
1119 |
ETurnOffModifier, // function = turn off modifier |
|
1120 |
EModifierLeftCtrl // modifier to turn off |
|
1121 |
} |
|
1122 |
}, |
|
1123 |
{ |
|
1124 |
{ |
|
1125 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1126 |
0 |
|
1127 |
}, |
|
1128 |
{ |
|
1129 |
EKeyRightAlt, // match right alt key |
|
1130 |
EMatchKey |
|
1131 |
}, |
|
1132 |
{ |
|
1133 |
EStateUnchanged, // ignored |
|
1134 |
ETurnOnModifier, // function = turn on modifier |
|
1135 |
EModifierAlt|EModifierRightAlt // modifier combination to turn on |
|
1136 |
} |
|
1137 |
}, |
|
1138 |
{ |
|
1139 |
{ |
|
1140 |
EModifierKeyUp, // goes with above table, matches right alt |
|
1141 |
EModifierKeyUp // key up event |
|
1142 |
}, |
|
1143 |
{ |
|
1144 |
EKeyRightAlt, // match right alt key |
|
1145 |
EMatchKey |
|
1146 |
}, |
|
1147 |
{ |
|
1148 |
EStateUnchanged, // ignored |
|
1149 |
ETurnOffModifier, // function = turn off modifier |
|
1150 |
EModifierRightAlt // modifier to turn off |
|
1151 |
} |
|
1152 |
}, |
|
1153 |
{ |
|
1154 |
{ |
|
1155 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1156 |
0 |
|
1157 |
}, |
|
1158 |
{ |
|
1159 |
EKeyRightFunc, // match right fn key |
|
1160 |
EMatchKey |
|
1161 |
}, |
|
1162 |
{ |
|
1163 |
EStateUnchanged, // ignored |
|
1164 |
ETurnOnModifier, // function = turn on modifier |
|
1165 |
EModifierFunc|EModifierRightFunc // modifier combination to turn on |
|
1166 |
} |
|
1167 |
}, |
|
1168 |
{ |
|
1169 |
{ |
|
1170 |
EModifierKeyUp, // goes with above table, matches right fn |
|
1171 |
EModifierKeyUp // key up event |
|
1172 |
}, |
|
1173 |
{ |
|
1174 |
EKeyRightFunc, // match right fn key |
|
1175 |
EMatchKey |
|
1176 |
}, |
|
1177 |
{ |
|
1178 |
EStateUnchanged, // ignored |
|
1179 |
ETurnOffModifier, // function = turn off modifier |
|
1180 |
EModifierRightFunc // modifier to turn off |
|
1181 |
} |
|
1182 |
}, |
|
1183 |
{ |
|
1184 |
{ |
|
1185 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1186 |
0 |
|
1187 |
}, |
|
1188 |
{ |
|
1189 |
EKeyRightShift, // match right shift key |
|
1190 |
EMatchKey |
|
1191 |
}, |
|
1192 |
{ |
|
1193 |
EStateUnchanged, // ignored |
|
1194 |
ETurnOnModifier, // function = turn on modifier |
|
1195 |
EModifierShift|EModifierRightShift // modifier combinatoin to turn on |
|
1196 |
} |
|
1197 |
}, |
|
1198 |
{ |
|
1199 |
{ |
|
1200 |
EModifierKeyUp, // goes with above table, handles right shift |
|
1201 |
EModifierKeyUp // key up event |
|
1202 |
}, |
|
1203 |
{ |
|
1204 |
EKeyRightShift, // match right shift key |
|
1205 |
EMatchKey |
|
1206 |
}, |
|
1207 |
{ |
|
1208 |
EStateUnchanged, // ignored |
|
1209 |
ETurnOffModifier, // function = turn off modifier |
|
1210 |
EModifierRightShift // modifier to turn off |
|
1211 |
} |
|
1212 |
}, |
|
1213 |
{ |
|
1214 |
{ |
|
1215 |
EModifierKeyUp, // key down event (key-up flag == 0) |
|
1216 |
0 |
|
1217 |
}, |
|
1218 |
{ |
|
1219 |
EKeyRightCtrl, // match right ctrl key |
|
1220 |
EMatchKey |
|
1221 |
}, |
|
1222 |
{ |
|
1223 |
EStateUnchanged, // ignored |
|
1224 |
ETurnOnModifier, // function = turn on modifier |
|
1225 |
EModifierCtrl|EModifierRightCtrl // modifier combination to turn on |
|
1226 |
} |
|
1227 |
}, |
|
1228 |
{ |
|
1229 |
{ |
|
1230 |
EModifierKeyUp, // goes with above table, matched right ctrl |
|
1231 |
EModifierKeyUp // key up event |
|
1232 |
}, |
|
1233 |
{ |
|
1234 |
EKeyRightCtrl, // match right ctrl key |
|
1235 |
EMatchKey |
|
1236 |
}, |
|
1237 |
{ |
|
1238 |
EStateUnchanged, // ignored |
|
1239 |
ETurnOffModifier, // function = turn off modifier |
|
1240 |
EModifierRightCtrl // modifier to turn off |
|
1241 |
} |
|
1242 |
} |
|
1243 |
}; |
|
1244 |
||
1245 |
||
1246 |
// |
|
1247 |
// TO DO: (optional) |
|
1248 |
// |
|
1249 |
// Tables corresponding to keyboard states. |
|
1250 |
// |
|
1251 |
// There are 13 keyboard states. States 0 to 9 can be used to create alternative |
|
1252 |
// keyboard layouts for entering accented or unusual characters. Switching into |
|
1253 |
// these states is done by a keypress. Implementation of the states is optional |
|
1254 |
// depending on how many special state you want - you may implement 10 states, |
|
1255 |
// you might decide not to implement any. |
|
1256 |
// |
|
1257 |
// State 10 is the normal state. The table for state 10 defines which keypresses |
|
1258 |
// change to other states. |
|
1259 |
// |
|
1260 |
// States 11 and 12 are used when entering the numeric code of a character. State |
|
1261 |
// 11 is for entering a specific number of digits. State 12 is for accepting |
|
1262 |
// digits until Ctrl is released. |
|
1263 |
// |
|
1264 |
// |
|
1265 |
// As before, each SFuncTableEntry entry defines: |
|
1266 |
// - modifier conditions that must be matched |
|
1267 |
// - a keycode match pattern (typically an exact key match) |
|
1268 |
// - the function to perform and new state |
|
1269 |
// |
|
1270 |
// Switching into states 0..9,11,12 is done by entries in table10 |
|
1271 |
// |
|
1272 |
||
1273 |
//LOCAL_D const SFuncTableEntry table0[]= |
|
1274 |
// { |
|
1275 |
// TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1276 |
// }; |
|
1277 |
||
1278 |
LOCAL_D const SFuncTableEntry table1[]= |
|
1279 |
{ |
|
1280 |
// |
|
1281 |
// Table for special keyboard state 1 |
|
1282 |
// This state is entered by pressing Fn+q (see table10) |
|
1283 |
// |
|
1284 |
// The table makes certain keys return accented characters |
|
1285 |
// |
|
1286 |
{ |
|
1287 |
{ |
|
1288 |
// |
|
1289 |
// Function must be release, and this must be a key down event |
|
1290 |
// |
|
1291 |
EModifierFunc|EModifierKeyUp, |
|
1292 |
0 |
|
1293 |
}, |
|
1294 |
{ |
|
1295 |
// |
|
1296 |
// match an 'e' keypress, convert to an ae ligature (æ) |
|
1297 |
// |
|
1298 |
'e', |
|
1299 |
EMatchKeyCaseInsens |
|
1300 |
}, |
|
1301 |
{ |
|
1302 |
EStateNormal, // switch back to state normal (table10) |
|
1303 |
EPassSpecialKeyThru, // turn keypress into a special character |
|
1304 |
ELatin1LcAe // this is the character to pass on |
|
1305 |
} |
|
1306 |
}, |
|
1307 |
{ |
|
1308 |
{ |
|
1309 |
EModifierFunc|EModifierKeyUp, |
|
1310 |
0 |
|
1311 |
}, |
|
1312 |
{ |
|
1313 |
'c', |
|
1314 |
EMatchKeyCaseInsens |
|
1315 |
}, |
|
1316 |
{ |
|
1317 |
EStateNormal, |
|
1318 |
EPassSpecialKeyThru, |
|
1319 |
ELatin1LcCcedilla |
|
1320 |
} |
|
1321 |
}, |
|
1322 |
{ |
|
1323 |
{ |
|
1324 |
EModifierFunc|EModifierKeyUp, |
|
1325 |
0 |
|
1326 |
}, |
|
1327 |
{ |
|
1328 |
's', |
|
1329 |
EMatchKeyCaseInsens |
|
1330 |
}, |
|
1331 |
{ |
|
1332 |
EStateNormal, |
|
1333 |
EPassSpecialKeyThru, |
|
1334 |
ELatin1EsTset |
|
1335 |
} |
|
1336 |
}, |
|
1337 |
{ |
|
1338 |
{ |
|
1339 |
EModifierFunc|EModifierKeyUp, |
|
1340 |
0 |
|
1341 |
}, |
|
1342 |
{ |
|
1343 |
'o', |
|
1344 |
EMatchKeyCaseInsens |
|
1345 |
}, |
|
1346 |
{ |
|
1347 |
EStateNormal, |
|
1348 |
EPassSpecialKeyThru, |
|
1349 |
ELatin1LcOslash |
|
1350 |
} |
|
1351 |
}, |
|
1352 |
{ |
|
1353 |
{ |
|
1354 |
EModifierFunc|EModifierKeyUp, |
|
1355 |
0 |
|
1356 |
}, |
|
1357 |
{ |
|
1358 |
'd', |
|
1359 |
EMatchKeyCaseInsens |
|
1360 |
}, |
|
1361 |
{ |
|
1362 |
EStateNormal, |
|
1363 |
EPassSpecialKeyThru, |
|
1364 |
ELatin1LcThorn |
|
1365 |
} |
|
1366 |
}, |
|
1367 |
{ |
|
1368 |
{ |
|
1369 |
EModifierFunc|EModifierKeyUp, |
|
1370 |
0 |
|
1371 |
}, |
|
1372 |
{ |
|
1373 |
't', |
|
1374 |
EMatchKeyCaseInsens |
|
1375 |
}, |
|
1376 |
{ |
|
1377 |
EStateNormal, |
|
1378 |
EPassSpecialKeyThru, |
|
1379 |
ELatin1LcSoftTh |
|
1380 |
} |
|
1381 |
}, |
|
1382 |
{ |
|
1383 |
{ |
|
1384 |
EModifierFunc|EModifierKeyUp, |
|
1385 |
0 |
|
1386 |
}, |
|
1387 |
{ |
|
1388 |
'l', |
|
1389 |
EMatchKeyCaseInsens |
|
1390 |
}, |
|
1391 |
{ |
|
1392 |
EStateNormal, |
|
1393 |
EPassSpecialKeyThru, |
|
1394 |
ELatin1LeftChevron |
|
1395 |
} |
|
1396 |
}, |
|
1397 |
{ |
|
1398 |
{ |
|
1399 |
EModifierFunc|EModifierKeyUp, |
|
1400 |
0 |
|
1401 |
}, |
|
1402 |
{ |
|
1403 |
'r', |
|
1404 |
EMatchKeyCaseInsens |
|
1405 |
}, |
|
1406 |
{ |
|
1407 |
EStateNormal, |
|
1408 |
EPassSpecialKeyThru, |
|
1409 |
ELatin1RightChevron |
|
1410 |
} |
|
1411 |
}, |
|
1412 |
{ |
|
1413 |
{ |
|
1414 |
EModifierFunc|EModifierKeyUp, |
|
1415 |
0 |
|
1416 |
}, |
|
1417 |
{ |
|
1418 |
'x', |
|
1419 |
EMatchKeyCaseInsens |
|
1420 |
}, |
|
1421 |
{ |
|
1422 |
EStateNormal, |
|
1423 |
EPassSpecialKeyThru, |
|
1424 |
ELatin1InvExclam |
|
1425 |
} |
|
1426 |
}, |
|
1427 |
{ |
|
1428 |
{ |
|
1429 |
EModifierFunc|EModifierKeyUp, |
|
1430 |
0 |
|
1431 |
}, |
|
1432 |
{ |
|
1433 |
'q', |
|
1434 |
EMatchKeyCaseInsens |
|
1435 |
}, |
|
1436 |
{ |
|
1437 |
EStateNormal, |
|
1438 |
EPassSpecialKeyThru, |
|
1439 |
ELatin1InvQuest |
|
1440 |
} |
|
1441 |
}, |
|
1442 |
{ |
|
1443 |
{ |
|
1444 |
EModifierFunc|EModifierKeyUp, |
|
1445 |
0 |
|
1446 |
}, |
|
1447 |
{ |
|
1448 |
'a', |
|
1449 |
EMatchKeyCaseInsens |
|
1450 |
}, |
|
1451 |
{ |
|
1452 |
EStateNormal, |
|
1453 |
EPassSpecialKeyThru, |
|
1454 |
ELatin1LcAo |
|
1455 |
} |
|
1456 |
}, |
|
1457 |
{ |
|
1458 |
{ |
|
1459 |
EModifierFunc|EModifierKeyUp, |
|
1460 |
0 |
|
1461 |
}, |
|
1462 |
{ |
|
1463 |
'p', |
|
1464 |
EMatchKeyCaseInsens |
|
1465 |
}, |
|
1466 |
{ |
|
1467 |
EStateNormal, |
|
1468 |
EPassSpecialKeyThru, |
|
1469 |
ELatin1Pound |
|
1470 |
} |
|
1471 |
}, |
|
1472 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1473 |
}; |
|
1474 |
||
1475 |
LOCAL_D const SFuncTableEntry table2[]= |
|
1476 |
{ |
|
1477 |
// |
|
1478 |
// Table for special keyboard state 2 |
|
1479 |
// This state is entered by pressing Fn+z (see table10) |
|
1480 |
// |
|
1481 |
// The table makes certain keys return accented characters |
|
1482 |
// See table1 for an explanation of the contents |
|
1483 |
// |
|
1484 |
{ |
|
1485 |
{ |
|
1486 |
EModifierFunc|EModifierKeyUp, |
|
1487 |
0 |
|
1488 |
}, |
|
1489 |
{ |
|
1490 |
'a', |
|
1491 |
EMatchKeyCaseInsens |
|
1492 |
}, |
|
1493 |
{ |
|
1494 |
EStateNormal, |
|
1495 |
EPassSpecialKeyThru, |
|
1496 |
ELatin1LcAumlaut |
|
1497 |
} |
|
1498 |
}, |
|
1499 |
{ |
|
1500 |
{ |
|
1501 |
EModifierFunc|EModifierKeyUp, |
|
1502 |
0 |
|
1503 |
}, |
|
1504 |
{ |
|
1505 |
'e', |
|
1506 |
EMatchKeyCaseInsens |
|
1507 |
}, |
|
1508 |
{ |
|
1509 |
EStateNormal, |
|
1510 |
EPassSpecialKeyThru, |
|
1511 |
ELatin1LcEumlaut |
|
1512 |
} |
|
1513 |
}, |
|
1514 |
{ |
|
1515 |
{ |
|
1516 |
EModifierFunc|EModifierKeyUp, |
|
1517 |
0 |
|
1518 |
}, |
|
1519 |
{ |
|
1520 |
'i', |
|
1521 |
EMatchKeyCaseInsens |
|
1522 |
}, |
|
1523 |
{ |
|
1524 |
EStateNormal, |
|
1525 |
EPassSpecialKeyThru, |
|
1526 |
ELatin1LcIumlaut |
|
1527 |
} |
|
1528 |
}, |
|
1529 |
{ |
|
1530 |
{ |
|
1531 |
EModifierFunc|EModifierKeyUp, |
|
1532 |
0 |
|
1533 |
}, |
|
1534 |
{ |
|
1535 |
'o', |
|
1536 |
EMatchKeyCaseInsens |
|
1537 |
}, |
|
1538 |
{ |
|
1539 |
EStateNormal, |
|
1540 |
EPassSpecialKeyThru, |
|
1541 |
ELatin1LcOumlaut |
|
1542 |
} |
|
1543 |
}, |
|
1544 |
{ |
|
1545 |
{ |
|
1546 |
EModifierFunc|EModifierKeyUp, |
|
1547 |
0 |
|
1548 |
}, |
|
1549 |
{ |
|
1550 |
'u', |
|
1551 |
EMatchKeyCaseInsens |
|
1552 |
}, |
|
1553 |
{ |
|
1554 |
EStateNormal, |
|
1555 |
EPassSpecialKeyThru, |
|
1556 |
ELatin1LcUumlaut |
|
1557 |
} |
|
1558 |
}, |
|
1559 |
{ |
|
1560 |
{ |
|
1561 |
EModifierFunc|EModifierKeyUp, |
|
1562 |
0 |
|
1563 |
}, |
|
1564 |
{ |
|
1565 |
'y', |
|
1566 |
EMatchKeyCaseInsens |
|
1567 |
}, |
|
1568 |
{ |
|
1569 |
EStateNormal, |
|
1570 |
EPassSpecialKeyThru, |
|
1571 |
ELatin1LcYumlaut |
|
1572 |
} |
|
1573 |
}, |
|
1574 |
{ |
|
1575 |
{ |
|
1576 |
EModifierFunc|EModifierKeyUp, |
|
1577 |
0 |
|
1578 |
}, |
|
1579 |
{ |
|
1580 |
' ', |
|
1581 |
EMatchKey |
|
1582 |
}, |
|
1583 |
{ |
|
1584 |
EStateNormal, |
|
1585 |
EPassSpecialKeyThru, |
|
1586 |
ELatin1SpaceUmlaut |
|
1587 |
} |
|
1588 |
}, |
|
1589 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1590 |
}; |
|
1591 |
||
1592 |
LOCAL_D const SFuncTableEntry table3[]= |
|
1593 |
{ |
|
1594 |
// |
|
1595 |
// Table for special keyboard state 3 |
|
1596 |
// This state is entered by pressing Fn+x (see table10) |
|
1597 |
// |
|
1598 |
// The table makes certain keys return accented characters |
|
1599 |
// |
|
1600 |
{ |
|
1601 |
{ |
|
1602 |
EModifierFunc|EModifierKeyUp, |
|
1603 |
0 |
|
1604 |
}, |
|
1605 |
{ |
|
1606 |
'a', |
|
1607 |
EMatchKeyCaseInsens |
|
1608 |
}, |
|
1609 |
{ |
|
1610 |
EStateNormal, |
|
1611 |
EPassSpecialKeyThru, |
|
1612 |
ELatin1LcAgrave |
|
1613 |
} |
|
1614 |
}, |
|
1615 |
{ |
|
1616 |
{ |
|
1617 |
EModifierFunc|EModifierKeyUp, |
|
1618 |
0 |
|
1619 |
}, |
|
1620 |
{ |
|
1621 |
'e', |
|
1622 |
EMatchKeyCaseInsens |
|
1623 |
}, |
|
1624 |
{ |
|
1625 |
EStateNormal, |
|
1626 |
EPassSpecialKeyThru, |
|
1627 |
ELatin1LcEgrave |
|
1628 |
} |
|
1629 |
}, |
|
1630 |
{ |
|
1631 |
{ |
|
1632 |
EModifierFunc|EModifierKeyUp, |
|
1633 |
0 |
|
1634 |
}, |
|
1635 |
{ |
|
1636 |
'i', |
|
1637 |
EMatchKeyCaseInsens |
|
1638 |
}, |
|
1639 |
{ |
|
1640 |
EStateNormal, |
|
1641 |
EPassSpecialKeyThru, |
|
1642 |
ELatin1LcIgrave |
|
1643 |
} |
|
1644 |
}, |
|
1645 |
{ |
|
1646 |
{ |
|
1647 |
EModifierFunc|EModifierKeyUp, |
|
1648 |
0 |
|
1649 |
}, |
|
1650 |
{ |
|
1651 |
'o', |
|
1652 |
EMatchKeyCaseInsens |
|
1653 |
}, |
|
1654 |
{ |
|
1655 |
EStateNormal, |
|
1656 |
EPassSpecialKeyThru, |
|
1657 |
ELatin1LcOgrave |
|
1658 |
} |
|
1659 |
}, |
|
1660 |
{ |
|
1661 |
{ |
|
1662 |
EModifierFunc|EModifierKeyUp, |
|
1663 |
0 |
|
1664 |
}, |
|
1665 |
{ |
|
1666 |
'u', |
|
1667 |
EMatchKeyCaseInsens |
|
1668 |
}, |
|
1669 |
{ |
|
1670 |
EStateNormal, |
|
1671 |
EPassSpecialKeyThru, |
|
1672 |
ELatin1LcUgrave |
|
1673 |
} |
|
1674 |
}, |
|
1675 |
{ |
|
1676 |
{ |
|
1677 |
EModifierFunc|EModifierKeyUp, |
|
1678 |
0 |
|
1679 |
}, |
|
1680 |
{ |
|
1681 |
' ', |
|
1682 |
EMatchKey |
|
1683 |
}, |
|
1684 |
{ |
|
1685 |
EStateNormal, |
|
1686 |
EPassSpecialKeyThru, |
|
1687 |
ELatin1SpaceGrave |
|
1688 |
} |
|
1689 |
}, |
|
1690 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1691 |
}; |
|
1692 |
||
1693 |
LOCAL_D const SFuncTableEntry table4[]= |
|
1694 |
{ |
|
1695 |
// |
|
1696 |
// Table for special keyboard state 4 |
|
1697 |
// This state is entered by pressing Fn+c (see table10) |
|
1698 |
// |
|
1699 |
// The table makes certain keys return accented characters |
|
1700 |
// |
|
1701 |
{ |
|
1702 |
{ |
|
1703 |
EModifierFunc|EModifierKeyUp, |
|
1704 |
0 |
|
1705 |
}, |
|
1706 |
{ |
|
1707 |
'a', |
|
1708 |
EMatchKeyCaseInsens |
|
1709 |
}, |
|
1710 |
{ |
|
1711 |
EStateNormal, |
|
1712 |
EPassSpecialKeyThru, |
|
1713 |
ELatin1LcAacute |
|
1714 |
} |
|
1715 |
}, |
|
1716 |
{ |
|
1717 |
{ |
|
1718 |
EModifierFunc|EModifierKeyUp, |
|
1719 |
0 |
|
1720 |
}, |
|
1721 |
{ |
|
1722 |
'e', |
|
1723 |
EMatchKeyCaseInsens |
|
1724 |
}, |
|
1725 |
{ |
|
1726 |
EStateNormal, |
|
1727 |
EPassSpecialKeyThru, |
|
1728 |
ELatin1LcEacute |
|
1729 |
} |
|
1730 |
}, |
|
1731 |
{ |
|
1732 |
{ |
|
1733 |
EModifierFunc|EModifierKeyUp, |
|
1734 |
0 |
|
1735 |
}, |
|
1736 |
{ |
|
1737 |
'i', |
|
1738 |
EMatchKeyCaseInsens |
|
1739 |
}, |
|
1740 |
{ |
|
1741 |
EStateNormal, |
|
1742 |
EPassSpecialKeyThru, |
|
1743 |
ELatin1LcIacute |
|
1744 |
} |
|
1745 |
}, |
|
1746 |
{ |
|
1747 |
{ |
|
1748 |
EModifierFunc|EModifierKeyUp, |
|
1749 |
0 |
|
1750 |
}, |
|
1751 |
{ |
|
1752 |
'o', |
|
1753 |
EMatchKeyCaseInsens |
|
1754 |
}, |
|
1755 |
{ |
|
1756 |
EStateNormal, |
|
1757 |
EPassSpecialKeyThru, |
|
1758 |
ELatin1LcOacute |
|
1759 |
} |
|
1760 |
}, |
|
1761 |
{ |
|
1762 |
{ |
|
1763 |
EModifierFunc|EModifierKeyUp, |
|
1764 |
0 |
|
1765 |
}, |
|
1766 |
{ |
|
1767 |
'u', |
|
1768 |
EMatchKeyCaseInsens |
|
1769 |
}, |
|
1770 |
{ |
|
1771 |
EStateNormal, |
|
1772 |
EPassSpecialKeyThru, |
|
1773 |
ELatin1LcUacute |
|
1774 |
} |
|
1775 |
}, |
|
1776 |
{ |
|
1777 |
{ |
|
1778 |
EModifierFunc|EModifierKeyUp, |
|
1779 |
0 |
|
1780 |
}, |
|
1781 |
{ |
|
1782 |
'y', |
|
1783 |
EMatchKeyCaseInsens |
|
1784 |
}, |
|
1785 |
{ |
|
1786 |
EStateNormal, |
|
1787 |
EPassSpecialKeyThru, |
|
1788 |
ELatin1LcYacute |
|
1789 |
} |
|
1790 |
}, |
|
1791 |
{ |
|
1792 |
{ |
|
1793 |
EModifierFunc|EModifierKeyUp, |
|
1794 |
0 |
|
1795 |
}, |
|
1796 |
{ |
|
1797 |
' ', |
|
1798 |
EMatchKey |
|
1799 |
}, |
|
1800 |
{ |
|
1801 |
EStateNormal, |
|
1802 |
EPassSpecialKeyThru, |
|
1803 |
ELatin1LcSpaceAcute |
|
1804 |
} |
|
1805 |
}, |
|
1806 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1807 |
}; |
|
1808 |
||
1809 |
LOCAL_D const SFuncTableEntry table5[]= |
|
1810 |
{ |
|
1811 |
// |
|
1812 |
// Table for special keyboard state 5 |
|
1813 |
// This state is entered by pressing Fn+v (see table10) |
|
1814 |
// |
|
1815 |
// The table makes certain keys return accented characters |
|
1816 |
// |
|
1817 |
{ |
|
1818 |
{ |
|
1819 |
EModifierFunc|EModifierKeyUp, |
|
1820 |
0 |
|
1821 |
}, |
|
1822 |
{ |
|
1823 |
'a', |
|
1824 |
EMatchKeyCaseInsens |
|
1825 |
}, |
|
1826 |
{ |
|
1827 |
EStateNormal, |
|
1828 |
EPassSpecialKeyThru, |
|
1829 |
ELatin1LcAtilde |
|
1830 |
} |
|
1831 |
}, |
|
1832 |
{ |
|
1833 |
{ |
|
1834 |
EModifierFunc|EModifierKeyUp, |
|
1835 |
0 |
|
1836 |
}, |
|
1837 |
{ |
|
1838 |
'n', |
|
1839 |
EMatchKeyCaseInsens |
|
1840 |
}, |
|
1841 |
{ |
|
1842 |
EStateNormal, |
|
1843 |
EPassSpecialKeyThru, |
|
1844 |
ELatin1LcNtilde |
|
1845 |
} |
|
1846 |
}, |
|
1847 |
{ |
|
1848 |
{ |
|
1849 |
EModifierFunc|EModifierKeyUp, |
|
1850 |
0 |
|
1851 |
}, |
|
1852 |
{ |
|
1853 |
'o', |
|
1854 |
EMatchKeyCaseInsens |
|
1855 |
}, |
|
1856 |
{ |
|
1857 |
EStateNormal, |
|
1858 |
EPassSpecialKeyThru, |
|
1859 |
ELatin1LcOtilde |
|
1860 |
} |
|
1861 |
}, |
|
1862 |
{ |
|
1863 |
{ |
|
1864 |
EModifierFunc|EModifierKeyUp, |
|
1865 |
0 |
|
1866 |
}, |
|
1867 |
{ |
|
1868 |
' ', |
|
1869 |
EMatchKey |
|
1870 |
}, |
|
1871 |
{ |
|
1872 |
EStateNormal, |
|
1873 |
EPassSpecialKeyThru, |
|
1874 |
ELatin1LcSpaceTilde |
|
1875 |
} |
|
1876 |
}, |
|
1877 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1878 |
}; |
|
1879 |
||
1880 |
LOCAL_D const SFuncTableEntry table6[]= |
|
1881 |
{ |
|
1882 |
// |
|
1883 |
// Table for special keyboard state 6 |
|
1884 |
// This state is entered by pressing Fn+b (see table6) |
|
1885 |
// |
|
1886 |
// The table makes certain keys return accented characters |
|
1887 |
// |
|
1888 |
{ |
|
1889 |
{ |
|
1890 |
EModifierFunc|EModifierKeyUp, |
|
1891 |
0 |
|
1892 |
}, |
|
1893 |
{ |
|
1894 |
'a', |
|
1895 |
EMatchKeyCaseInsens |
|
1896 |
}, |
|
1897 |
{ |
|
1898 |
EStateNormal, |
|
1899 |
EPassSpecialKeyThru, |
|
1900 |
ELatin1LcAcirc |
|
1901 |
} |
|
1902 |
}, |
|
1903 |
{ |
|
1904 |
{ |
|
1905 |
EModifierFunc|EModifierKeyUp, |
|
1906 |
0 |
|
1907 |
}, |
|
1908 |
{ |
|
1909 |
'e', |
|
1910 |
EMatchKeyCaseInsens |
|
1911 |
}, |
|
1912 |
{ |
|
1913 |
EStateNormal, |
|
1914 |
EPassSpecialKeyThru, |
|
1915 |
ELatin1LcEcirc |
|
1916 |
} |
|
1917 |
}, |
|
1918 |
{ |
|
1919 |
{ |
|
1920 |
EModifierFunc|EModifierKeyUp, |
|
1921 |
0 |
|
1922 |
}, |
|
1923 |
{ |
|
1924 |
'i', |
|
1925 |
EMatchKeyCaseInsens |
|
1926 |
}, |
|
1927 |
{ |
|
1928 |
EStateNormal, |
|
1929 |
EPassSpecialKeyThru, |
|
1930 |
ELatin1LcIcirc |
|
1931 |
} |
|
1932 |
}, |
|
1933 |
{ |
|
1934 |
{ |
|
1935 |
EModifierFunc|EModifierKeyUp, |
|
1936 |
0 |
|
1937 |
}, |
|
1938 |
{ |
|
1939 |
'o', |
|
1940 |
EMatchKeyCaseInsens |
|
1941 |
}, |
|
1942 |
{ |
|
1943 |
EStateNormal, |
|
1944 |
EPassSpecialKeyThru, |
|
1945 |
ELatin1LcOcirc |
|
1946 |
} |
|
1947 |
}, |
|
1948 |
{ |
|
1949 |
{ |
|
1950 |
EModifierFunc|EModifierKeyUp, |
|
1951 |
0 |
|
1952 |
}, |
|
1953 |
{ |
|
1954 |
'u', |
|
1955 |
EMatchKeyCaseInsens |
|
1956 |
}, |
|
1957 |
{ |
|
1958 |
EStateNormal, |
|
1959 |
EPassSpecialKeyThru, |
|
1960 |
ELatin1LcUcirc |
|
1961 |
} |
|
1962 |
}, |
|
1963 |
{ |
|
1964 |
{ |
|
1965 |
EModifierFunc|EModifierKeyUp, |
|
1966 |
0 |
|
1967 |
}, |
|
1968 |
{ |
|
1969 |
' ', |
|
1970 |
EMatchKey |
|
1971 |
}, |
|
1972 |
{ |
|
1973 |
EStateNormal, |
|
1974 |
EPassSpecialKeyThru, |
|
1975 |
ELatin1LcSpaceCirc |
|
1976 |
} |
|
1977 |
}, |
|
1978 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1979 |
}; |
|
1980 |
||
1981 |
// |
|
1982 |
// TO DO: (optional) |
|
1983 |
// |
|
1984 |
// State 7,8,9 aren't used in this example. |
|
1985 |
// You can implement them if you want more special states |
|
1986 |
// |
|
1987 |
||
1988 |
//LOCAL_D const SFuncTableEntry table7[]= |
|
1989 |
// { |
|
1990 |
// TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1991 |
// }; |
|
1992 |
||
1993 |
//LOCAL_D const SFuncTableEntry table8[]= |
|
1994 |
// { |
|
1995 |
// TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
1996 |
// }; |
|
1997 |
||
1998 |
//LOCAL_D const SFuncTableEntry table9[]= |
|
1999 |
// { |
|
2000 |
// TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
2001 |
// }; |
|
2002 |
||
2003 |
||
2004 |
LOCAL_D const SFuncTableEntry table10[]= |
|
2005 |
{ |
|
2006 |
// |
|
2007 |
// TO DO: (optional) |
|
2008 |
// |
|
2009 |
// Table keyboard state 10 - the normal state |
|
2010 |
// |
|
2011 |
// This table controls which keys switch into the special states |
|
2012 |
// 0-9, 11 and 12. |
|
2013 |
// |
|
2014 |
||
2015 |
{ |
|
2016 |
// |
|
2017 |
// Make sure key-up events are ignored by handling them first and |
|
2018 |
// doing nothing |
|
2019 |
// |
|
2020 |
{ |
|
2021 |
EModifierKeyUp, |
|
2022 |
EModifierKeyUp |
|
2023 |
}, |
|
2024 |
{ |
|
2025 |
EKeyNull, |
|
2026 |
EAnyKey |
|
2027 |
}, |
|
2028 |
{ |
|
2029 |
EStateUnchanged, |
|
2030 |
EDoNothing, |
|
2031 |
0 |
|
2032 |
} |
|
2033 |
}, |
|
2034 |
{ |
|
2035 |
// |
|
2036 |
// Check for ctrl-number presses |
|
2037 |
// This will enter state EStateCtrlDigits (state 12) which allows |
|
2038 |
// entry of a numeric keycode |
|
2039 |
// |
|
2040 |
{ |
|
2041 |
EModifierCtrl|EModifierFunc|EModifierKeyUp, |
|
2042 |
EModifierCtrl |
|
2043 |
}, |
|
2044 |
{ |
|
2045 |
EKeyNull, |
|
2046 |
EAnyDecimalDigit |
|
2047 |
}, |
|
2048 |
{ |
|
2049 |
EStateDerivedFromDigitEntered, |
|
2050 |
EAddOnCtrlDigit, |
|
2051 |
0 |
|
2052 |
} |
|
2053 |
}, |
|
2054 |
{ |
|
2055 |
// |
|
2056 |
// Any other key events that have not been trapped are just |
|
2057 |
// passed through unchanged |
|
2058 |
// |
|
2059 |
{ |
|
2060 |
0, |
|
2061 |
0 |
|
2062 |
}, |
|
2063 |
{ |
|
2064 |
EKeyNull, |
|
2065 |
EAnyKey |
|
2066 |
}, |
|
2067 |
{ |
|
2068 |
EStateUnchanged, |
|
2069 |
EPassKeyThru, |
|
2070 |
0 |
|
2071 |
} |
|
2072 |
} |
|
2073 |
}; |
|
2074 |
||
2075 |
//LOCAL_D const SFuncTableEntry table11[]= |
|
2076 |
// { |
|
2077 |
// TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
2078 |
// }; |
|
2079 |
||
2080 |
LOCAL_D const SFuncTableEntry table12[]= |
|
2081 |
{ |
|
2082 |
// |
|
2083 |
// Table 12 handles entring digit codes. The keyboard will remain in this |
|
2084 |
// state until the Ctrl key is released |
|
2085 |
// |
|
2086 |
{ |
|
2087 |
{ |
|
2088 |
// |
|
2089 |
// Look for a key up event |
|
2090 |
// |
|
2091 |
EModifierKeyUp, |
|
2092 |
EModifierKeyUp |
|
2093 |
}, |
|
2094 |
{ |
|
2095 |
// |
|
2096 |
// Match either left or right Ctrl key (i.e. this matches a Ctrl key release) |
|
2097 |
// |
|
2098 |
EKeyLeftCtrl, |
|
2099 |
EMatchLeftOrRight |
|
2100 |
}, |
|
2101 |
{ |
|
2102 |
EStateNormal, // return to normal state (table10) |
|
2103 |
EPassCtrlDigitsThru, // and pass through the numeric code we have accumulated |
|
2104 |
0 |
|
2105 |
} |
|
2106 |
}, |
|
2107 |
TABLE_ENTRY_ANOTHER_CTRL_DIGIT |
|
2108 |
}; |
|
2109 |
||
2110 |
||
2111 |
// |
|
2112 |
// TO DO: (optional) |
|
2113 |
// |
|
2114 |
// Array of state control tables above. If a state is not used set the array |
|
2115 |
// size to zero and the pointer to NULL |
|
2116 |
// |
|
2117 |
// The tables must be declared here in order from table 0 to table 12 |
|
2118 |
// |
|
2119 |
LOCAL_D const SFuncTable genFuncTables[]= |
|
2120 |
{ |
|
2121 |
{ |
|
2122 |
// |
|
2123 |
// state 0 |
|
2124 |
// |
|
2125 |
0, // state 0 not used, size = 0 |
|
2126 |
NULL // state 0 not used, pointer = NULL |
|
2127 |
}, |
|
2128 |
{ |
|
2129 |
// |
|
2130 |
// state 1 |
|
2131 |
// |
|
2132 |
ARRAY_LENGTH(table1), // size of table 1 |
|
2133 |
&table1[0] // pointer to table 1 |
|
2134 |
}, |
|
2135 |
{ |
|
2136 |
// |
|
2137 |
// state 2 |
|
2138 |
// |
|
2139 |
ARRAY_LENGTH(table2), |
|
2140 |
&table2[0] |
|
2141 |
}, |
|
2142 |
{ |
|
2143 |
// |
|
2144 |
// state 3 |
|
2145 |
// |
|
2146 |
ARRAY_LENGTH(table3), |
|
2147 |
&table3[0] |
|
2148 |
}, |
|
2149 |
{ |
|
2150 |
// |
|
2151 |
// state 4 |
|
2152 |
// |
|
2153 |
ARRAY_LENGTH(table4), |
|
2154 |
&table4[0] |
|
2155 |
}, |
|
2156 |
{ |
|
2157 |
// |
|
2158 |
// state 5 |
|
2159 |
// |
|
2160 |
ARRAY_LENGTH(table5), |
|
2161 |
&table5[0] |
|
2162 |
}, |
|
2163 |
{ |
|
2164 |
// |
|
2165 |
// state 6 |
|
2166 |
// |
|
2167 |
ARRAY_LENGTH(table6), |
|
2168 |
&table6[0] |
|
2169 |
}, |
|
2170 |
{ |
|
2171 |
// |
|
2172 |
// state 7 |
|
2173 |
// |
|
2174 |
0, |
|
2175 |
NULL |
|
2176 |
}, |
|
2177 |
{ |
|
2178 |
// |
|
2179 |
// state 8 |
|
2180 |
// |
|
2181 |
0, |
|
2182 |
NULL |
|
2183 |
}, |
|
2184 |
{ |
|
2185 |
// |
|
2186 |
// state 9 |
|
2187 |
// |
|
2188 |
0, |
|
2189 |
NULL |
|
2190 |
}, |
|
2191 |
{ |
|
2192 |
// |
|
2193 |
// state 10 |
|
2194 |
// |
|
2195 |
ARRAY_LENGTH(table10), |
|
2196 |
&table10[0] |
|
2197 |
}, |
|
2198 |
{ |
|
2199 |
// |
|
2200 |
// state 11 |
|
2201 |
// |
|
2202 |
0, |
|
2203 |
NULL |
|
2204 |
}, |
|
2205 |
{ |
|
2206 |
// |
|
2207 |
// state 12 |
|
2208 |
// |
|
2209 |
ARRAY_LENGTH(table12), |
|
2210 |
&table12[0] |
|
2211 |
} |
|
2212 |
}; |
|
2213 |
||
2214 |
||
2215 |
// |
|
2216 |
// Root of the state modifier tables |
|
2217 |
// |
|
2218 |
LOCAL_D const SFuncTables FuncTables= |
|
2219 |
{ |
|
2220 |
{ |
|
2221 |
// |
|
2222 |
// The default processing table |
|
2223 |
// |
|
2224 |
ARRAY_LENGTH(defaultTable), |
|
2225 |
&defaultTable[0] |
|
2226 |
}, |
|
2227 |
{ |
|
2228 |
// |
|
2229 |
// The modifier control table |
|
2230 |
// |
|
2231 |
ARRAY_LENGTH(modifierTable), |
|
2232 |
&modifierTable[0] |
|
2233 |
}, |
|
2234 |
// |
|
2235 |
// The state control tables |
|
2236 |
// |
|
2237 |
ARRAY_LENGTH(genFuncTables), |
|
2238 |
&genFuncTables[0] |
|
2239 |
}; |
|
2240 |
||
2241 |
||
2242 |
// |
|
2243 |
// The following exported functions give the key translator access to |
|
2244 |
// the control tables above |
|
2245 |
// |
|
2246 |
EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount, |
|
2247 |
TInt &aMaximumCtrlDigitsMaxCount) |
|
2248 |
{ |
|
2249 |
aRadix=EDecimal; |
|
2250 |
aCtrlDigitsTermination=ETerminationByCtrlUp; |
|
2251 |
aDefaultCtrlDigitsMaxCount=3; |
|
2252 |
aMaximumCtrlDigitsMaxCount=10; |
|
2253 |
} |
|
2254 |
||
2255 |
EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables) |
|
2256 |
{ |
|
2257 |
aFuncTables=FuncTables; |
|
2258 |
} |
|
2259 |
||
2260 |
EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode, |
|
2261 |
SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes) |
|
2262 |
{ |
|
2263 |
aConvTable=ConvTable; |
|
2264 |
aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode; |
|
2265 |
aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode; |
|
2266 |
aKeypadScanCode=ConvTableKeypadScanCodes; |
|
2267 |
aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes; |
|
2268 |
} |