2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Commodities initialization code.
10 #ifndef COMMODITIES_BASE_H
14 #include <proto/exec.h>
17 #include <exec/memory.h>
19 #ifndef DEVICES_INPUTEVENT_H
20 #include <devices/inputevent.h>
24 static ULONG Extensions
[] =
27 sizeof(struct InputXpression
), /* CX_FILTER */
28 0, /* CX_TYPEFILTER */
29 sizeof(struct SendExt
), /* CX_SENDER */
30 sizeof(struct SignalExt
), /* CX_SIGNAL */
32 sizeof(struct BrokerExt
), /* CX_BROKER */
34 sizeof(struct CustomExt
), /* CX_CUSTOM */
39 VOID
FreeCxStructure(APTR obj
, int type
, struct Library
*CxBase
)
53 FreeCxStructure(((CxMsg
*)obj
)->cxm_Data
, CX_INPUTEVENT
, CxBase
);
58 if(((struct InputEvent
*)obj
)->ie_Class
== IECLASS_NEWPOINTERPOS
&&
59 (((struct InputEvent
*)obj
)->ie_SubClass
== IESUBCLASS_TABLET
||
60 ((struct InputEvent
*)obj
)->ie_SubClass
== IESUBCLASS_NEWTABLET
||
61 ((struct InputEvent
*)obj
)->ie_SubClass
== IESUBCLASS_PIXEL
))
63 FreeVec(((struct InputEvent
*)obj
)->ie_EventAddress
);
66 FreeMem(obj
, sizeof(struct GeneratedInputEvent
));
72 APTR
AllocCxStructure(LONG type
, LONG objtype
, struct Library
*CxBase
)
81 tempObj
= (CxObj
*)AllocVec(sizeof(CxObj
) + Extensions
[objtype
],
82 MEMF_CLEAR
| MEMF_PUBLIC
);
84 tempObj
->co_Ext
.co_FilterIX
= (APTR
)(tempObj
+ 1);
86 NEWLIST(&tempObj
->co_ObjList
);
88 /* This is done to make it easy for Exchange */
89 if (objtype
== CX_BROKER
)
91 tempObj
->co_Node
.ln_Name
= (char *)&tempObj
->co_Ext
.co_BExt
->bext_Name
;
102 tempMsg
= AllocVec(sizeof(CxMsg
), MEMF_CLEAR
| MEMF_PUBLIC
);
106 tempMsg
->cxm_Data
= NULL
;
107 tempMsg
->cxm_Type
= CXM_COMMAND
;
108 tempMsg
->cxm_Message
.mn_ReplyPort
= &GPB(CxBase
)->cx_MsgPort
;
109 tempMsg
->cxm_Message
.mn_Length
= sizeof(CxMsg
);
110 temp
= (APTR
)tempMsg
;
116 tempMsg
= AllocVec(sizeof(CxMsg
), MEMF_CLEAR
| MEMF_PUBLIC
);
120 tempMsg
->cxm_Type
= CXM_IEVENT
;
121 tempMsg
->cxm_Data
= AllocCxStructure(CX_INPUTEVENT
, 0, CxBase
);
122 tempMsg
->cxm_Message
.mn_ReplyPort
= &GPB(CxBase
)->cx_MsgPort
;
123 tempMsg
->cxm_Message
.mn_Length
= sizeof(CxMsg
);
125 if (tempMsg
->cxm_Data
== NULL
)
131 temp
= (APTR
)tempMsg
;
141 temp
= AllocMem(sizeof(struct GeneratedInputEvent
), MEMF_CLEAR
| MEMF_PUBLIC
);