revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / arch / m68k-amiga / hidd / mouse / mouse_init.c
blob81c616c61f293ca9cc56c009fae5e311a8394d1c
1 /*
2 Copyright © 1995-2019, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
7 #include <aros/debug.h>
9 #include <aros/symbolsets.h>
10 #include <proto/oop.h>
12 #include <hidd/hidd.h>
13 #include <hidd/mouse.h>
15 #include "mouse.h"
17 #undef MSD
18 #define MSD(cl) msd
20 static int AmigaMouse_Init(struct mousebase *LIBBASE)
22 struct mouse_staticdata *msd = &LIBBASE->msd;
23 struct OOP_ABDescr attrbases[] =
25 { IID_Hidd, &HiddAttrBase },
26 { IID_Hidd_Mouse, &HiddMouseAB },
27 { NULL , NULL }
29 OOP_Object *ms;
30 OOP_Object *drv = NULL;
32 EnterFunc(bug("AmigaMouse_Init\n"));
34 InitSemaphore(&msd->sema);
36 ms = OOP_NewObject(NULL, CLID_Hidd_Mouse, NULL);
37 if (ms) {
38 if (OOP_ObtainAttrBases(attrbases))
40 HiddMouseBase = OOP_GetMethodID(IID_Hidd_Mouse, 0);
41 drv = HIDD_Mouse_AddHardwareDriver(ms, LIBBASE->msd.mouseclass, NULL);
43 OOP_DisposeObject(ms);
46 if (!drv)
47 return FALSE;
49 LIBBASE->library.lib_OpenCnt = 1;
51 ReturnInt("AmigaMouse_Init", int, TRUE);
54 static int AmigaMouse_Expunge(struct mousebase *LIBBASE)
56 struct mouse_staticdata *msd = &LIBBASE->msd;
57 struct OOP_ABDescr attrbases[] =
59 { IID_Hidd, &HiddAttrBase },
60 { IID_Hidd_Mouse, &HiddMouseAB },
61 { NULL , NULL }
64 EnterFunc(bug("AmigaMouse_Expunge\n"));
66 OOP_ReleaseAttrBases(attrbases);
68 ReturnInt("AmigaMouse_Expunge", int, TRUE);
71 ADD2INITLIB( AmigaMouse_Init, 0)
72 ADD2EXPUNGELIB(AmigaMouse_Expunge, 0)