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. Display driver objects are created
16 * by AddDisplayDriverA() after some checks.
18 * We are hosted, so we register also own input drivers.
21 #include <aros/debug.h>
22 #include <aros/symbolsets.h>
23 #include <graphics/gfxbase.h>
24 #include <graphics/driver.h>
25 #include <hidd/keyboard.h>
26 #include <hidd/mouse.h>
27 #include <proto/exec.h>
28 #include <proto/graphics.h>
29 #include <proto/oop.h>
31 #include LC_LIBDEFS_FILE
33 static int agfx_Startup(LIBBASETYPEPTR LIBBASE
)
35 struct GfxBase
*GfxBase
;
38 OOP_Object
*msdriver
= NULL
;
40 D(bug("[AGFX.Startup] agfx_Startup()\n"));
42 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
43 D(bug("[AGFX.Startup] GfxBase 0x%p\n", GfxBase
));
47 LIBBASE
->xsd
.basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
49 /* Add keyboard and mouse driver to the system */
50 kbd
= OOP_NewObject(NULL
, CLID_Hidd_Kbd
, NULL
);
53 ms
= OOP_NewObject(NULL
, CLID_Hidd_Mouse
, NULL
);
56 kbdriver
= HIDD_Kbd_AddHardwareDriver(kbd
, LIBBASE
->xsd
.kbdclass
, NULL
);
59 msdriver
= HIDD_Mouse_AddHardwareDriver(ms
, LIBBASE
->xsd
.mouseclass
, NULL
);
61 HIDD_Kbd_RemHardwareDriver(kbd
, kbdriver
);
63 OOP_DisposeObject(ms
);
65 OOP_DisposeObject(kbd
);
68 /* If we got no input, we can't work, fail */
71 CloseLibrary(&GfxBase
->LibNode
);
75 /* We use ourselves, and noone else */
76 LIBBASE
->library
.lib_OpenCnt
= 1;
78 /* Install the driver. At the moment we have only one display. */
79 AddDisplayDriverA(LIBBASE
->xsd
.gfxclass
, NULL
, NULL
);
81 CloseLibrary(&GfxBase
->LibNode
);
85 /* This routine must be called AFTER everything all other initialization was run */
86 ADD2INITLIB(agfx_Startup
, 10);