2 Copyright 1995-2017, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
7 #include <proto/intuition.h>
8 #include <proto/alib.h>
9 #include <proto/layers.h>
10 #include <exec/memory.h>
11 #include <exec/alerts.h>
12 #include <exec/interrupts.h>
13 #include <exec/ports.h>
14 #include <intuition/intuition.h>
15 #include <intuition/intuitionbase.h>
16 #include "intuition_intern.h"
18 #include "screennotifytask.h"
22 #include <aros/debug.h>
24 /**************************************************************************************************/
26 /***************************
27 ** DefaultScreennotifyHandler() **
28 ***************************/
29 void DefaultScreennotifyHandler(struct ScreennotifyTaskParams
*taskparams
)
31 struct MsgPort
*port
= NULL
;
34 if ((port
= CreateMsgPort()))
37 } /* if ((mem = AllocMem(sizeof(struct MsgPort), MEMF_PUBLIC | MEMF_CLEAR))) */
41 taskparams
->ScreennotifyHandlerPort
= port
;
42 taskparams
->success
= TRUE
;
45 Signal(taskparams
->Caller
, SIGF_INTUITION
);
49 D(bug("DefaultScreennotifyHandler: initialization failed. waiting for parent task to kill me.\n"));
53 D(bug("DefaultScreennotifyHandler: initialization ok. Now waiting for messages from Intuition.\n"));
57 struct ScreenNotifyMessage
*msg
;
60 while((msg
= (struct ScreenNotifyMessage
*) GetMsg(port
)))
62 FreeMem((APTR
) msg
, sizeof(struct ScreenNotifyMessage
));
63 } /* while((msg = (struct ScreenNotifyMessage *)GetMsg(port))) */
67 /* should never reach here but just incase.. */
72 /**************************************************************************************************/
74 /*******************************
75 ** InitDefaultScreennotifyHandler() **
76 *******************************/
77 BOOL
InitDefaultScreennotifyHandler(struct IntuitionBase
*IntuitionBase
)
79 struct ScreennotifyTaskParams params
;
83 params
.intuitionBase
= IntuitionBase
;
84 params
.Caller
= FindTask(NULL
);
85 params
.success
= FALSE
;
87 SetSignal(0, SIGF_INTUITION
);
89 task
= NewCreateTask(TASKTAG_NAME
, SCREENNOTIFYTASK_NAME
,
90 TASKTAG_PRI
, SCREENNOTIFYTASK_PRIORITY
,
91 TASKTAG_STACKSIZE
, SCREENNOTIFYTASK_STACKSIZE
,
92 TASKTAG_PC
, DefaultScreennotifyHandler
,
93 TASKTAG_ARG1
, ¶ms
,
103 GetPrivIBase(IntuitionBase
)->ScreenNotifyReplyPort
= params
.ScreennotifyHandlerPort
;
110 } /* if ((task = CreateScreennotifyHandlerTask(¶ms, IntuitionBase))) */