2 Copyright 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Disk-resident part of GDI display driver
9 #include <aros/debug.h>
10 #include <dos/dosextens.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>
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
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
;
47 D(bug("[GDI] Making %u displays\n", num
));
48 /* First query current displays count */
49 GDIBase
= (struct GDIBase
*)OpenLibrary(GDI_LIBNAME
, GDI_VERSION
);
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
);
66 /* Abort if driver setup failed */
67 D(bug("[GDI] Failed to add display object, error %u\n", err
));
79 struct DiskObject
*icon
;
80 struct RDArgs
*rdargs
= NULL
;
85 olddir
= CurrentDir(WBenchMsg
->sm_ArgList
[0].wa_Lock
);
86 myname
= WBenchMsg
->sm_ArgList
[0].wa_Name
;
88 struct Process
*me
= (struct Process
*)FindTask(NULL
);
91 struct CommandLineInterface
*cli
= BADDR(me
->pr_CLI
);
93 myname
= cli
->cli_CommandName
;
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
));
103 STRPTR str
= FindToolType(icon
->do_ToolTypes
, "DISPLAYS");
105 displays
= atoi(str
);
109 rdargs
= ReadArgs("DISPLAYS/N/A", &displays
, NULL
);
110 D(bug("[GDI] RDArgs 0x%p\n", rdargs
));
113 AddDisplays(displays
);
118 FreeDiskObject(icon
);