2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include "intuition_intern.h"
9 static struct PubScreenNode
*findcasename(struct List
*list
, const UBYTE
*name
);
11 /*****************************************************************************
14 #include <proto/intuition.h>
16 AROS_LH2(void, UnlockPubScreen
,
19 AROS_LHA(UBYTE
*, name
, A0
),
20 AROS_LHA(struct Screen
*, screen
, A1
),
23 struct IntuitionBase
*, IntuitionBase
, 86, Intuition
)
26 Release a lock to a screen locked by LockPubScreen().
27 Identify screen by the pointer returned from LockPubScreen()
28 and pass NULL name in normal cases.
30 Sometimes it might be useful to specify the name string. In
31 this case the screen pointer will be ignored.
34 name - Name of the public screen to unlock. The name is case
36 screen - Pointer to the screen to unlock.
42 The screen parameter will be ignored if name is non-NULL.
53 *****************************************************************************/
59 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: name <%s> screen %p\n",
60 name
? (const char *)name
: "NULL", screen
));
61 DEBUG_UNLOCKPUBSCREEN({struct Task
*t
= FindTask(NULL
);
62 dprintf("LockPubScreen: task %p <%s>\n",
64 t
->tc_Node
.ln_Name
? t
->tc_Node
.ln_Name
: "NULL"));
66 publist
= LockPubScreenList();
70 struct PubScreenNode
*psn
;
72 /* Get screen by its name */
73 if ((psn
= findcasename(publist
, name
)))
74 screen
= psn
->psn_Screen
;
78 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: found screen %p\n",
84 struct PubScreenNode
*ps
= GetPrivScreen(screen
)->pubScrNode
;
86 //ASSERT(GetPrivScreen(screen)->pubScrNode != NULL);
87 //ASSERT(GetPrivScreen(screen)->pubScrNode->psn_VisitorCount > 0);
90 ps
->psn_VisitorCount
--;
92 DEBUG_VISITOR(dprintf("UnlockPubScreen: count %d <%s>\n",
94 FindTask(NULL
)->tc_Node
.ln_Name
));
97 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: count %d\n",
98 ps
->psn_VisitorCount
));
100 /* Notify screen owner if this is (was) the last window on the
102 if(ps
->psn_VisitorCount
== 0)
104 if(ps
->psn_SigTask
!= NULL
)
105 Signal(ps
->psn_SigTask
, 1 << ps
->psn_SigBit
);
110 UnlockPubScreenList();
112 FireScreenNotifyMessage((IPTR
) name
, SNOTIFY_UNLOCKPUBSCREEN
, IntuitionBase
);
115 } /* UnlockPubScreen */
118 /* case insensitive FindName() */
119 static struct PubScreenNode
*findcasename(struct List
*list
, const UBYTE
*name
)
123 for (node
= GetHead(list
); node
; node
= GetSucc(node
))
127 if (!strcasecmp (node
->ln_Name
, name
))
131 return (struct PubScreenNode
*)node
;