Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / boopsi / donotify.c
blob2f1796fbd30e5aa63c5b6a458c02dbda45a1b09a
1 /*
2 Copyright © 1995-2001, 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
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,
138 OM_UPDATE,
139 ic->ic_CloneTags,
140 msg->opu_GInfo,
141 msg->opu_Flags);
143 FreeTagItems(ic->ic_CloneTags);
144 ic->ic_CloneTags = NULL;
146 else
148 if (msg->opu_GInfo)
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)
153 struct TagItem *ti;
154 UWORD code = 0;
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 */
187 } /* valid target */
189 return 1UL;
191 AROS_LIBFUNC_EXIT
193 } /* DoNotify() */