2 Copyright © 1995-2014, 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>
26 #include <hidd/hidd.h>
27 #include <hidd/keyboard.h>
28 #include <hidd/mouse.h>
29 #include <proto/exec.h>
30 #include <proto/graphics.h>
31 #include <proto/oop.h>
35 static int gdi_Startup(struct gdiclbase
*LIBBASE
)
37 struct GfxBase
*GfxBase
;
39 OOP_Object
*kbdriver
= NULL
;
40 OOP_Object
*msdriver
= NULL
;
41 struct TagItem kbd_tags
[] =
43 {aHidd_Name
, (IPTR
)"GDIKbd" },
44 {aHidd_HardwareName
, (IPTR
)"Windows GDI keyboard input"},
45 {aHidd_ProducerName
, (IPTR
)"Microsoft Corp." },
48 struct TagItem ms_tags
[] =
50 {aHidd_Name
, (IPTR
)"GDIMouse" },
51 {aHidd_HardwareName
, (IPTR
)"Windows GDI mouse input" },
52 {aHidd_ProducerName
, (IPTR
)"Microsoft Corp." },
56 D(bug("[GDI] gdi_Startup()\n"));
58 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
59 D(bug("[gdi_Startup] GfxBase 0x%p\n", GfxBase
));
63 /* Add keyboard and mouse driver to the system */
64 kbd
= OOP_NewObject(NULL
, CLID_HW_Kbd
, NULL
);
65 ms
= OOP_NewObject(NULL
, CLID_HW_Mouse
, NULL
);
67 kbdriver
= HW_AddDriver(kbd
, LIBBASE
->xsd
.kbdclass
, kbd_tags
);
70 msdriver
= HIDD_Mouse_AddHardwareDriver(ms
, LIBBASE
->xsd
.mouseclass
, ms_tags
);
72 HIDD_Kbd_RemHardwareDriver(kbd
, kbdriver
);
75 /* If we got no input, we can't work, fail */
78 CloseLibrary(&GfxBase
->LibNode
);
82 /* We use ourselves, and noone else */
83 LIBBASE
->library
.lib_OpenCnt
= 1;
86 * Now proceed to adding display modes. Install only one instance for the first time.
87 * If needed, more displays are added by disk-based part.
89 AddDisplayDriver(LIBBASE
->xsd
.gfxclass
, NULL
, NULL
);
91 CloseLibrary(&GfxBase
->LibNode
);
95 /* This routine must be called AFTER everything all other initialization was run */
96 ADD2INITLIB(gdi_Startup
, 10);