Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / intuition / unlockpubscreen.c
blob479f4b2de40fd7324b5c23af7b201b060ed7b14b
1 /*
2 Copyright 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
9 /*****************************************************************************
11 NAME */
12 #include <proto/intuition.h>
14 AROS_LH2(void, UnlockPubScreen,
16 /* SYNOPSIS */
17 AROS_LHA(UBYTE *, name, A0),
18 AROS_LHA(struct Screen *, screen, A1),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 86, Intuition)
23 /* FUNCTION
24 Release a lock to a screen locked by LockPubScreen().
25 Identify screen by the pointer returned from LockPubScreen()
26 and pass NULL name in normal cases.
27 Sometimes it might be useful to specify the name string. In
28 this case the screen pointer will be ignored.
30 INPUTS
31 name - Name of the public screen to unlock
32 screen - Pointer to the screen to unlock
34 RESULT
36 NOTES
37 The screen parameter will be ignored if name is non-NULL
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 LockPubScreen()
46 INTERNALS
48 HISTORY
49 29-10-95 digulla automatically created from
50 intuition_lib.fd and clib/intuition_protos.h
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct List *publist;
58 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: name <%s> screen %p\n",
59 name ? name : "NULL", screen));
60 DEBUG_UNLOCKPUBSCREEN(dprintf("LockPubScreen: task %p <%s>\n",
61 SysBase->ThisTask,
62 SysBase->ThisTask->tc_Node.ln_Name ? SysBase->ThisTask->tc_Node.ln_Name : "NULL"));
64 publist = LockPubScreenList();
66 if (name != NULL)
68 struct PubScreenNode *psn;
70 /* Get screen by its name */
71 if ((psn = (struct PubScreenNode *)FindName(publist, name)))
72 screen = psn->psn_Screen;
73 else
74 screen = NULL;
76 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: found screen %p\n",
77 screen));
80 if (screen != NULL)
82 struct PubScreenNode *ps = GetPrivScreen(screen)->pubScrNode;
84 //ASSERT(GetPrivScreen(screen)->pubScrNode != NULL);
85 //ASSERT(GetPrivScreen(screen)->pubScrNode->psn_VisitorCount > 0);
87 /* Unlock screen */
88 ps->psn_VisitorCount--;
90 DEBUG_VISITOR(dprintf("UnlockPubScreen: count %d <%s>\n",
91 ps->psn_VisitorCount,
92 FindTask(NULL)->tc_Node.ln_Name));
95 DEBUG_UNLOCKPUBSCREEN(dprintf("UnlockPubScreen: count %d\n",
96 ps->psn_VisitorCount));
98 /* Notify screen owner if this is (was) the last window on the
99 screen */
100 if(ps->psn_VisitorCount == 0)
102 if(ps->psn_SigTask != NULL)
103 Signal(ps->psn_SigTask, 1 << ps->psn_SigBit);
108 UnlockPubScreenList();
110 FireScreenNotifyMessage((IPTR) name, SNOTIFY_UNLOCKPUBSCREEN, IntuitionBase);
112 AROS_LIBFUNC_EXIT
113 } /* UnlockPubScreen */