Check for SYS/GL during library init. Reason is that
[AROS.git] / rom / intuition / startscreennotifytaglist.c
blobc492ae3816e03a086eb22d8264949537f34227b0
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 Add an 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
39 screens.
40 SNA_MsgPort (struct MsgPort*) - Notifications will be sent to this
41 port.
42 SNA_SigBit (BYTE) - The signal bit to use
43 SNA_SigTask (struct Task*) - The task to signal
44 SNA_UserData (IPTR) - For your personal use. Will be copied
45 into snm_UserData of the messages you
46 receive.
47 SNA_Hook (struct Hook*)
48 SNA_Priority (Byte) - Priority in the notification queue.
49 SNA_Notify (ULONG) - SNOTIFY_ flags, see
50 intuition/intuition.h
52 RESULT
53 The value is private; only a test against ZERO is allowed and means
54 Failure.
56 NOTES
57 This function is compatible with AmigaOS v4.
59 EXAMPLE
61 BUGS
63 SEE ALSO
64 EndScreenNotify()
66 INTERNALS
68 *****************************************************************************/
70 AROS_LIBFUNC_INIT
71 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
72 struct IntScreenNotify *notify;
74 notify = (struct IntScreenNotify *) AllocVec(sizeof(struct IntScreenNotify), MEMF_CLEAR);
76 if (notify)
78 notify->port = (struct MsgPort *) GetTagData(SNA_MsgPort, 0, tags);
79 notify->sigbit = (BYTE) GetTagData(SNA_SigBit, 0, tags);
80 notify->sigtask = (struct Task *) GetTagData(SNA_SigTask, 0, tags);
81 notify->flags = (ULONG) GetTagData(SNA_Notify, 0, tags);
82 notify->userdata = (IPTR) GetTagData(SNA_UserData, 0, tags);
83 notify->hook = (struct Hook *) GetTagData(SNA_Hook, 0, tags);
84 notify->node.ln_Pri = (BYTE) GetTagData(SNA_Priority, 0, tags);
85 notify->pubname = NULL;
87 char *pubname = (char *) GetTagData(SNA_PubName, 0, tags);
88 if (pubname)
90 notify->pubname = AllocVec(strlen(pubname) + 1, MEMF_CLEAR);
91 if (notify->pubname)
93 strcpy(notify->pubname, pubname);
95 else
97 FreeVec(notify);
98 notify = NULL;
101 if (notify)
103 ObtainSemaphore(&GetPrivIBase(IntuitionBase)->ScreenNotificationListLock);
104 Enqueue(&GetPrivIBase(IntuitionBase)->ScreenNotificationList, (struct Node *) notify);
105 ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->ScreenNotificationListLock);
109 ReturnPtr ("StartScreenNotifyTagList", APTR, notify);
111 AROS_LIBFUNC_EXIT
112 } /* StartScreenNotifyTagList */