Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / boopsi / donotify.c
blobbe0dbbbc72749c10be3d9cb48a80159f605bedce
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ICClass notification support routines.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <intuition/classes.h>
12 #include <intuition/cghooks.h>
13 #include <intuition/icclass.h>
14 #include <proto/exec.h>
15 #include <proto/utility.h>
16 #include <proto/boopsi.h>
17 #include <proto/intuition.h>
19 #include "intern.h"
22 Note: This file is essentially the contents of the file
23 rom/intuition/notify.c which contained code used by the icclass
24 and gadgetclass in caldi's first implementation. It was split
25 by iaint for the new boopsi.library.
30 This will hopefully allow us to send an IDCMP message from a boopsi
31 gadget method.
34 static struct IntuiMessage *SendIDCMPUpdate(
35 Class *cl,
36 Object *o,
37 struct opUpdate *msg,
38 ULONG class,
39 UWORD code,
40 APTR IAddress,
41 struct Library *BOOPSIBase)
43 struct IntuiMessage *imsg;
45 imsg = AllocIntuiMessage(msg->opu_GInfo->gi_Window);
47 if( imsg )
49 imsg->Class = class;
50 imsg->Code = code;
51 imsg->Qualifier = 0;
52 imsg->IAddress = IAddress;
53 imsg->MouseX = 0;
54 imsg->MouseY = 0;
55 imsg->Seconds = 0;
56 imsg->Micros = 0;
58 /* done by AllocIntuiMessage
59 imsg->IDCMPWindow = msg->opu_GInfo->gi_Window;
62 SendIntuiMessage(msg->opu_GInfo->gi_Window , imsg);
66 return imsg;
69 /*****i***********************************************************************
71 NAME */
73 AROS_LH4(IPTR, DoNotify,
75 /* SYNOPSIS */
76 AROS_LHA(Class *, cl, A0),
77 AROS_LHA(Object *, o, A1),
78 AROS_LHA(struct ICData *, ic, A2),
79 AROS_LHA(struct opUpdate *, msg, A3),
81 /* LOCATION */
82 struct Library *, BOOPSIBase, 16, BOOPSI)
84 /* FUNCTION
85 This function provides a way for icclass objects to notify
86 their listeners when they are notifying. It is mainly
87 provided as an external function for intuition.library's
88 gadgetclass implementation, which contains an inbuilt
89 icclass.
91 INPUTS
92 cl - my class
93 o - this object
94 icdata - interconnection information
95 msg - the message given to the OM_NOTIFY method
97 RESULT
98 The objects listening to this object will be notified.
100 Note: Return value not clear.
102 NOTES
104 EXAMPLE
106 BUGS
108 SEE ALSO
110 INTERNALS
112 HISTORY
114 ******************************************************************************/
116 AROS_LIBFUNC_INIT
118 if( ic->ic_Target != NULL )
120 if( msg->opu_AttrList) /* stegerg: ??? checked also "&& msg->opu_GInfo" ) */
122 ic->ic_LoopCounter += 1UL;
124 /* Don't get into a circular notify target loop */
125 if( ic->ic_LoopCounter == 1UL )
127 if(( ic->ic_CloneTags = CloneTagItems(msg->opu_AttrList)))
129 if( ic->ic_Mapping != NULL )
131 MapTags(ic->ic_CloneTags, ic->ic_Mapping, TRUE);
134 if( ic->ic_Target != (Object *)ICTARGET_IDCMP)
136 DoMethod( ic->ic_Target,
137 OM_UPDATE,
138 ic->ic_CloneTags,
139 msg->opu_GInfo,
140 msg->opu_Flags);
142 FreeTagItems(ic->ic_CloneTags);
143 ic->ic_CloneTags = NULL;
145 else
147 if (msg->opu_GInfo)
148 if (msg->opu_GInfo->gi_Window)
149 if (msg->opu_GInfo->gi_Window->UserPort)
150 if (msg->opu_GInfo->gi_Window->IDCMPFlags & IDCMP_IDCMPUPDATE)
152 struct TagItem *ti;
153 UWORD code = 0;
155 if ((ti = FindTagItem(ICSPECIAL_CODE, ic->ic_CloneTags)))
157 code = ti->ti_Data & 0xFFFF;
159 SendIDCMPUpdate( cl, o, msg, IDCMP_IDCMPUPDATE,
160 code, ic->ic_CloneTags, BOOPSIBase );
162 /* in this case the cloned tagitems will be freed in the Intuition
163 InputHandler when the app has replied the IntuiMessage */
165 ic->ic_CloneTags = NULL;
168 /* if IDCMP_IDCMPUPDATE msg could not be sent, free taglist */
170 if (ic->ic_CloneTags)
172 FreeTagItems(ic->ic_CloneTags);
173 ic->ic_CloneTags = NULL;
178 } /* CloneTagItems() */
180 } /* LoopCounter == 1UL */
182 ic->ic_LoopCounter -= 1UL;
184 } /* valid parameters */
186 } /* valid target */
188 return 1UL;
190 AROS_LIBFUNC_EXIT
192 } /* DoNotify() */