oops .. forgot to offset from objects bounds
[AROS.git] / rom / intuition / allocintuimessage.c
blob12a4bf315809b7f54ff4e98a89e0dd9a78368ab8
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include <exec/exec.h>
10 /*****i***********************************************************************
12 NAME */
13 #include <proto/intuition.h>
15 AROS_LH1(struct IntuiMessage *, AllocIntuiMessage,
17 /* SYNOPSIS */
18 AROS_LHA(struct Window *, window, A0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 148, Intuition)
23 /* FUNCTION
24 Private to AROS: allocate an IntuiMessage. IntuiMessage->Window
25 will be set to window by this function.
27 INPUTS
28 window - The window to which the IntuiMessage will be sent
30 RESULT
31 an allocated IntuiMessage structure. Must be freed with FreeIntuiMessage
33 NOTES
34 This private function is also present in MorphOS v50.
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 HISTORY
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 struct IntuiMessage *msg;
52 #ifdef __MORPHOS__
53 ASSERT_VALID_PTR(window);
54 SANITY_CHECKR(window,0)
55 #else
56 ASSERT_VALID_PTR_OR_NULL(window);
57 #endif
59 if ((msg = AllocPooled(GetPrivIBase(IntuitionBase)->IDCMPPool,sizeof(struct IntIntuiMessage))))
61 memclr(msg,sizeof(struct IntIntuiMessage));
63 msg->ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
64 msg->ExecMessage.mn_Length = sizeof(struct ExtIntuiMessage);
65 msg->ExecMessage.mn_ReplyPort = window ? window->WindowPort : GetPrivIBase(IntuitionBase)->IntuiReplyPort;
67 msg->IDCMPWindow = window;
70 DEBUG_ALLOCINTUIMESSAGE(dprintf("AllocIntuiMessage: Window 0x%lx Port 0x%lx Msg 0x%lx\n",
71 window, window->WindowPort, msg));
73 return msg;
75 AROS_LIBFUNC_EXIT