adapt all gfx drivers to use the new gfx.hidd CreateObject API.
[AROS.git] / arch / all-ios / hidd / uikit / startup.c
blob34eead77bab04c94b11fe101c7ee733896654502
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
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
19 * drivers if needed.
22 #include <aros/debug.h>
23 #include <aros/symbolsets.h>
24 #include <graphics/driver.h>
25 #include <graphics/gfxbase.h>
26 #include <hidd/keyboard.h>
27 #include <hidd/mouse.h>
28 #include <proto/exec.h>
29 #include <proto/graphics.h>
30 #include <proto/oop.h>
32 #include "classbase.h"
34 static int uikit_Startup(struct UIKitBase *LIBBASE)
36 struct GfxBase *GfxBase;
37 OOP_Object *kbd, *ms;
38 OOP_Object *kbdriver;
39 OOP_Object *msdriver = NULL;
41 D(bug("[UIKit] Startup\n"));
43 GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 41);
44 D(bug("[UIKit] GfxBase 0x%p\n", GfxBase));
45 if (!GfxBase)
46 return FALSE;
48 LIBBASE->basebm = OOP_FindClass(CLID_Hidd_BitMap);
50 #ifdef NOT_DONE_YET
51 /* Add keyboard and mouse driver to the system */
52 kbd = OOP_NewObject(NULL, CLID_Hidd_Kbd, NULL);
53 if (kbd) {
54 ms = OOP_NewObject(NULL, CLID_Hidd_Mouse, NULL);
55 if (ms) {
56 kbdriver = HIDD_Kbd_AddHardwareDriver(kbd, LIBBASE->xsd.kbdclass, NULL);
57 if (kbdriver) {
58 msdriver = HIDD_Mouse_AddHardwareDriver(ms, LIBBASE->xsd.mouseclass, NULL);
59 if (!msdriver)
60 HIDD_Kbd_RemHardwareDriver(kbd, kbdriver);
62 OOP_DisposeObject(ms);
64 OOP_DisposeObject(kbd);
67 /* If we got no input, we can't work, fail */
68 if (!msdriver) {
69 CloseLibrary(&GfxBase->LibNode);
70 return FALSE;
72 #endif
73 /* We use ourselves, and noone else */
74 LIBBASE->lib.lib_OpenCnt = 1;
77 * Now proceed to adding display modes. Install only one instance for the first time.
78 * If needed, more displays are added by disk-based part.
80 AddDisplayDriver(LIBBASE->gfxclass, NULL, NULL);
82 CloseLibrary(&GfxBase->LibNode);
83 return TRUE;
86 /* This routine must be called AFTER everything all other initialization was run */
87 ADD2INITLIB(uikit_Startup, 10);