Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / network / stacks / AROSTCP / MUI.MiamiPanel / muimiamipanel_proccess.c
blobe401cd3cdc1044fb6ee5b01724ff4217140129ce
2 #include <proto/exec.h>
3 #include <proto/dos.h>
4 #include <proto/intuition.h>
5 #include <proto/muimaster.h>
6 #include <stdarg.h>
8 #include "muimiamipanel_intern.h"
10 #undef SysBase
12 /***********************************************************************/
13 AROS_UFH3(void, MiamiPanelProc,
14 AROS_UFHA(STRPTR, argPtr, A0),
15 AROS_UFHA(ULONG, argSize, D0),
16 AROS_UFHA(struct ExecBase *, SysBase, A6))
18 AROS_USERFUNC_INIT
20 struct Process *me = (struct Process *)FindTask(NULL);
21 struct MiamiPanelBase_intern *MiamiPanelBaseIntern = ((struct Task *)me)->tc_UserData;
22 register struct MPS_AppMsg *msg = NULL;
23 register Object *app = NULL; //gcc
24 register struct Window *win = NULL;
25 register ULONG res;
27 ObtainSemaphore(&MiamiPanelBaseIntern->mpb_procSem);
29 WaitPort(&me->pr_MsgPort);
30 msg = (struct MPS_AppMsg *)GetMsg(&me->pr_MsgPort);
32 win = me->pr_WindowPtr;
33 me->pr_WindowPtr = (struct Window *)-1;
35 MiamiPanelBaseIntern->mpb_port = CreateMsgPort();
37 struct TagItem appObjecttags[] = {MPA_Show, msg->flags,
38 TAG_DONE};
40 app = MUI_NewObjectA(MiamiPanelBaseIntern->mpb_appClass->mcc_Class, appObjecttags);
42 res = ((MiamiPanelBaseIntern) && (app));
44 msg->res = res;
45 ReplyMsg((struct Message *)msg);
47 me->pr_WindowPtr = win;
49 if (res)
51 ULONG signals;
53 MiamiPanelBaseIntern->mpb_app = app;
55 for (signals = 0; DoMethod(app, MUIM_Application_NewInput, (ULONG)&signals) != MUIV_Application_ReturnID_Quit; )
56 if (signals && ((signals = Wait(signals | SIGBREAKF_CTRL_C)) & SIGBREAKF_CTRL_C))
57 DoMethod(app, MPM_Quit);
59 MUI_DisposeObject(app);
62 ObtainSemaphore(&MiamiPanelBaseIntern->mpb_libSem);
64 if (MiamiPanelBaseIntern->mpb_port)
66 DeleteMsgPort(MiamiPanelBaseIntern->mpb_port);
67 MiamiPanelBaseIntern->mpb_port = NULL;
68 MiamiPanelBaseIntern->mpb_app = NULL;
71 ReleaseSemaphore(&MiamiPanelBaseIntern->mpb_libSem);
72 ReleaseSemaphore(&MiamiPanelBaseIntern->mpb_procSem);
74 Forbid();
75 MiamiPanelBaseIntern->mpb_use--;
77 AROS_USERFUNC_EXIT
81 /***********************************************************************/