Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / all-mingw32 / hidd / wingdi / startup.c
blobd85e0685d496ce07b90ba9544f47b5ac90a8c2fa
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/graphics.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>
34 #include "gdi.h"
36 static int gdi_Startup(struct gdiclbase *LIBBASE)
38 struct GfxBase *GfxBase;
39 OOP_Object *kbd, *ms;
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." },
47 {TAG_DONE , 0 }
49 struct TagItem ms_tags[] =
51 {aHidd_Name , (IPTR)"GDIMouse" },
52 {aHidd_HardwareName, (IPTR)"Windows GDI mouse input" },
53 {aHidd_ProducerName, (IPTR)"Microsoft Corp." },
54 {TAG_DONE , 0 }
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));
61 if (!GfxBase)
62 return FALSE;
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);
71 if (kbdriver)
73 msdriver = HIDD_Mouse_AddHardwareDriver(ms, LIBBASE->xsd.mouseclass, ms_tags);
74 if (!msdriver)
75 HIDD_Kbd_RemHardwareDriver(kbd, kbdriver);
78 /* If we got no input, we can't work, fail */
79 if (!msdriver)
81 CloseLibrary(&GfxBase->LibNode);
82 return FALSE;
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);
95 return TRUE;
98 /* This routine must be called AFTER everything all other initialization was run */
99 ADD2INITLIB(gdi_Startup, 10);