2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
8 #include <devices/inputevent.h>
9 #include <devices/keymap.h>
11 #include <proto/keymap.h>
12 #define __NOLIBBASE__ 1
13 #include <proto/timer.h>
15 #include <aros/debug.h>
17 /*****************************************************************************
20 #include <proto/commodities.h>
22 AROS_LH3(BOOL
, InvertKeyMap
,
26 AROS_LHA(ULONG
, ansiCode
, D0
),
27 AROS_LHA(struct InputEvent
*, event
, A0
),
28 AROS_LHA(struct KeyMap
*, km
, A1
),
32 struct Library
*, CxBase
, 29, Commodities
)
36 Translate a given ANSI character code to an InputEvent. The InputEvent
37 pointed to by 'event' is initialized to match the 'ansiCode'. The
38 translation is done using the keymap 'km'. If 'km' is NULL, the default
39 system keymap is used.
43 ansiCode - the ANSI character code to be translated
44 event - the inputevent that will contain the translation
45 km - keymap used for the translation (if 'km' is NULL the system
46 default keymap is used).
50 TRUE if the translation was successful, otherwise FALSE.
58 Only one-deep dead keys are handled, for instance <alt f>e. It doesn't
59 look up the high key map (keycodes with scan codes greater than 0x40).
69 ******************************************************************************/
75 char str
[2] = { 0, 0 };
78 event
->ie_SubClass
= 0;
80 GetSysTime(&event
->ie_TimeStamp
);
82 event
->ie_EventAddress
= NULL
;
83 event
->ie_Class
= IECLASS_RAWKEY
;
85 k
= MapANSI((STRPTR
) &str
, 1, (STRPTR
) &buf
, 3, km
);
89 case 1 : /* One code / qualifier */
90 event
->ie_Prev1DownCode
= 0;
91 event
->ie_Prev1DownQual
= 0;
92 D(bug("Buf 0: %i\n", buf
[0]));
93 event
->ie_Code
= (WORD
)(buf
[0]);
94 event
->ie_Qualifier
= (WORD
) buf
[1];
98 case 2 : /* Two codes / qualifiers */
99 event
->ie_Prev1DownCode
= buf
[0];
100 event
->ie_Prev1DownQual
= buf
[1];
101 event
->ie_Code
= (WORD
) buf
[2];
102 event
->ie_Qualifier
= (WORD
) buf
[3];
107 return FALSE
; /* Error mapping ANSI */