2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Library header for keymap
9 /****************************************************************************************/
11 #include <proto/exec.h>
12 #include <exec/resident.h>
13 #include <exec/execbase.h>
14 #include <exec/memory.h>
15 #include <aros/symbolsets.h>
16 #include LC_LIBDEFS_FILE
17 #include "keymap_intern.h"
19 /****************************************************************************************/
21 extern struct KeyMap def_km
;
24 struct KeymapBase
*DebugKeymapBase
;
27 /****************************************************************************************/
29 static struct KeyMapNode
*AddKeymap(char *name
, struct KeyMap
*data
, struct KeymapBase
*LIBBASE
)
31 struct KeyMapNode
*kmn
= AllocMem(sizeof(struct KeyMapNode
), MEMF_CLEAR
| MEMF_PUBLIC
);
35 kmn
->kn_Node
.ln_Name
= name
;
36 CopyMem(data
, &kmn
->kn_KeyMap
, sizeof(struct KeyMap
));
39 * We are being called under Forbid(), so I don't have to arbitrate
40 * That notwithstanding, if keymap resource or exec library loading
41 * ever become semaphore based, there may be some problems.
43 AddTail(&(LIBBASE
->KeymapResource
.kr_List
), &kmn
->kn_Node
);
48 static int KeymapInit(LIBBASETYPEPTR LIBBASE
)
51 DebugKeymapBase
= LIBBASE
;
54 LIBBASE
->DefaultKeymap
= &def_km
;
56 /* Initialize and add the keymap.resource */
57 LIBBASE
->KeymapResource
.kr_Node
.ln_Type
= NT_RESOURCE
;
58 LIBBASE
->KeymapResource
.kr_Node
.ln_Name
= "keymap.resource";
59 NEWLIST( &(LIBBASE
->KeymapResource
.kr_List
) );
60 AddResource(&LIBBASE
->KeymapResource
);
62 /* AmigaOS default built-in keymap has "usa" name */
63 if (!AddKeymap("usa", &def_km
, LIBBASE
))
67 /* Add ROM built-in usa1 keymap, keeps WB3.0 C:IPrefs quiet
68 * TODO: add correct keymap instead of using default keymap
70 AddKeymap("usa1", &def_km
, LIBBASE
);
76 /****************************************************************************************/
78 ADD2INITLIB(KeymapInit
, 0);