2 Copyright © 1995-2016, 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 * When the transition completes, kludges from bootmenu and
19 * dosboot will be removed. Noone will care about library
23 #include "x11_debug.h"
25 #include <hidd/keyboard.h>
26 #include <hidd/mouse.h>
27 #include <graphics/gfxbase.h>
28 #include <proto/graphics.h>
30 #include LC_LIBDEFS_FILE
32 static int X11_Startup(LIBBASETYPEPTR LIBBASE
)
34 struct TagItem kbd_tags
[] =
36 {aHidd_Name
, (IPTR
)"X11Kbd" },
37 {aHidd_HardwareName
, (IPTR
)"X Window keyboard input"},
38 {aHidd_ProducerName
, (IPTR
)"X.Org Foundation" },
41 struct TagItem mouse_tags
[] =
43 {aHidd_Name
, (IPTR
)"X11Mouse" },
44 {aHidd_HardwareName
, (IPTR
)"X Window pointer input"},
45 {aHidd_ProducerName
, (IPTR
)"X.Org Foundation" },
48 struct GfxBase
*GfxBase
;
50 OOP_Object
*kbdriver
= NULL
;
51 OOP_Object
*msdriver
= NULL
;
55 D(bug("[X11] X11_Startup()\n"));
57 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 41);
58 D(bug("[X11_Startup] GfxBase 0x%p\n", GfxBase
));
62 /* Add keyboard and mouse driver to the system */
63 kbd
= OOP_NewObject(NULL
, CLID_Hidd_Kbd
, NULL
);
64 ms
= OOP_NewObject(NULL
, CLID_Hidd_Mouse
, NULL
);
68 CloseLibrary(&GfxBase
->LibNode
);
72 kbdriver
= HW_AddDriver(kbd
, LIBBASE
->xsd
.kbdclass
, kbd_tags
);
74 msdriver
= HW_AddDriver(ms
, LIBBASE
->xsd
.mouseclass
, mouse_tags
);
76 /* If we got no input, we can't work, fail */
79 CloseLibrary(&GfxBase
->LibNode
);
83 err
= AddDisplayDriverA(LIBBASE
->xsd
.gfxclass
, NULL
, NULL
);
85 D(bug("[X11_Startup] AddDisplayDriver() result: %u\n", err
));
88 LIBBASE
->library
.lib_OpenCnt
= 1;
94 HW_RemoveDriver(kbd
, kbdriver
);
96 HW_RemoveDriver(ms
, msdriver
);
99 CloseLibrary(&GfxBase
->LibNode
);
104 /* This routine must be called AFTER everything all other initialization was run */
105 ADD2INITLIB(X11_Startup
, 10);