2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <aros/symbolsets.h>
9 #include <hidd/mouse.h>
10 #include <proto/alib.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
16 /* Class initialization and destruction */
17 #define SysBase LIBBASE->csd.cs_SysBase
18 #define OOPBase LIBBASE->csd.cs_OOPBase
20 #define HWBase LIBBASE->csd.hwMethodBase
22 static int Mouse_InitClass(struct mousebase
*LIBBASE
)
24 D(bug("[Mouse] base class initialization\n"));
26 LIBBASE
->csd
.cs_UtilityBase
= OpenLibrary("utility.library", 36);
27 if (!LIBBASE
->csd
.cs_UtilityBase
)
30 LIBBASE
->csd
.hwAttrBase
= OOP_ObtainAttrBase(IID_HW
);
31 LIBBASE
->csd
.hiddMouseAB
= OOP_ObtainAttrBase(IID_Hidd_Mouse
);
32 LIBBASE
->csd
.driverdataAB
= OOP_ObtainAttrBase(IID_DriverData
);
33 LIBBASE
->csd
.hwMethodBase
= OOP_GetMethodID(IID_HW
, 0);
35 if (LIBBASE
->csd
.hwAttrBase
&& LIBBASE
->csd
.hiddMouseAB
&&
36 LIBBASE
->csd
.driverdataAB
)
38 OOP_Object
*root
= OOP_NewObject(NULL
, CLID_HW_Root
, NULL
);
40 NewList((struct List
*)&LIBBASE
->csd
.callbacks
);
42 if (HW_AddDriver(root
, LIBBASE
->csd
.hwClass
, NULL
))
44 D(bug("[Mouse] Everything OK\n"));
52 static int Mouse_ExpungeClass(struct mousebase
*LIBBASE
)
54 D(bug("[Mouse] Base Class destruction\n"));
56 if (LIBBASE
->csd
.driverdataAB
)
57 OOP_ReleaseAttrBase(IID_DriverData
);
58 if (LIBBASE
->csd
.hiddMouseAB
)
59 OOP_ReleaseAttrBase(IID_Hidd_Mouse
);
60 if (LIBBASE
->csd
.hwAttrBase
)
61 OOP_ReleaseAttrBase(IID_HW
);
63 if (LIBBASE
->csd
.cs_UtilityBase
)
64 CloseLibrary(LIBBASE
->csd
.cs_UtilityBase
);
69 ADD2INITLIB(Mouse_InitClass
, 0)
70 ADD2EXPUNGELIB(Mouse_ExpungeClass
, 0)