Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / all-mingw32 / hidd / wingdi / disk_startup.c
blob4e873f1dbf09486f3c5ec091fae74b7490e935cb
1 /*
2 Copyright 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Disk-resident part of GDI display driver
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <dos/dosextens.h>
11 #include <oop/oop.h>
12 #include <workbench/startup.h>
13 #include <workbench/workbench.h>
14 #include <proto/dos.h>
15 #include <proto/exec.h>
16 #include <proto/graphics.h>
17 #include <proto/oop.h>
18 #include <proto/icon.h>
20 #include <stdlib.h>
22 #include "gdi_class.h"
24 /* Minimum required library version */
25 #define GDI_VERSION 42
27 /************************************************************************/
30 * This program actually just creates additional GDI displays.
31 * It assumes that the driver itself is placed in kickstart in the form
32 * of library
35 extern struct WBStartup *WBenchMsg;
37 int __nocommandline = 1;
39 /* This function uses library open count as displays count */
40 static ULONG AddDisplays(ULONG num)
42 struct GDIBase *GDIBase;
43 OOP_Class *gfxclass;
44 ULONG old;
45 ULONG i;
47 D(bug("[GDI] Making %u displays\n", num));
48 /* First query current displays count */
49 GDIBase = (struct GDIBase *)OpenLibrary(GDI_LIBNAME, GDI_VERSION);
50 if (!GDIBase)
51 return 0;
53 gfxclass = GDIBase->gfxclass;
54 old = GDIBase->displaynum - 1;
56 CloseLibrary(&GDIBase->library);
57 D(bug("[GDI] Current displays count: %u\n", old));
59 /* Add displays if needed */
60 for (i = old; i < num; i++)
62 ULONG err = AddDisplayDriverA(gfxclass, NULL, NULL);
64 if (err)
66 /* Abort if driver setup failed */
67 D(bug("[GDI] Failed to add display object, error %u\n", err));
68 break;
72 return i;
75 int main(void)
77 BPTR olddir = NULL;
78 STRPTR myname;
79 struct DiskObject *icon;
80 struct RDArgs *rdargs = NULL;
81 int res = RETURN_OK;
82 IPTR displays = 1;
84 if (WBenchMsg) {
85 olddir = CurrentDir(WBenchMsg->sm_ArgList[0].wa_Lock);
86 myname = WBenchMsg->sm_ArgList[0].wa_Name;
87 } else {
88 struct Process *me = (struct Process *)FindTask(NULL);
90 if (me->pr_CLI) {
91 struct CommandLineInterface *cli = BADDR(me->pr_CLI);
93 myname = cli->cli_CommandName;
94 } else
95 myname = me->pr_Task.tc_Node.ln_Name;
97 D(bug("[GDI] Command name: %s\n", myname));
99 icon = GetDiskObject(myname);
100 D(bug("[GDI] Icon 0x%p\n", icon));
102 if (icon) {
103 STRPTR str = FindToolType(icon->do_ToolTypes, "DISPLAYS");
105 displays = atoi(str);
108 if (!WBenchMsg) {
109 rdargs = ReadArgs("DISPLAYS/N/A", &displays, NULL);
110 D(bug("[GDI] RDArgs 0x%p\n", rdargs));
113 AddDisplays(displays);
115 if (rdargs)
116 FreeArgs(rdargs);
117 if (icon)
118 FreeDiskObject(icon);
119 if (olddir)
120 CurrentDir(olddir);
122 return res;