2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
7 * A newstyle startup code for resident display drivers.
9 * Now it's the job of the driver to add ifself to the system.
10 * The driver does not have to be a library anymore, it can be
11 * plain executable which is started from DEVS:Monitors.
13 * The job of driver startup code is to create all necessary
14 * classes (driver class and bitmap class) and create as many
15 * driver objects as possible. Every object needs to be given
16 * to AddDisplayDriverA() in order to become functional.
18 * Hosted drivers are also responsible for registering own input
22 #include <aros/debug.h>
23 #include <aros/symbolsets.h>
24 #include <graphics/driver.h>
25 #include <graphics/gfxbase.h>
27 #include <hidd/hidd.h>
28 #include <hidd/keyboard.h>
29 #include <hidd/mouse.h>
30 #include <proto/exec.h>
31 #include <proto/graphics.h>
32 #include <proto/oop.h>
36 static int gdi_Startup(struct gdiclbase
*LIBBASE
)
38 struct GfxBase
*GfxBase
;
40 OOP_Object
*kbdriver
= NULL
;
41 OOP_Object
*msdriver
= NULL
;
42 struct TagItem kbd_tags
[] =
44 {aHidd_Name
, (IPTR
)"GDIKbd" },
45 {aHidd_HardwareName
, (IPTR
)"Windows GDI keyboard input"},
46 {aHidd_ProducerName
, (IPTR
)"Microsoft Corp." },
49 struct TagItem ms_tags
[] =
51 {aHidd_Name
, (IPTR
)"GDIMouse" },
52 {aHidd_HardwareName
, (IPTR
)"Windows GDI mouse input" },
53 {aHidd_ProducerName
, (IPTR
)"Microsoft Corp." },
57 D(bug("[GDI] gdi_Startup()\n"));
59 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
60 D(bug("[gdi_Startup] GfxBase 0x%p\n", GfxBase
));
64 LIBBASE
->xsd
.basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
66 /* Add keyboard and mouse driver to the system */
67 kbd
= OOP_NewObject(NULL
, CLID_HW_Kbd
, NULL
);
68 ms
= OOP_NewObject(NULL
, CLID_HW_Mouse
, NULL
);
70 kbdriver
= HW_AddDriver(kbd
, LIBBASE
->xsd
.kbdclass
, kbd_tags
);
73 msdriver
= HIDD_Mouse_AddHardwareDriver(ms
, LIBBASE
->xsd
.mouseclass
, ms_tags
);
75 HIDD_Kbd_RemHardwareDriver(kbd
, kbdriver
);
78 /* If we got no input, we can't work, fail */
81 CloseLibrary(&GfxBase
->LibNode
);
85 /* We use ourselves, and noone else */
86 LIBBASE
->library
.lib_OpenCnt
= 1;
89 * Now proceed to adding display modes. Install only one instance for the first time.
90 * If needed, more displays are added by disk-based part.
92 AddDisplayDriver(LIBBASE
->xsd
.gfxclass
, NULL
, NULL
);
94 CloseLibrary(&GfxBase
->LibNode
);
98 /* This routine must be called AFTER everything all other initialization was run */
99 ADD2INITLIB(gdi_Startup
, 10);