2 Copyright © 1995-2007, 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 ******************************************************************************/
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
,
142 FreeTagItems(ic
->ic_CloneTags
);
143 ic
->ic_CloneTags
= NULL
;
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
)
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 */