Belarusian
[AROS.git] / rom / intuition / allocintuimessage.c
blob231d00034d42f8e0ce1eccfb30727d4e12729697
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
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 HISTORY
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct IntuiMessage *msg;
51 #ifdef __MORPHOS__
52 ASSERT_VALID_PTR(window);
53 SANITY_CHECKR(window,0)
54 #else
55 ASSERT_VALID_PTR_OR_NULL(window);
56 #endif
58 if ((msg = AllocPooled(GetPrivIBase(IntuitionBase)->IDCMPPool,sizeof(struct IntIntuiMessage))))
60 memclr(msg,sizeof(struct IntIntuiMessage));
62 msg->ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
63 msg->ExecMessage.mn_Length = sizeof(struct ExtIntuiMessage);
64 msg->ExecMessage.mn_ReplyPort = window ? window->WindowPort : GetPrivIBase(IntuitionBase)->IntuiReplyPort;
66 msg->IDCMPWindow = window;
69 DEBUG_ALLOCINTUIMESSAGE(dprintf("AllocIntuiMessage: Window 0x%lx Port 0x%lx Msg 0x%lx\n",
70 window, window->WindowPort, msg));
72 return msg;
74 AROS_LIBFUNC_EXIT