4 // 04 Sep 2004 15:33:26
7 #include <exec/types.h>
8 #include <graphics/gels.h>
9 #include <graphics/rastport.h>
10 #include <intuition/classes.h>
11 #include <intuition/classusr.h>
12 #include <utility/hooks.h>
13 #include <intuition/gadgetclass.h>
14 #include <workbench/workbench.h>
15 #include <workbench/startup.h>
16 #include <datatypes/pictureclass.h>
18 #include <dos/dostags.h>
19 #include <dos/exall.h>
23 #include <proto/dos.h>
24 #include <proto/exec.h>
25 #include <proto/layers.h>
26 #include <proto/graphics.h>
27 #include <proto/intuition.h>
28 #include <proto/iconobject.h>
29 #include <proto/utility.h>
30 #include <proto/gadtools.h>
31 #include <proto/datatypes.h>
33 #include <proto/scalos.h>
35 #include <clib/alib_protos.h>
38 #include <datatypes/iconobject.h>
39 #include <scalos/scalos.h>
45 #include "scalos_structures.h"
46 #include "functions.h"
47 #include "Variables.h"
49 //----------------------------------------------------------------------------
51 // local Data definitions
53 //----------------------------------------------------------------------------
57 static LONG
BackdropWriteList(struct BackDropList
*bdl
);
58 static BOOL
BackdropInternalAddLine(struct BackDropList
*bdl
, CONST_STRPTR NewLine
, LONG PosX
, LONG PosY
);
59 static struct ChainedLine
*BackdropAllocChainedLine(CONST_STRPTR TextLine
);
60 static void BackdropFreeChainedLine(struct ChainedLine
*cnl
);
61 static void BackdropRemoveObsoleteEntriesFromBackdropFile(struct BackDropList
*bdl
);
62 static void BackdropRemoveDuplicateEntriesFromBackdropFile(struct BackDropList
*bdl
);
63 static void BackdropRedrawMainIconObject(struct internalScaWindowTask
*iwtMain
, Object
*IconObj
);
65 //----------------------------------------------------------------------------
69 //----------------------------------------------------------------------------
71 void BackDropInitList(struct BackDropList
*bdl
)
73 NewList(&bdl
->bdl_LinesList
);
74 bdl
->bdl_Loaded
= FALSE
;
75 bdl
->bdl_Changed
= FALSE
;
76 bdl
->bdl_Filtered
= FALSE
;
77 bdl
->bdl_NotPresent
= FALSE
;
78 bdl
->bdl_Initialized
= TRUE
;
82 LONG
BackdropLoadList(struct BackDropList
*bdl
)
84 const size_t LineSize
= 300;
85 LONG Result
= RETURN_OK
;
89 BackDropInitList(bdl
);
91 ShortcutAddLines(bdl
); // add left-out icons from Ambient shortcuts
93 fh
= Open(".backdrop", MODE_OLDFILE
);
94 d1(kprintf("%s/%s/%ld: fh=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, fh
));
98 if (ERROR_OBJECT_NOT_FOUND
== Result
)
100 bdl
->bdl_NotPresent
= TRUE
;
107 Line
= ScalosAlloc(LineSize
);
111 return ERROR_NO_FREE_STORE
;
114 bdl
->bdl_Loaded
= TRUE
;
116 while (FGets(fh
, Line
, LineSize
))
118 if ('\n' == Line
[strlen(Line
) - 1]) // strip trailing LF
119 Line
[strlen(Line
) - 1] = '\0';
121 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, Line
));
123 if (strlen(Line
) >= 1)
125 BackdropAddLine(bdl
, Line
, NO_ICON_POSITION
, NO_ICON_POSITION
);
138 void BackdropFreeList(struct BackDropList
*bdl
)
140 struct ChainedLine
*cnl
;
142 if (! bdl
->bdl_Initialized
)
145 while ((cnl
= (struct ChainedLine
*) RemHead(&bdl
->bdl_LinesList
)))
147 BackdropFreeChainedLine(cnl
);
152 void BackdropFilterList(struct BackDropList
*bdl
, BPTR dirLock
)
154 struct ChainedLine
*cnl
;
158 d1(kprintf("%s/%s/%ld: START bdl=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, bdl
));
159 debugLock_d1(dirLock
);
161 if (BNULL
== dirLock
)
164 if (bdl
->bdl_Filtered
)
167 Path
= AllocPathBuffer();
171 oldDir
= CurrentDir(dirLock
);
173 if (!bdl
->bdl_Loaded
&& !bdl
->bdl_NotPresent
)
178 RootDirLock
= Lock(":", ACCESS_READ
);
179 debugLock_d1(RootDirLock
);
180 if (BNULL
== RootDirLock
)
183 // change to root directory of icon drawer
184 CurrentDir(RootDirLock
);
186 if (RETURN_OK
!= BackdropLoadList(bdl
))
196 bdl
->bdl_Filtered
= TRUE
;
198 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
199 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
; )
203 struct ChainedLine
*cnlNext
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
;;
205 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
207 stccpy(Path
, cnl
->cnl_Line
, Max_PathLen
);
214 tmpLock
= Lock(Path
, ACCESS_READ
);
215 debugLock_d1(tmpLock
);
218 if (LOCK_SAME
!= ScaSameLock(tmpLock
, dirLock
))
220 // delete entry from .backdrop
221 d1(kprintf("%s/%s/%ld: Filter Line <%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
223 Remove(&cnl
->cnl_Node
);
225 BackdropFreeChainedLine(cnl
);
233 FreePathBuffer(Path
);
236 d1(kprintf("%s/%s/%ld: END bdl=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, bdl
));
240 static LONG
BackdropWriteList(struct BackDropList
*bdl
)
242 struct ChainedLine
*cnl
;
243 LONG Result
= RETURN_OK
;
246 d1(kprintf("%s/%s/%ld: bdl=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, bdl
));
248 // remove obsolete entries which refer to non-existing icons
249 BackdropRemoveObsoleteEntriesFromBackdropFile(bdl
);
251 BackdropRemoveDuplicateEntriesFromBackdropFile(bdl
);
253 if (!bdl
->bdl_Changed
)
254 return RETURN_OK
; // No changes
256 fh
= Open(".backdrop", MODE_NEWFILE
);
257 if ((BPTR
)NULL
== fh
)
260 while ((cnl
= (struct ChainedLine
*) RemHead(&bdl
->bdl_LinesList
)) && RETURN_OK
== Result
)
262 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
264 if (-1 == FPrintf(fh
, "%s\n", (IPTR
) cnl
->cnl_Line
))
270 bdl
->bdl_Changed
= FALSE
;
276 BOOL
BackdropAddLine(struct BackDropList
*bdl
, CONST_STRPTR NewLine
, LONG PosX
, LONG PosY
)
278 struct ChainedLine
*cnl
;
280 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
281 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
;
282 cnl
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
)
284 if (0 == Stricmp(NewLine
, cnl
->cnl_Line
))
286 // Duplicate line, ignore it silently
291 return BackdropInternalAddLine(bdl
, NewLine
, PosX
, PosY
);
295 static BOOL
BackdropInternalAddLine(struct BackDropList
*bdl
, CONST_STRPTR NewLine
, LONG PosX
, LONG PosY
)
297 BOOL Success
= FALSE
;
298 struct ChainedLine
*cnl
;
300 cnl
= BackdropAllocChainedLine(NewLine
);
303 AddTail(&bdl
->bdl_LinesList
, (struct Node
*) &cnl
->cnl_Node
);
304 bdl
->bdl_Changed
= TRUE
;
305 cnl
->cnl_PosX
= PosX
;
306 cnl
->cnl_PosY
= PosY
;
314 BOOL
BackdropRemoveLine(struct BackDropList
*bdl
, BPTR iconLock
)
316 struct ChainedLine
*cnl
;
320 d1(kprintf("%s/%s/%ld: bsl=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, bdl
));
321 debugLock_d1(iconLock
);
323 Path
= AllocPathBuffer();
327 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
328 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
; )
331 struct ChainedLine
*cnlNext
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
;
333 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
335 stccpy(Path
, cnl
->cnl_Line
, Max_PathLen
);
336 SafeStrCat(Path
, ".info", Max_PathLen
);
338 tmpLock
= Lock(Path
, ACCESS_READ
);
341 if (LOCK_SAME
== ScaSameLock(tmpLock
, iconLock
))
343 // delete entry from .backdrop
344 d1(kprintf("%s/%s/%ld: Delete Line <%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
346 Found
= bdl
->bdl_Changed
= TRUE
;
348 Remove(&cnl
->cnl_Node
);
350 BackdropFreeChainedLine(cnl
);
358 FreePathBuffer(Path
);
364 static struct ChainedLine
*BackdropAllocChainedLine(CONST_STRPTR TextLine
)
366 struct ChainedLine
*cnl
= ScalosAlloc(sizeof(struct ChainedLine
));
371 cnl
->cnl_PosX
= cnl
->cnl_PosY
= NO_ICON_POSITION
;
372 cnl
->cnl_Line
= AllocCopyString(TextLine
);
378 static void BackdropFreeChainedLine(struct ChainedLine
*cnl
)
381 FreeCopyString(cnl
->cnl_Line
); // allocated by AllocCopyString()
387 // rewrite ".backdrop" file
388 // <in> is only used to access the volume's root directory
389 BOOL
RewriteBackdrop(struct ScaIconNode
*in
)
391 BOOL Success
= FALSE
;
393 BPTR oldDir
= CurrentDir(in
->in_Lock
);
395 d1(kprintf("%s/%s/%ld: in=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, GetIconName(in
)));
397 rootDirLock
= Lock(":", ACCESS_READ
);
398 debugLock_d1(rootDirLock
);
401 struct BackDropList bdl
;
403 CurrentDir(rootDirLock
);
405 d1(kprintf("%s/%s/%ld: rootDirLock OK\n", __FILE__
, __FUNC__
, __LINE__
));
407 if (RETURN_OK
== BackdropLoadList(&bdl
))
409 d1(kprintf("%s/%s/%ld: LoadBackdropFile OK - GO BackdropWriteList(&bdl)\n", __FILE__
, __FUNC__
, __LINE__
));
411 // Write .backdrop if it has any changes
412 BackdropWriteList(&bdl
);
417 BackdropFreeList(&bdl
);
428 // adjust ".backdrop" for changed name of object <oLock>
429 // <oLock> is Lock to object.
430 // <in> is the old backdrop icon
431 ULONG
AdjustBackdropRenamed(BPTR oLock
, struct ScaIconNode
*in
)
433 CONST_STRPTR OldPathStart
;
435 STRPTR OldPath
= NULL
;
438 BPTR oldDir
= NOT_A_LOCK
;
439 BPTR NewParentDir
= (BPTR
)NULL
, rootLock
= (BPTR
)NULL
;
440 struct BackDropList bdl
;
441 struct ChainedLine
*cnl
;
442 BOOL WasChanged
= FALSE
;
444 d1(kprintf("%s/%s/%ld: oLock=%08lx OldPath=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, oLock
, OldPath
));
446 BackDropInitList(&bdl
);
449 NewPath
= AllocPathBuffer();
452 Result
= ERROR_NO_FREE_STORE
;
456 OldPath
= AllocPathBuffer();
459 Result
= ERROR_NO_FREE_STORE
;
463 if (!NameFromLock(in
->in_Lock
, OldPath
, Max_PathLen
-1))
469 if (!AddPart(OldPath
, in
->in_Name
, Max_PathLen
-1))
475 NewParentDir
= ParentDir(oLock
);
476 if ((BPTR
)NULL
== NewParentDir
)
482 if (!NameFromLock(oLock
, NewPath
, Max_PathLen
-1))
488 OldPathStart
= strchr(OldPath
, ':');
489 if (NULL
== OldPathStart
)
490 OldPathStart
= OldPath
;
492 NewPathStart
= strchr(NewPath
, ':');
493 if (NULL
== NewPathStart
)
494 NewPathStart
= NewPath
;
496 StripIconExtension(NewPath
);
498 d1(kprintf("%s/%s/%ld: OldPath=<%s> NewPath=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, OldPath
, NewPath
));
499 d1(kprintf("%s/%s/%ld: OldPathStart=<%s> NewPathStart=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, OldPathStart
, NewPathStart
));
501 oldDir
= CurrentDir(NewParentDir
);
503 rootLock
= Lock(":", ACCESS_READ
);
508 if ((BPTR
)NULL
== rootLock
)
514 oldDir
= CurrentDir(rootLock
);
516 Result
= BackdropLoadList(&bdl
);
517 if (RETURN_OK
!= Result
)
520 for (cnl
= (struct ChainedLine
*) bdl
.bdl_LinesList
.lh_Head
;
521 RETURN_OK
== Result
&& cnl
!= (struct ChainedLine
*) &bdl
.bdl_LinesList
.lh_Tail
;
522 cnl
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
)
524 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
526 if (0 == Stricmp((STRPTR
) OldPathStart
, cnl
->cnl_Line
))
528 // changed entry found
529 FreeCopyString(cnl
->cnl_Line
);
530 cnl
->cnl_Line
= AllocCopyString(NewPathStart
);
531 bdl
.bdl_Changed
= WasChanged
= TRUE
;
535 BackdropWriteList(&bdl
);
538 BackdropFreeList(&bdl
);
542 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
543 struct ExtGadget
*gg
= (struct ExtGadget
*) in
->in_Icon
;
544 struct ScaUpdateIcon_IW siw
;
545 struct ScaWindowStruct
*sw
;
548 siw
.ui_iw_Lock
= NewParentDir
;
549 siw
.ui_iw_Name
= FilePart(NewPath
);
550 //siw.ui_IconType = ICONTYPE_NONE;
552 d1(KPrintF("%s/%s/%ld: Lock=%08lx Name=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, siw
.ui_iw_Lock
, siw
.ui_iw_Name
));
557 DoMethod(iwtMain
->iwt_WindowTask
.mt_MainObject
, SCCM_DeviceWin_RemIcon
, in
);
559 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
561 AddBackdropIcon(siw
.ui_iw_Lock
, siw
.ui_iw_Name
, x
, y
);
563 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
565 // remove icon from owning drawer window
566 // search owning drawer window by Lock
567 SCA_LockWindowList(SCA_LockWindowList_Shared
);
569 for (sw
=winlist
.wl_WindowStruct
; sw
; sw
= (struct ScaWindowStruct
*) sw
->ws_Node
.mln_Succ
)
572 LOCK_SAME
== ScaSameLock(sw
->ws_Lock
, siw
.ui_iw_Lock
))
574 // owning drawer window found
575 struct internalScaWindowTask
*iwt
= (struct internalScaWindowTask
*) sw
->ws_WindowTask
;
577 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
579 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
,
580 SCCM_IconWin_RemIcon
,
584 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
587 SCA_UnLockWindowList();
591 FreePathBuffer(OldPath
);
593 FreePathBuffer(NewPath
);
594 if (IS_VALID_LOCK(oldDir
))
597 UnLock(NewParentDir
);
605 struct ScaIconNode
*AddBackdropIcon(BPTR iconDirLock
, CONST_STRPTR iconName
, WORD PosX
, WORD PosY
)
607 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
608 struct ScaIconNode
*inMain
;
609 struct DevProc
*devproc
;
610 BOOL IconAlreadyPresent
= FALSE
;
612 d1(KPrintF("%s/%s/%ld: START iconName=<%s> x=%ld y=%ld\n", __FILE__
, __FUNC__
, __LINE__
, iconName
, PosX
, PosY
));
613 debugLock_d1(iconDirLock
);
616 ScalosLockIconListExclusive(iwtMain
);
618 for (inMain
= iwtMain
->iwt_WindowTask
.wt_IconList
; inMain
; inMain
=(struct ScaIconNode
*) inMain
->in_Node
.mln_Succ
)
620 d1(KPrintF("%s/%s/%ld: in_Name=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inMain
->in_Name
));
622 if (inMain
->in_Lock
&& (LOCK_SAME
== SameLock(inMain
->in_Lock
, iconDirLock
))
623 && inMain
->in_Name
&& 0 == Stricmp((STRPTR
) iconName
, inMain
->in_Name
))
625 IconAlreadyPresent
= TRUE
;
626 d1(KPrintF("%s/%s/%ld: iconName=<%> inMain->in_Name=<%s> IconAlreadyPresent=[%ld]\n", __FILE__
, __FUNC__
, __LINE__
, \
627 iconName
, inMain
->in_Name
, IconAlreadyPresent
));
631 ScalosUnLockIconList(iwtMain
);
633 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
635 // Abort here if we already have a backdrop icon with same lock and name
636 if (IconAlreadyPresent
)
638 d1(KPrintF("%s/%s/%ld: icon already present: iconName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, iconName
));
642 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
644 // !! PosX and PosY have to be concatenated from 2 WORD into 1 LONG parameter !!
646 // add icon to desktop window
647 inMain
= (struct ScaIconNode
*) DoMethod(iwtMain
->iwt_WindowTask
.mt_MainObject
,
648 SCCM_IconWin_AddIcon
,
649 SCCM_ADDICON_MAKEXY(PosX
, PosY
),
653 d1(kprintf("%s/%s/%ld: iconName=<%> PosX=%ld PosY=%ld pos=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iconName
, PosX
, PosY
, (((UWORD
) PosX
) << 16) | ((UWORD
) PosY
)));
655 devproc
= GetDeviceProc(":", NULL
);
658 d1(KPrintF("%s/%s/%ld: GetDeviceProc failed iconName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, iconName
));
662 ScalosLockIconListExclusive(iwtMain
);
664 d1(kprintf("%s/%s/%ld: inMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inMain
));
665 d1(kprintf("%s/%s/%ld: devproc=%08lx Port=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, devproc
, devproc
->dvp_Port
));
666 debugLock_d1(iconDirLock
);
670 BOOL VolumeIsWritable
;
672 d1(kprintf("%s/%s/%ld: inMain=%08lx in_Icon=%08lx in_Lock=%08lx\n", \
673 __FILE__
, __FUNC__
, __LINE__
, inMain
, inMain
->in_Icon
, inMain
->in_Lock
));
675 VolumeIsWritable
= ClassIsDiskWritable(iconDirLock
);
677 d1(kprintf("%s/%s/%ld: VolumeIsWritable=%ld\n", __FILE__
, __FUNC__
, __LINE__
, VolumeIsWritable
));
679 // Do not set ICONOVERLAYF_LeftOut here, icon was perhaps just dropped!
680 // Check if is a real permanent backdrop icon before.
681 SetAttrs(inMain
->in_Icon
,
682 IDTA_OverlayType
, ICONOVERLAYF_LeftOut
,
685 if (VolumeIsWritable
)
687 struct BackDropList bdl
;
689 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
691 // Check if is a real permanent backdrop icon before to set ICONOVERLAYF_LeftOut Overlay type flag.
692 BackDropInitList(&bdl
);
695 if (IsPermanentBackDropIcon(iwtMain
, &bdl
, iconDirLock
, GetIconName(inMain
)))
697 d1(KPrintF("%s/%s/%ld: PermanentBackDropIcon=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, GetIconName(inMain
)));
699 SetAttrs(inMain
->in_Icon
,
700 IDTA_OverlayType
, ICONOVERLAYF_LeftOut
,
703 inMain
->in_SupportFlags
|= INF_SupportsPutAway
;
704 inMain
->in_SupportFlags
&= ~INF_SupportsLeaveOut
;
706 d1(KPrintF("%s/%s/%ld: Permanent BackDrop Icon=<%s> ICONOVERLAYF_LeftOut is SET - Icon Supportflags UPDATED!\n", \
707 __FILE__
, __FUNC__
, __LINE__
, GetIconName(inMain
)));
709 BackdropRedrawMainIconObject(iwtMain
, inMain
->in_Icon
);
713 d1(kprintf("%s/%s/%ld: Not Permanent BackDrop Icon=<%s> ICONOVERLAYF_LeftOut NOT SET - Icon Supportflags UPDATED!\n",\
714 __FILE__
, __FUNC__
, __LINE__
, GetIconName(inMain
)));
716 inMain
->in_SupportFlags
&= ~INF_SupportsPutAway
;
717 inMain
->in_SupportFlags
|= INF_SupportsLeaveOut
;
720 BackdropFreeList(&bdl
);
724 d1(kprintf("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
725 inMain
->in_SupportFlags
&= ~INF_SupportsPutAway
;
726 inMain
->in_SupportFlags
&= ~INF_SupportsLeaveOut
;
729 CreateSbiForIcon(inMain
);
732 ScalosUnLockIconList(iwtMain
);
734 FreeDeviceProc(devproc
);
736 d1(kprintf("%s/%s/%ld: END inMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inMain
));
742 struct ScaIconNode
*FindBackdropIcon(BPTR dirLock
, CONST_STRPTR iconName
)
744 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
745 struct ScaIconNode
*in
, *inFound
= NULL
;
749 d1(kprintf("%s/%s/%ld: iwtMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
753 d1(KPrintF("%s/%s/%ld: iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
755 ScalosLockIconListShared(iwtMain
);
757 for (in
=iwtMain
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
760 LOCK_SAME
== ScaSameLock(in
->in_Lock
, dirLock
) &&
761 0 == Stricmp(iconName
, GetIconName(in
)))
763 d1(kprintf("%s/%s/%ld: iwtMain=%08lx in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
, in
, GetIconName(in
)));
770 ScalosUnLockIconList(iwtMain
);
772 d1(kprintf("%s/%s/%ld: inFound=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inFound
));
778 struct ScaIconNode
*FindBackdropIconExclusive(BPTR dirLock
, CONST_STRPTR iconName
)
780 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
781 struct ScaIconNode
*in
, *inFound
= NULL
;
785 d1(kprintf("%s/%s/%ld: iwtMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
789 d1(KPrintF("%s/%s/%ld: iwt=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
791 ScalosLockIconListExclusive(iwtMain
);
793 for (in
=iwtMain
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
795 if (LOCK_SAME
== ScaSameLock(in
->in_Lock
, dirLock
) &&
796 0 == Stricmp(iconName
, GetIconName(in
)))
798 d1(kprintf("%s/%s/%ld: iwtMain=%08lx in=%08lx <%s>\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
, in
, GetIconName(in
)));
805 ScalosUnLockIconList(iwtMain
);
807 d1(kprintf("%s/%s/%ld: inFound=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, inFound
));
813 static void BackdropRemoveObsoleteEntriesFromBackdropFile(struct BackDropList
*bdl
)
816 struct ChainedLine
*cnl
;
818 IconPath
= AllocPathBuffer();
819 if (NULL
== IconPath
)
822 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
823 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
; )
825 struct ChainedLine
*cnlNext
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
;
829 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
831 // clean up .backdrop
832 // check if icon exists that this .backdrop line refers to
833 stccpy(IconPath
, cnl
->cnl_Line
, Max_PathLen
- 1);
834 SafeStrCat(IconPath
, ".info", Max_PathLen
- 1);
836 d1(kprintf("%s/%s/%ld: IconPath=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, IconPath
));
838 fLock
= Lock(IconPath
, ACCESS_READ
);
839 if ((BPTR
)NULL
== fLock
)
841 LockResult
= IoErr();
845 LockResult
= RETURN_OK
;
849 d1(kprintf("%s/%s/%ld: LockResult=%ld\n", __FILE__
, __FUNC__
, __LINE__
, LockResult
));
851 if (ERROR_OBJECT_NOT_FOUND
== LockResult
)
853 d1(kprintf("%s/%s/%ld: LockResult=%ld - GO Remove <%s> \n", __FILE__
, __FUNC__
, __LINE__
, LockResult
, cnl
->cnl_Line
));
854 Remove(&cnl
->cnl_Node
);
855 BackdropFreeChainedLine(cnl
);
856 bdl
->bdl_Changed
= TRUE
;
862 FreePathBuffer(IconPath
);
865 //----------------------------------------------------------------------------
867 static void BackdropRemoveDuplicateEntriesFromBackdropFile(struct BackDropList
*bdl
)
870 struct ChainedLine
*cnl
;
872 IconPath
= AllocPathBuffer();
873 if (NULL
== IconPath
)
876 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
877 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
;
878 cnl
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
)
881 struct ChainedLine
*cnl2
;
883 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
885 for (cnl2
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
886 cnl2
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
; )
888 struct ChainedLine
*cnl2Next
= (struct ChainedLine
*) cnl2
->cnl_Node
.ln_Succ
;
890 if ((cnl2
!= cnl
) && (0 == Stricmp(cnl2
->cnl_Line
, cnl
->cnl_Line
)) )
892 // Remove Duplicate line
893 d1(kprintf("%s/%s/%ld: GO Remove <%s> \n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
894 Remove(&cnl2
->cnl_Node
);
895 BackdropFreeChainedLine(cnl2
);
896 bdl
->bdl_Changed
= TRUE
;
903 cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
906 FreePathBuffer(IconPath
);
909 //----------------------------------------------------------------------------
910 void DoLeaveOutIcon(struct internalScaWindowTask
*iwt
, BPTR DirLock
,
911 CONST_STRPTR IconName
, WORD x
, WORD y
)
913 struct BackDropList bdl
;
914 BPTR oldDir
= NOT_A_LOCK
;
915 BPTR rootLock
= (BPTR
)NULL
;
916 char *lp
, *DirName
= NULL
;
918 d1(KPrintF("%s/%s/%ld: START Icon=<%s> Lock=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, IconName
, DirLock
));
919 debugLock_d1(DirLock
);
921 BackDropInitList(&bdl
);
924 if (IsPermanentBackDropIcon(iwt
, &bdl
, DirLock
, IconName
))
925 break; // this is already a backdrop icon
927 d1(KPrintF("%s/%s/%ld: ws_Lock=%08lx DirLock=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
, DirLock
));
929 DirName
= AllocPathBuffer();
933 d1(KPrintF("%s/%s/%ld: DirName=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, DirName
));
935 if (!NameFromLock(DirLock
, DirName
, Max_PathLen
- 1))
938 d1(KPrintF("%s/%s/%ld: DirName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, DirName
));
940 if (!AddPart(DirName
, (STRPTR
) IconName
, Max_PathLen
- 1))
943 d1(KPrintF("%s/%s/%ld: DirName = <%s>\n", __FILE__
, __FUNC__
, __LINE__
, DirName
));
945 oldDir
= CurrentDir(DirLock
);
947 rootLock
= Lock(":", ACCESS_READ
);
948 if ((BPTR
)NULL
== rootLock
)
953 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
955 if ((BPTR
)NULL
== rootLock
)
958 oldDir
= CurrentDir(rootLock
);
959 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
961 if (RETURN_OK
!= BackdropLoadList(&bdl
))
964 lp
= strchr(DirName
, ':');
968 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
970 if (!BackdropAddLine(&bdl
, lp
, x
, y
))
973 ShortcutAddEntry(DirName
, x
, y
);
975 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
977 BackdropWriteList(&bdl
);
979 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
981 if (iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
)
983 d1(KPrintF("%s/%s/%ld: AddBackdropIcon(%08lx, %s, x, y)\n", __FILE__
, __FUNC__
, __LINE__
, \
984 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
, IconName
));
986 AddBackdropIcon(iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
,
989 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
991 // Special handling for "view all" textwindows.
992 // here both object and icon are separate entries, which must be removed both!
993 if (!IsIwtViewByIcon(iwt
) &&
994 IsShowAll(iwt
->iwt_WindowTask
.mt_WindowStruct
))
996 STRPTR IconInfoName
= ScalosAlloc(1 + strlen(IconName
) + strlen(".info"));
1000 strcpy(IconInfoName
, IconName
);
1001 strcat(IconInfoName
, ".info");
1003 // remove associated ".info" icon from owning drawer window
1004 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
,
1005 SCCM_IconWin_RemIcon
,
1006 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
,
1011 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1013 // remove icon from owning drawer window
1014 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
,
1015 SCCM_IconWin_RemIcon
,
1016 iwt
->iwt_WindowTask
.mt_WindowStruct
->ws_Lock
,
1021 // For icon dropped on desktop:
1022 // If ScaIconNode lock and name = DirLock and IconName then
1023 // update INF_SupportsPutAway and INF_SupportsLeaveOut flags.
1025 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
1026 struct ScaIconNode
*in
;
1028 ScalosLockIconListShared(iwtMain
);
1030 for (in
= iwtMain
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1032 if (LOCK_SAME
== ScaSameLock(in
->in_Lock
, DirLock
) &&
1033 0 == Stricmp(IconName
, GetIconName(in
)))
1035 d1(KPrintF("%s/%s/%ld: in_Lock=%08lx DirLock=%08lx in_Name=<%s> IconName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, \
1036 in
->in_Lock
, DirLock
, GetIconName(in
), IconName
));
1039 oldDir
= CurrentDir(DirLock
);
1040 in
->in_SupportFlags
|= INF_SupportsPutAway
;
1041 in
->in_SupportFlags
&= ~INF_SupportsLeaveOut
;
1043 SetAttrs(in
->in_Icon
,
1044 IDTA_OverlayType
, ICONOVERLAYF_LeftOut
,
1047 d1(KPrintF("%s/%s/%ld: ICONOVERLAYF_LeftOut is SET IconName=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, GetIconName(in
)));
1048 BackdropRedrawMainIconObject(iwtMain
, in
->in_Icon
);
1053 ScalosUnLockIconList(iwtMain
);
1056 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1059 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1061 BackdropFreeList(&bdl
);
1063 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1065 if (IS_VALID_LOCK(oldDir
))
1070 FreePathBuffer(DirName
);
1072 d1(KPrintF("%s/%s/%ld: END\n", __FILE__
, __FUNC__
, __LINE__
));
1075 //----------------------------------------------------------------------------
1077 BOOL
IsPermanentBackDropIcon(struct internalScaWindowTask
*iwt
, struct BackDropList
*bdl
,
1078 BPTR fLock
, CONST_STRPTR FileName
)
1080 BOOL IsBackdrop
= FALSE
;
1082 debugLock_d1(fLock
);
1083 d1(KPrintF("%s/%s/%ld: bdl=%08lx Loaded=%ld FileName=<%s>\n", \
1084 __FILE__
, __FUNC__
, __LINE__
, bdl
, bdl
->bdl_Loaded
, FileName
));
1086 if (!bdl
->bdl_Loaded
&& !bdl
->bdl_NotPresent
)
1092 oldDir
= CurrentDir(fLock
);
1094 DirLock
= Lock(":", ACCESS_READ
);
1095 debugLock_d1(DirLock
);
1096 if ((BPTR
)NULL
== DirLock
)
1099 // change to root directory of icon drawer
1100 CurrentDir(DirLock
);
1102 if (RETURN_OK
!= BackdropLoadList(bdl
))
1111 d1(kprintf("%s/%s/%ld: bdl=%08lx Loaded=%ld NotPresent=%ld bdl_Filtered=%ld\n", \
1112 __FILE__
, __FUNC__
, __LINE__
, bdl
, bdl
->bdl_Loaded
, bdl
->bdl_NotPresent
, bdl
->bdl_Filtered
));
1114 if (bdl
->bdl_Loaded
)
1116 if (bdl
->bdl_Filtered
)
1118 struct ChainedLine
*cnl
;
1120 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
1121 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
;
1122 cnl
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
)
1124 STRPTR lp
= FilePart(cnl
->cnl_Line
);
1126 d1(kprintf("%s/%s/%ld: lp=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, lp
));
1128 if (0 == Stricmp(FileName
, lp
))
1131 d1(kprintf("%s/%s/%ld: Line=<%s> IsBackdrop=[ %ld ]\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
, IsBackdrop
));
1140 struct ChainedLine
*cnl
;
1144 IconPath
= AllocPathBuffer();
1145 if (NULL
== IconPath
)
1148 if (!NameFromLock(fLock
, IconPath
, Max_PathLen
-1))
1151 if (!AddPart(IconPath
, (STRPTR
) FileName
, Max_PathLen
-1))
1154 d1(kprintf("%s/%s/%ld: IconPath=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, IconPath
));
1156 PathStart
= strchr(IconPath
, ':');
1157 if (NULL
== PathStart
)
1158 PathStart
= IconPath
;
1160 for (cnl
= (struct ChainedLine
*) bdl
->bdl_LinesList
.lh_Head
;
1161 cnl
!= (struct ChainedLine
*) &bdl
->bdl_LinesList
.lh_Tail
;
1162 cnl
= (struct ChainedLine
*) cnl
->cnl_Node
.ln_Succ
)
1164 d1(kprintf("%s/%s/%ld: Line=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
));
1166 if (0 == Stricmp((STRPTR
) PathStart
, cnl
->cnl_Line
))
1169 d1(kprintf("%s/%s/%ld: Line=<%s> IsBackdrop=[ %ld ]\n", __FILE__
, __FUNC__
, __LINE__
, cnl
->cnl_Line
, IsBackdrop
));
1177 FreePathBuffer(IconPath
);
1181 d1(KPrintF("%s/%s/%ld: IsBackdrop=%ld\n", __FILE__
, __FUNC__
, __LINE__
, IsBackdrop
));
1186 //----------------------------------------------------------------------------
1188 void PutAwayIcon(struct internalScaWindowTask
*iwt
,
1189 BPTR iconDirLock
, CONST_STRPTR IconName
, BOOL RemovePermanent
)
1192 BPTR iconLock
= (BPTR
)NULL
;
1193 BPTR rootLock
= (BPTR
)NULL
;
1194 struct BackDropList bdl
;
1196 struct ScaUpdateIcon_IW UpdateIcon
= { (BPTR
)NULL
, NULL
, ICONTYPE_NONE
};
1198 BackDropInitList(&bdl
);
1200 d1(KPrintF("%s/%s/%ld: Icon=<%s>\n", __FILE__
, __FUNC__
, __LINE__
, IconName
));
1201 debugLock_d1(iconDirLock
);
1204 debugLock_d1(iconDirLock
);
1206 oldDir
= CurrentDir(iconDirLock
);
1208 if (!IsPermanentBackDropIcon(iwt
, &bdl
, iconDirLock
, IconName
))
1210 // +jmc+ : This is not a backdrop icon(icon dropped) then remove object from main window.
1211 if (iwt
->iwt_WindowTask
.mt_WindowStruct
== iInfos
.xii_iinfos
.ii_MainWindowStruct
)
1213 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
1214 struct ScaIconNode
*in
;
1216 UpdateIcon
.ui_iw_Name
= AllocCopyString(IconName
);
1218 ScalosLockIconListExclusive(iwtMain
);
1219 for (in
= iwtMain
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1222 && LOCK_SAME
== SameLock(in
->in_Lock
, iconDirLock
)
1223 && 0 == Stricmp(IconName
, GetIconName(in
)))
1225 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_DeviceWin_RemIcon
, in
);
1226 d1(KPrintF("%s/%s/%ld: Not Permanent BackDrop Icon=<%s> removed from desktop\n", __FILE__
, __FUNC__
, __LINE__
, IconName
));
1230 ScalosUnLockIconList(iwtMain
);
1235 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1237 Path
= AllocPathBuffer();
1241 stccpy(Path
, IconName
, Max_PathLen
);
1242 SafeStrCat(Path
, ".info", Max_PathLen
);
1244 iconLock
= Lock(Path
, ACCESS_READ
);
1245 d1(KPrintF("%s/%s/%ld: IconName=<%s> iconLock=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, IconName
, iconLock
));
1246 if ((BPTR
)NULL
== iconLock
)
1249 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1251 if (RemovePermanent
)
1253 rootLock
= Lock(":", ACCESS_READ
);
1254 if ((BPTR
)NULL
== rootLock
)
1259 oldDir
= CurrentDir(rootLock
);
1261 BackdropRemoveLine(&bdl
, iconLock
);
1263 ShortcutRemoveEntry(iconLock
);
1265 CurrentDir(rootLock
);
1267 if (bdl
.bdl_Changed
)
1268 BackdropWriteList(&bdl
);
1271 if (iwt
->iwt_WindowTask
.mt_WindowStruct
== iInfos
.xii_iinfos
.ii_MainWindowStruct
)
1273 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
1274 struct ScaIconNode
*in
;
1276 UpdateIcon
.ui_iw_Name
= AllocCopyString(IconName
);
1278 // remove icon from main window
1279 ScalosLockIconListExclusive(iwtMain
);
1280 for (in
= iwtMain
->iwt_WindowTask
.wt_IconList
; in
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1283 && LOCK_SAME
== SameLock(in
->in_Lock
, iconDirLock
)
1284 && 0 == Stricmp(IconName
, GetIconName(in
)))
1286 DoMethod(iwt
->iwt_WindowTask
.mt_MainObject
, SCCM_DeviceWin_RemIcon
, in
);
1287 d1(KPrintF("%s/%s/%ld: Permanent BackDrop Icon=<%s> removed from desktop - Icon SupportsFalgs UPDATED!\n", \
1288 __FILE__
, __FUNC__
, __LINE__
, IconName
));
1292 ScalosUnLockIconList(iwtMain
);
1295 d1(KPrintF("%s/%s/%ld: Changed=%ld\n", __FILE__
, __FUNC__
, __LINE__
, bdl
.bdl_Changed
));
1298 d1(KPrintF("%s/%s/%ld: \n", __FILE__
, __FUNC__
, __LINE__
));
1300 BackdropFreeList(&bdl
);
1303 FreePathBuffer(Path
);
1304 if (UpdateIcon
.ui_iw_Name
)
1305 FreeCopyString(UpdateIcon
.ui_iw_Name
);
1306 if (IS_VALID_LOCK(oldDir
))
1308 if (UpdateIcon
.ui_iw_Lock
)
1309 UnLock(UpdateIcon
.ui_iw_Lock
);
1317 static void BackdropRedrawMainIconObject(struct internalScaWindowTask
*iwtMain
, Object
*IconObj
)
1319 struct SM_RedrawIconObj
*sMsg
;
1321 sMsg
= (struct SM_RedrawIconObj
*) SCA_AllocMessage(MTYP_RedrawIconObj
, 0);
1322 d1(KPrintF("%s/%s/%ld: sMsg=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, sMsg
));
1325 sMsg
->smrio_IconObject
= IconObj
;
1326 sMsg
->smrio_Flags
= SMRIOFLAGF_IconListLocked
;
1327 PutMsg(iwtMain
->iwt_WindowTask
.wt_IconPort
,
1328 &sMsg
->ScalosMessage
.sm_Message
);
1333 // Wait up to 2 seconds for completion of backdrop icon generation on desktop
1334 BOOL
BackdropWait(BPTR dirLock
)
1336 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
1337 struct ScaIconNode
*in
;
1341 if (NULL
== iwtMain
)
1343 d1(kprintf("%s/%s/%ld: iwtMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
1346 if (BNULL
== dirLock
)
1348 d1(kprintf("%s/%s/%ld: dirLock=0\n", __FILE__
, __FUNC__
, __LINE__
));
1352 d1(KPrintF("%s/%s/%ld: START iwtMain=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, iwtMain
));
1355 ScalosLockIconListShared(iwtMain
);
1357 for (in
=iwtMain
->iwt_WindowTask
.wt_IconList
; in
&& !Found
; in
= (struct ScaIconNode
*) in
->in_Node
.mln_Succ
)
1359 if (in
->in_DeviceIcon
)
1361 BPTR DeviceIconLock
= DiskInfoLock(in
);
1367 IsSameLock
= ScaSameLock(DeviceIconLock
, dirLock
);
1369 if (LOCK_SAME_VOLUME
== IsSameLock
|| LOCK_SAME
== IsSameLock
)
1371 d1(kprintf("%s/%s/%ld: Found Device Icon in=<%s> di_Flags=%08lx\n", \
1372 __FILE__
, __FUNC__
, __LINE__
, GetIconName(in
), \
1373 in
->in_DeviceIcon
->di_Flags
));
1374 Found
= in
->in_DeviceIcon
->di_Flags
& DIBF_BackdropReadComplete
;
1377 UnLock(DeviceIconLock
);
1382 ScalosUnLockIconList(iwtMain
);
1385 Delay(5); // wait 100 ms
1387 } while (!Found
&& (n
-- > 0));
1390 d1(kprintf("%s/%s/%ld: END Found=%ld\n", __FILE__
, __FUNC__
, __LINE__
, Found
));