2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: ICClass notification support routines.
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>
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
34 static struct IntuiMessage
*SendIDCMPUpdate(
41 struct Library
*BOOPSIBase
)
43 struct IntuiMessage
*imsg
;
45 imsg
= AllocIntuiMessage(msg
->opu_GInfo
->gi_Window
);
52 imsg
->IAddress
= IAddress
;
58 /* done by AllocIntuiMessage
59 imsg->IDCMPWindow = msg->opu_GInfo->gi_Window;
62 SendIntuiMessage(msg
->opu_GInfo
->gi_Window
, imsg
);
69 /*****i***********************************************************************
73 AROS_LH4(IPTR
, DoNotify
,
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
),
82 struct Library
*, BOOPSIBase
, 16, BOOPSI
)
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
94 icdata - interconnection information
95 msg - the message given to the OM_NOTIFY method
98 The objects listening to this object will be notified.
100 Note: Return value not clear.
114 ******************************************************************************/
117 AROS_LIBBASE_EXT_DECL(struct Library
*, BOOPSIBase
)
119 if( ic
->ic_Target
!= NULL
)
121 if( msg
->opu_AttrList
) /* stegerg: ??? checked also "&& msg->opu_GInfo" ) */
123 ic
->ic_LoopCounter
+= 1UL;
125 /* Don't get into a circular notify target loop */
126 if( ic
->ic_LoopCounter
== 1UL )
128 if(( ic
->ic_CloneTags
= CloneTagItems(msg
->opu_AttrList
)))
130 if( ic
->ic_Mapping
!= NULL
)
132 MapTags(ic
->ic_CloneTags
, ic
->ic_Mapping
, TRUE
);
135 if( ic
->ic_Target
!= (Object
*)ICTARGET_IDCMP
)
137 DoMethod( ic
->ic_Target
,
143 FreeTagItems(ic
->ic_CloneTags
);
144 ic
->ic_CloneTags
= NULL
;
149 if (msg
->opu_GInfo
->gi_Window
)
150 if (msg
->opu_GInfo
->gi_Window
->UserPort
)
151 if (msg
->opu_GInfo
->gi_Window
->IDCMPFlags
& IDCMP_IDCMPUPDATE
)
156 if ((ti
= FindTagItem(ICSPECIAL_CODE
, ic
->ic_CloneTags
)))
158 code
= ti
->ti_Data
& 0xFFFF;
160 SendIDCMPUpdate( cl
, o
, msg
, IDCMP_IDCMPUPDATE
,
161 code
, ic
->ic_CloneTags
, BOOPSIBase
);
163 /* in this case the cloned tagitems will be freed in the Intuition
164 InputHandler when the app has replied the IntuiMessage */
166 ic
->ic_CloneTags
= NULL
;
169 /* if IDCMP_IDCMPUPDATE msg could not be sent, free taglist */
171 if (ic
->ic_CloneTags
)
173 FreeTagItems(ic
->ic_CloneTags
);
174 ic
->ic_CloneTags
= NULL
;
179 } /* CloneTagItems() */
181 } /* LoopCounter == 1UL */
183 ic
->ic_LoopCounter
-= 1UL;
185 } /* valid parameters */