revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / monitors / Compositor / compositor_startup.c
blob9401eabd5db1d146ce2f1765f3c3f83e2aca344b
1 #include <dos/dosextens.h>
2 #include <exec/libraries.h>
3 #include <oop/ifmeta.h>
4 #include <oop/oop.h>
6 #include <proto/exec.h>
7 #include <proto/graphics.h>
8 #include <proto/oop.h>
10 #include "compositor_intern.h"
12 /* Libraries */
13 struct Library *OOPBase;
14 struct Library *UtilityBase;
16 /* Attr bases */
17 OOP_AttrBase HiddPixFmtAttrBase;
18 OOP_AttrBase HiddSyncAttrBase;
19 OOP_AttrBase HiddBitMapAttrBase;
20 OOP_AttrBase HiddGCAttrBase;
21 OOP_AttrBase HiddCompositorAttrBase;
23 const TEXT version[] = "$VER: Compositor 41.1 (8.10.2013)\n";
25 static const struct OOP_ABDescr attrbases[] =
27 { IID_Hidd_PixFmt, &HiddPixFmtAttrBase },
28 { IID_Hidd_Sync, &HiddSyncAttrBase },
29 { IID_Hidd_BitMap, &HiddBitMapAttrBase },
30 { IID_Hidd_GC, &HiddGCAttrBase },
31 { IID_Hidd_Compositor, &HiddCompositorAttrBase },
32 { NULL, NULL }
35 static OOP_Class *InitClass(void)
37 OOP_AttrBase MetaAttrBase = OOP_ObtainAttrBase(IID_Meta);
38 OOP_Class *cl = NULL;
40 struct TagItem Compositor_tags[] =
42 {aMeta_SuperID , (IPTR)CLID_Root },
43 {aMeta_InterfaceDescr, (IPTR)Compositor_ifdescr },
44 {aMeta_InstSize , sizeof(struct HIDDCompositorData)},
45 {aMeta_ID , (IPTR)CLID_Hidd_Compositor },
46 {TAG_DONE , 0 }
49 if (MetaAttrBase == 0)
50 return NULL;
52 cl = OOP_NewObject(NULL, CLID_HiddMeta, Compositor_tags);
53 if (cl)
54 OOP_AddClass(cl);
56 OOP_ReleaseAttrBase(IID_Meta);
57 return cl;
60 int __nocommandline = 1;
62 int main(void)
64 int ret = RETURN_FAIL;
66 /*
67 * Open these libraries manually because we don't want them to be
68 * automatically closed when we stay resident.
70 UtilityBase = OpenLibrary("utility.library", 0);
71 if (UtilityBase)
73 OOPBase = OpenLibrary("oop.library", 42);
74 if (OOPBase)
76 if (OOP_ObtainAttrBases(attrbases))
78 if (OOP_FindClass(CLID_Hidd_Compositor))
80 /* Double-starting is a valid operation. */
81 ret = RETURN_OK;
83 else
85 OOP_Class *cl = InitClass();
87 if (cl)
90 * Yes, composer is not a real display driver. It has totally different API.
91 * AddDisplayDriverA() knows this.
93 ULONG err = AddDisplayDriverA(cl, NULL, NULL);
95 if (!err)
97 /* Stay resident */
98 struct Process *me = (struct Process *) FindTask(NULL);
100 if (me->pr_CLI)
102 struct CommandLineInterface *cli = BADDR(me->pr_CLI);
104 cli->cli_Module = BNULL;
106 else
107 me->pr_SegList = BNULL;
109 /* Don't close our libraries and release attrbases. The HIDD needs them. */
111 return RETURN_OK;
116 OOP_ReleaseAttrBases(attrbases);
117 CloseLibrary(OOPBase);
119 CloseLibrary(UtilityBase);
122 return ret;