Added 'Resident' field to ensure that the handler is included in the
[AROS.git] / rom / intuition / startscreennotifytaglist.c
blobf8c824a232c9aa37f4901a886c94dcd00ba4fa77
1 /*
2 Copyright 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 Add a Intuition Notification.
7 */
9 #include <intuition/intuition.h>
11 #include "intuition_intern.h"
13 /*****************************************************************************
15 NAME */
17 #include <proto/exec.h>
18 #include <proto/intuition.h>
19 #include <proto/utility.h>
21 AROS_LH1(APTR, StartScreenNotifyTagList,
23 /* SYNOPSIS */
24 AROS_LHA(struct TagItem *, tags, A0),
26 /* LOCATION */
27 struct IntuitionBase *, IntuitionBase, 154, Intuition)
29 /* FUNCTION
30 Add Notifications to Intuition. You will be notified when
31 the screen changes.
33 INPUTS
34 tags - see below
36 TAGS
37 SNA_PubName (STRPTR) - Name of the public screen. NULL means
38 you'll get notifications for all screens.
39 SNA_MsgPort (struct MsgPort*) - Notifications will be sent to this port.
40 SNA_SigBit (BYTE) - The signal bit to use
41 SNA_SigTask (struct Task*) - The task to signal
42 SNA_UserData (IPTR) - For your personal use. Will be copied
43 into snm_UserData of the messages you receive
44 SNA_Hook (struct Hook*)
45 SNA_Priority (Byte) - Priority in the notification queue.
46 SNA_Notify (ULONG) - SNOTIFY_ flags, see intuition/intuition.h
48 RESULT
49 The value is private, only a test against ZERO is allowed and means Failure
51 NOTES
52 This function is compatible with AmigaOS v4.
54 EXAMPLE
56 BUGS
58 SEE ALSO
59 EndScreenNotify()
61 INTERNALS
63 HISTORY
65 *****************************************************************************/
67 AROS_LIBFUNC_INIT
68 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
69 struct IntScreenNotify *notify;
71 notify = (struct IntScreenNotify *) AllocVec(sizeof(struct IntScreenNotify), MEMF_CLEAR);
73 if (notify)
75 notify->port = (struct MsgPort *) GetTagData(SNA_MsgPort, 0, tags);
76 notify->sigbit = (BYTE) GetTagData(SNA_SigBit, 0, tags);
77 notify->sigtask = (struct Task *) GetTagData(SNA_SigTask, 0, tags);
78 notify->flags = (ULONG) GetTagData(SNA_Notify, 0, tags);
79 notify->userdata = (IPTR) GetTagData(SNA_UserData, 0, tags);
80 notify->hook = (struct Hook *) GetTagData(SNA_Hook, 0, tags);
81 notify->node.ln_Pri = (BYTE) GetTagData(SNA_Priority, 0, tags);
82 notify->pubname = NULL;
84 char *pubname = (char *) GetTagData(SNA_PubName, 0, tags);
85 if (pubname)
87 notify->pubname = AllocVec(strlen(pubname) + 1, MEMF_CLEAR);
88 if (notify->pubname)
90 strcpy(notify->pubname, pubname);
92 else
94 FreeVec(notify);
95 notify = NULL;
98 if (notify)
100 ObtainSemaphore(&GetPrivIBase(IntuitionBase)->ScreenNotificationListLock);
101 Enqueue(&GetPrivIBase(IntuitionBase)->ScreenNotificationList, (struct Node *) notify);
102 ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->ScreenNotificationListLock);
106 ReturnPtr ("StartScreenNotifyTagList", APTR, notify);
108 AROS_LIBFUNC_EXIT
109 } /* StartScreenNotifyTagList */