2 Copyright © 1995-2006, 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 int KeymapInit(LIBBASETYPEPTR LIBBASE
)
32 DebugKeymapBase
= LIBBASE
;
35 LIBBASE
->DefaultKeymap
= &def_km
;
37 /* Initialize and add the keymap.resource */
39 LIBBASE
->DefKeymapNode
= AllocMem(sizeof (struct KeyMapNode
), MEMF_PUBLIC
);
40 if (!LIBBASE
->DefKeymapNode
)
43 /* Initialise the keymap.resource */
44 LIBBASE
->KeymapResource
.kr_Node
.ln_Type
= NT_RESOURCE
;
45 LIBBASE
->KeymapResource
.kr_Node
.ln_Name
= "keymap.resource";
46 NEWLIST( &(LIBBASE
->KeymapResource
.kr_List
) );
47 AddResource(&LIBBASE
->KeymapResource
);
49 /* Copy default keymap into DefKeymapNode */
50 CopyMem(&def_km
, &(LIBBASE
->DefKeymapNode
->kn_KeyMap
), sizeof (struct KeyMap
));
52 LIBBASE
->DefKeymapNode
->kn_Node
.ln_Name
= "default keymap";
55 We are being called under Forbid(), so I don't have to arbitrate
56 That notwithstanding, if keymap resource or exec library loading
57 ever become semaphore based, there may be some problems.
59 AddTail( &(LIBBASE
->KeymapResource
.kr_List
), &(LIBBASE
->DefKeymapNode
->kn_Node
));
61 /* You would return NULL if the init failed */
65 /****************************************************************************************/
67 ADD2INITLIB(KeymapInit
, 0);