6 #include <exec/types.h>
7 #include <graphics/rastport.h>
8 #include <utility/hooks.h>
9 #include <intuition/gadgetclass.h>
10 #include <workbench/workbench.h>
11 #include <workbench/startup.h>
12 #include <workbench/icon.h>
13 #include <devices/timer.h>
14 #include <rexx/errors.h>
15 #include <libraries/gadtools.h>
16 #include <libraries/iffparse.h>
17 #include <datatypes/pictureclass.h>
18 #include <dos/dostags.h>
22 #include <proto/dos.h>
23 #include <proto/exec.h>
24 #include <proto/layers.h>
25 #include <proto/intuition.h>
26 #include <proto/graphics.h>
27 #include <proto/utility.h>
28 #include <proto/icon.h>
29 #include <proto/iconobject.h>
30 #include <proto/rexxsyslib.h>
31 #include <proto/timer.h>
33 #include <proto/scalos.h>
35 #include <clib/alib_protos.h>
38 #include <datatypes/iconobject.h>
39 #include <scalos/palette.h>
40 #include <scalos/pattern.h>
41 #include <scalos/scalos.h>
47 #include "scalos_structures.h"
48 #include "functions.h"
49 #include "Variables.h"
51 //----------------------------------------------------------------------------
53 // local data structures
55 #define TIMER_PREFS_CHANGE 2
56 #define TIMER_MAINTASK_COUNT 2
58 //----------------------------------------------------------------------------
62 static void ProcessWBMessages(struct MainTask
*mainTask
);
63 static void ProcessTimerMessage(struct MainTask
*mainTask
);
64 static void ProcessScalosMessage(struct MainTask
*mainTask
, struct ScalosMessage
*sMsg
);
65 static void ProcessWblMessage(struct MainTask
*mainTask
, struct WblMessage
*wMsg
);
66 static void ProcessRexxMessage(struct MainTask
*mainTask
, struct RexxMsg
*RxMsg
);
67 static void ProcessPrefsChanges(struct MainTask
*mainTask
);
68 static void UpdatePrefs(void);
69 static void QuitScalos(struct ScaWindowTask
*iwtMain
, struct RexxMsg
*msg
);
71 //----------------------------------------------------------------------------
75 // Notice: ARexx functions are called with mainTask->mwt.iwt_WindowTask as wtMain
76 static struct ARexxCmdEntry ARexxCommandTable
[] =
78 { "about", ACEFLAGF_RunFromMainTask
, (AREXXFUNC
) AboutProg
},
79 { "quit", ACEFLAGF_RunFromMainTask
, (AREXXFUNC
) QuitScalos
},
83 //----------------------------------------------------------------------------
87 //----------------------------------------------------------------------------
90 void MainWait(struct MainTask
*mainTask
)
92 ULONG WBPortMask
= (1L << wbPort
->mp_SigBit
);
93 ULONG MainPortMask
= (1L << iInfos
.xii_iinfos
.ii_MainMsgPort
->mp_SigBit
);
95 d1(KPrintF("%s/%s/%ld: START iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, &mainTask
->mwt
));
98 ULONG SigsRcvd
= Wait(WBPortMask
| MainPortMask
);
100 d1(KPrintF("%s/%s/%ld: SigsRcvd=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, SigsRcvd
));
102 if (SigsRcvd
& WBPortMask
)
105 ProcessWBMessages(mainTask
);
107 if (SigsRcvd
& MainPortMask
)
112 while (!mainTask
->mwt
.iwt_CloseWindow
&& (msg
= GetMsg(iInfos
.xii_iinfos
.ii_MainMsgPort
)))
114 struct NotifyMessage
*nMsg
= (struct NotifyMessage
*) msg
;
115 struct RexxMsg
*RxMsg
= (struct RexxMsg
*) msg
;
116 struct ScalosMessage
*sMsg
= (struct ScalosMessage
*) msg
;
117 struct WblMessage
*wMsg
= (struct WblMessage
*) msg
;
118 struct AppMessage
*appMsg
= (struct AppMessage
*) msg
;
120 d1(KPrintF("%s/%s/%ld: msg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, msg
));
122 if (msg
== &mainTask
->iorequest
->tr_node
.io_Message
)
125 d1(KPrintF("%s/%s/%ld: Timer Message msg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, msg
));
126 ProcessTimerMessage(mainTask
);
130 if (NOTIFY_CLASS
== nMsg
->nm_Class
&& NOTIFY_CODE
== nMsg
->nm_Code
)
132 const struct NotifyNode
*non
;
135 d1(KPrintF("%s/%s/%ld: Notify Msg UserData=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, nMsg
->nm_NReq
->nr_UserData
));
137 ScalosObtainSemaphoreShared(&mainTask
->mwt_MainNotifyListSema
);
138 for (non
= mainTask
->mainnotifylist
; non
; non
= (const struct NotifyNode
*) non
->non_Node
.mln_Succ
)
140 if (non
->non_NotifyRequest
.nr_UserData
== nMsg
->nm_NReq
->nr_UserData
)
142 struct NotifyTab
*nft
= (struct NotifyTab
*) nMsg
->nm_NReq
->nr_UserData
;
144 ScalosReleaseSemaphore(&mainTask
->mwt_MainNotifyListSema
);
147 d1(KPrintF("%s/%s/%ld: Notify Msg nft=%08lx nft_FileName=<%s> nft_Entry=%08lx\n", \
148 __FILE__
, __FUNC__
, __LINE__
, nft
, nft
->nft_FileName
, nft
->nft_Entry
));
150 (*nft
->nft_Entry
)(&mainTask
->mwt
, nMsg
);
155 ScalosReleaseSemaphore(&mainTask
->mwt_MainNotifyListSema
);
157 d1(KPrintF("%s/%s/%ld: Notify Message\n", __FILE__
, __FUNC__
, __LINE__
));
158 ReplyMsg(&nMsg
->nm_ExecMessage
);
163 if (ID_IMSG
== sMsg
->sm_Signature
)
165 d1(KPrintF("%s/%s/%ld: ScalosMessage\n", __FILE__
, __FUNC__
, __LINE__
));
166 ProcessScalosMessage(mainTask
, sMsg
);
170 if (ID_WBLM
== wMsg
->wbl_Magic
)
172 d1(KPrintF("%s/%s/%ld: WBL Message\n", __FILE__
, __FUNC__
, __LINE__
));
173 ProcessWblMessage(mainTask
, wMsg
);
177 if (msg
->mn_Length
>= sizeof(struct AppMessage
)
178 && ID_APPM
== appMsg
->am_Reserved
[0])
181 d1(KPrintF("%s/%s/%ld: AppMessage\n", __FILE__
, __FUNC__
, __LINE__
));
183 SCA_FreeWBArgs(appMsg
->am_ArgList
,
185 SCAF_FreeLocks
| SCAF_FreeNames
);
191 if (IsRexxMsg((struct RexxMsg
*)RxMsg
))
194 d1(KPrintF("%s/%s/%ld: Rexx Message\n", __FILE__
, __FUNC__
, __LINE__
));
195 ProcessRexxMessage(mainTask
, RxMsg
);
199 d1(KPrintF("%s/%s/%ld: unknown Msg Type\n", __FILE__
, __FUNC__
, __LINE__
));
201 // unknown message type
206 d1(KPrintF("%s/%s/%ld: SigsRcvd=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, SigsRcvd
));
208 } while (!mainTask
->mwt
.iwt_CloseWindow
);
210 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
214 static void ProcessWBMessages(struct MainTask
*mainTask
)
216 struct WBStartup
*sMsg
;
218 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
220 while ((sMsg
= (struct WBStartup
*) GetMsg(wbPort
)))
223 struct DoWait
*dw
, *dwNext
;
225 d1(KPrintF("%s/%s/%ld: sMsg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, sMsg
));
227 ScalosObtainSemaphore(&DoWaitSemaphore
);
229 for (dw
= DoWaitList
; dw
; dw
= dwNext
)
231 dwNext
= (struct DoWait
*) dw
->dwai_Node
.mln_Succ
;
233 d1(KPrintF("%s/%s/%ld: dw=%08lx wbmsg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, dw
, dw
->dwai_wbmsg
));
235 if (sMsg
== dw
->dwai_wbmsg
)
237 struct DoWaitFinished
*dwf
= AllocVec(sizeof(struct DoWaitFinished
), MEMF_PUBLIC
| MEMF_CLEAR
);
239 d1(KPrintF("%s/%s/%ld: dw=%08lx dwf=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, dw
, dwf
));
243 dwf
->dwf_DoWait
= dw
;
244 PutMsg(dw
->dwai_msgport
, &dwf
->dwf_Message
);
250 ScalosReleaseSemaphore(&DoWaitSemaphore
);
252 d1(KPrintF("%s/%s/%ld: numArgs=%ld\n", __FILE__
, __FUNC__
, __LINE__
, sMsg
->sm_NumArgs
));
254 for (n
=0; n
<sMsg
->sm_NumArgs
; n
++)
256 d1(KPrintF("%s/%s/%ld: n=%ld Name=%08lx <%s> Lock=%08lx\n", \
257 __FILE__
, __FUNC__
, __LINE__
, n
, sMsg
->sm_ArgList
[n
].wa_Name
, \
258 sMsg
->sm_ArgList
[n
].wa_Name
, \
259 sMsg
->sm_ArgList
[n
].wa_Lock
));
260 debugLock_d1(sMsg
->sm_ArgList
[n
].wa_Lock
);
262 if (NULL
== sMsg
->sm_ArgList
[n
].wa_Name
&& BNULL
== sMsg
->sm_ArgList
[n
].wa_Lock
)
265 UnLock(sMsg
->sm_ArgList
[n
].wa_Lock
);
266 FreeCopyString(sMsg
->sm_ArgList
[n
].wa_Name
);
269 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
276 static void ProcessTimerMessage(struct MainTask
*mainTask
)
278 d1(KPrintF("%s/%s/%ld: Start\n", __FILE__
, __FUNC__
, __LINE__
));
280 // called every 0.25s
282 if (mainTask
->mt_TimerCounter
++ >= TIMER_MAINTASK_COUNT
)
286 // called every second
288 mainTask
->mt_TimerCounter
= 0;
292 ClassTimerToolTipMsg(&mainTask
->mwt
);
294 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
296 if (SCA_LockWindowList(SCA_LockWindowList_AttemptShared
))
298 struct ScaWindowStruct
*ws
;
300 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
302 for (ws
=winlist
.wl_WindowStruct
; ws
; ws
= (struct ScaWindowStruct
*) ws
->ws_Node
.mln_Succ
)
304 d1(KPrintF("%s/%s/%ld: ws=%08lx ws_Flags=%08lx iwt_MoveGadId=%ld\n", __FILE__
, __FUNC__
, __LINE__
, ws
, ws
->ws_Flags
, \
305 ((struct internalScaWindowTask
*) ws
->ws_WindowTask
)->iwt_MoveGadId
));
307 if ((ws
->ws_Flags
& (WSV_FlagF_CheckUpdatePending
| WSV_FlagF_Typing
| WSV_FlagF_NeedsTimerMsg
))
308 && !(ws
->ws_Flags
& (WSV_FlagF_TaskSleeps
| WSV_FlagF_TimerMsgSent
)))
310 struct SM_Timer
*msg
;
312 ws
->ws_Flags
|= WSV_FlagF_TimerMsgSent
;
314 msg
= (struct SM_Timer
*) SCA_AllocMessage(MTYP_Timer
, 0);
315 d1(KPrintF("%s/%s/%ld: msg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, msg
));
318 msg
->ScalosMessage
.sm_Message
.mn_ReplyPort
= iInfos
.xii_iinfos
.ii_MainMsgPort
;
319 msg
->smtm_WindowStruct
= ws
;
320 msg
->smtm_Time
= Now
;
322 PutMsg(ws
->ws_MessagePort
, &msg
->ScalosMessage
.sm_Message
);
327 SCA_UnLockWindowList();
331 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
333 ProcessPrefsChanges(mainTask
);
335 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
338 StartMainTaskTimer(mainTask
);
340 d1(KPrintF("%s/%s/%ld: Finished\n", __FILE__
, __FUNC__
, __LINE__
));
344 static void ProcessScalosMessage(struct MainTask
*mainTask
, struct ScalosMessage
*sMsg
)
346 APTR ArgPtr
= (APTR
) (((UBYTE
*) &sMsg
->sm_MessageType
) + sizeof(sMsg
->sm_MessageType
));
347 short mIndex
= sMsg
->sm_MessageType
- 1;
349 d1(KPrintF("%s/%s/%ld: Msg=%08lx MsgType=%ld, ln_Type=%ld\n", \
350 __FILE__
, __FUNC__
, __LINE__
, sMsg
, sMsg
->sm_MessageType
, sMsg
->sm_Message
.mn_Node
.ln_Type
));
352 if (NT_REPLYMSG
== sMsg
->sm_Message
.mn_Node
.ln_Type
)
354 if (mIndex
> 0 && mIndex
< MTYP_MAX
)
356 d1(KPrintF("%s/%s/%ld: ReplyFunc=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iMsgTable
[mIndex
].ReplyFunc
));
358 if (iMsgTable
[mIndex
].ReplyFunc
)
359 (*iMsgTable
[mIndex
].ReplyFunc
)(&mainTask
->mwt
, &sMsg
->sm_Message
, ArgPtr
);
362 SCA_FreeMessage(sMsg
);
366 d1(KPrintF("%s/%s/%ld: MsgFunc=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iMsgTable
[mIndex
].MsgFunc
));
368 if (mIndex
> 0 && mIndex
< MTYP_MAX
)
370 if (iMsgTable
[mIndex
].MsgFunc
)
371 (*iMsgTable
[mIndex
].MsgFunc
)(&mainTask
->mwt
, &sMsg
->sm_Message
, ArgPtr
);
374 if (sMsg
->sm_Message
.mn_ReplyPort
)
375 ReplyMsg(&sMsg
->sm_Message
);
377 SCA_FreeMessage(sMsg
);
383 static void ProcessWblMessage(struct MainTask
*mainTask
, struct WblMessage
*wMsg
)
385 struct DoWait
*dw
, *dwNext
;
387 d1(KPrintF("%s/%s/%ld: wMsg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, wMsg
));
389 ScalosObtainSemaphore(&DoWaitSemaphore
);
391 for (dw
= DoWaitList
; dw
; dw
= dwNext
)
393 dwNext
= (struct DoWait
*) dw
->dwai_Node
.mln_Succ
;
395 if (wMsg
== dw
->dwai_wblmsg
)
397 d1(KPrintF("%s/%s/%ld: dw=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, dw
));
399 dw
->dwai_wbmsg
= wMsg
->wbl_IO
.wbl_Return
.wblr_WBStartup
;
404 ScalosReleaseSemaphore(&DoWaitSemaphore
);
410 static void ProcessRexxMessage(struct MainTask
*mainTask
, struct RexxMsg
*RxMsg
)
412 struct ARexxCmdEntry
*ace
;
415 d1(KPrintF("%s/%s/%ld: RxMsg=%08lx Arg[0]=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, RxMsg
, RxMsg
->rm_Args
[0]));
417 for (ace
=ARexxCommandTable
; !Found
&& ace
->ace_CmdName
; ace
++)
419 if (0 == Stricmp(ace
->ace_CmdName
, (STRPTR
) RxMsg
->rm_Args
[0]))
423 RxMsg
->rm_Result1
= RC_OK
;
424 RxMsg
->rm_Result2
= 0;
426 d1(KPrintF("%s/%s/%ld: EntryPoint=%08lx Flags=%08lx\n", \
427 __FILE__
, __FUNC__
, __LINE__
, ace
->ace_EntryPoint
, ace
->ace_Flags
));
429 if (ace
->ace_Flags
& ACEFLAGF_RunFromMainTask
)
431 struct SM_ARexxRoutine
*smrx
;
433 smrx
= (struct SM_ARexxRoutine
*) SCA_AllocMessage(MTYP_ARexxRoutine
, 0);
436 smrx
->smrx_RexxMsg
= RxMsg
;
437 smrx
->smrx_EntryPoint
= ace
->ace_EntryPoint
;
439 PutMsg(iInfos
.xii_iinfos
.ii_MainMsgPort
, &smrx
->ScalosMessage
.sm_Message
);
444 (*ace
->ace_EntryPoint
)(&mainTask
->mwt
.iwt_WindowTask
, RxMsg
);
445 ReplyMsg(&RxMsg
->rm_Node
);
452 ReplyMsg(&RxMsg
->rm_Node
);
454 RxMsg
->rm_Result1
= RC_FATAL
;
459 static void ProcessPrefsChanges(struct MainTask
*mainTask
)
461 if (mainTask
->mt_PrefsChangedTimer
++ >= TIMER_PREFS_CHANGE
)
463 if (mainTask
->mt_PrefsChangedFlags
)
465 BOOL Changed
= FALSE
;
466 BOOL PaletteChanged
= FALSE
;
468 d1(KPrintF("%s/%s/%ld: mt_PrefsChangedFlags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, MainWindowTask
->mt_PrefsChangedFlags
));
470 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_FONTPREFS
)
471 Changed
|= ChangedFontPrefs(mainTask
);
472 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_FILETYPESPREFS
)
473 Changed
|= ChangedFileTypesPrefs(mainTask
);
474 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_DEFICONSPREFS
)
475 Changed
|= ChangedDefIconsPrefs();
476 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_LOCALEPREFS
)
477 Changed
|= ChangedLocalePrefs(mainTask
);
478 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_PATTERNPREFS
)
479 Changed
|= ChangedPatternPrefs(mainTask
);
480 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_SCALOSPREFS
)
481 Changed
|= ChangedMainPrefs(mainTask
);
482 if (mainTask
->mt_PrefsChangedFlags
& (SMNPFLAGF_MENUPREFS
))
483 Changed
|= ChangedMenuPrefs(mainTask
);
484 if (mainTask
->mt_PrefsChangedFlags
& SMNPFLAGF_PALETTEPREFS
)
485 Changed
|= PaletteChanged
= ChangedPalettePrefs(mainTask
);
487 d1(KPrintF("%s/%s/%ld: Changed=%lu\n", __FILE__
, __FUNC__
, __LINE__
, Changed
));
489 if (Changed
&& !PaletteChanged
)
492 if (mainTask
->mt_ChangedMenuPrefsName
)
494 FreeCopyString(mainTask
->mt_ChangedMenuPrefsName
);
495 mainTask
->mt_ChangedMenuPrefsName
= NULL
;
497 if (mainTask
->mt_ChangedPalettePrefsName
)
499 FreeCopyString(mainTask
->mt_ChangedPalettePrefsName
);
500 mainTask
->mt_ChangedPalettePrefsName
= NULL
;
503 mainTask
->mt_PrefsChangedFlags
= 0;
505 mainTask
->mt_PrefsChangedTimer
= 0;
510 static void UpdatePrefs(void)
512 struct ScaWindowStruct
*ws
;
514 d1(KPrintF("%s/%s/%ld: START\n", __FILE__
, __FUNC__
, __LINE__
));
516 SCA_LockWindowList(SCA_LockWindowList_Shared
);
518 for (ws
=winlist
.wl_WindowStruct
; ws
; ws
= (struct ScaWindowStruct
*) ws
->ws_Node
.mln_Succ
)
520 d1(KPrintF("%s/%s/%ld: Name=<%s> Flags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, ws
->ws_Name
, ws
->ws_Flags
));
522 if (!(ws
->ws_Flags
& WSV_FlagF_TaskSleeps
))
524 struct SM_PrefsChanged
*smpc
;
526 smpc
= (struct SM_PrefsChanged
*) SCA_AllocMessage(MTYP_PrefsChanged
, 0);
530 smpc
->smpc_Flags
= 0;
531 PutMsg(ws
->ws_MessagePort
, &smpc
->ScalosMessage
.sm_Message
);
536 SCA_UnLockWindowList();
538 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
545 void RememberPrefsChanges(struct internalScaWindowTask
*iwt
, ULONG PrefsChangeFlags
)
547 struct MainTask
*mainTask
= MainWindowTask
;
549 if (iwt
== &mainTask
->mwt
)
551 mainTask
->mt_PrefsChangedFlags
|= PrefsChangeFlags
;
552 d1(KPrintF("%s/%s/%ld: PrefsChangeFlags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, PrefsChangeFlags
));
553 d1(KPrintF("%s/%s/%ld: mt_PrefsChangedFlags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, mainTask
->mt_PrefsChangedFlags
));
554 mainTask
->mt_PrefsChangedTimer
= 0;
559 void StartMainTaskTimer(struct MainTask
*mt
)
561 mt
->iorequest
->tr_node
.io_Command
= TR_ADDREQUEST
;
562 mt
->iorequest
->tr_time
.tv_secs
= 0;
563 mt
->iorequest
->tr_time
.tv_micro
= 250000; // 0.25s period
565 SendIO(&mt
->iorequest
->tr_node
);
569 struct NotifyNode
*AddToMainNotifyList(struct NotifyTab
*nft
, ULONG Flags
)
571 struct NotifyNode
*non
;
574 struct MainTask
*mainTask
= MainWindowTask
;
576 ScalosObtainSemaphore(&MainWindowTask
->mwt_MainNotifyListSema
);
577 non
= (struct NotifyNode
*) SCA_AllocNode((struct ScalosNodeList
*) &mainTask
->mainnotifylist
, sizeof(struct NotifyNode
));
578 ScalosReleaseSemaphore(&MainWindowTask
->mwt_MainNotifyListSema
);
579 d1(KPrintF("%s/%s/%ld: non=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, non
));
583 non
->non_NotifyRequest
.nr_UserData
= (IPTR
) nft
;
584 non
->non_NotifyRequest
.nr_Name
= (STRPTR
) nft
->nft_FileName
;
585 non
->non_NotifyRequest
.nr_stuff
.nr_Msg
.nr_Port
= iInfos
.xii_iinfos
.ii_MainMsgPort
;
586 non
->non_NotifyRequest
.nr_Flags
= NRF_SEND_MESSAGE
| Flags
;
588 if (!StartNotify(&non
->non_NotifyRequest
))
590 // free ffi_NotifyNode, but continue and add ffi!
591 d1(kprintf("%s/%s/%ld: StartNotify() failed\n", __FILE__
, __FUNC__
, __LINE__
));
593 SCA_FreeNode((struct ScalosNodeList
*) &mainTask
->mainnotifylist
, &non
->non_Node
);
596 d1(kprintf("%s/%s/%ld: StartNotify() OK\n", __FILE__
, __FUNC__
, __LINE__
));
599 d1(KPrintF("%s/%s/%ld: AddToMainNotifyList return=%8lx\n",
600 __FILE__
, __FUNC__
, __LINE__
, non
));
606 void RemFromMainNotifyList(struct NotifyNode
*nonOld
)
608 struct MainTask
*mainTask
= MainWindowTask
;
609 struct NotifyNode
*non
;
611 d1(KPrintF("%s/%s/%ld: RemFromMainNotifyList %8lx\n",
612 __FILE__
, __FUNC__
, __LINE__
, nonOld
));
616 ScalosObtainSemaphore(&MainWindowTask
->mwt_MainNotifyListSema
);
618 d1(KPrintF("%s/%s/%ld:\n", __FILE__
, __FUNC__
, __LINE__
));
620 // make sure nonOld is still present in mainnotifylist
621 for (non
= mainTask
->mainnotifylist
;
623 non
= (struct NotifyNode
*) non
->non_Node
.mln_Succ
)
625 d1(KPrintF("%s/%s/%ld: non(%08lx) nonOld(%08lx)\n", __FILE__
, __FUNC__
, __LINE__
,
629 ScalosEndNotify(&nonOld
->non_NotifyRequest
);
630 SCA_FreeNode((struct ScalosNodeList
*) &mainTask
->mainnotifylist
, &nonOld
->non_Node
);
635 d1(KPrintF("%s/%s/%ld:\n", __FILE__
, __FUNC__
, __LINE__
));
637 ScalosReleaseSemaphore(&MainWindowTask
->mwt_MainNotifyListSema
);
642 static void QuitScalos(struct ScaWindowTask
*wtMain
, struct RexxMsg
*msg
)
644 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
649 iwtMain
->iwt_CloseWindow
= TRUE
;