define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / rom / intuition / freesysrequest.c
blob642899c2f636e0ee5c85af10502deacab2651682
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 <proto/exec.h>
10 #define DEBUG_FREESYSREQUEST(x) ;
12 /*****************************************************************************
14 NAME */
15 #include <proto/intuition.h>
16 #include <exec/types.h>
17 #include <intuition/intuition.h>
19 AROS_LH1(void, FreeSysRequest,
21 /* SYNOPSIS */
22 AROS_LHA(struct Window *, window, A0),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 62, Intuition)
27 /* FUNCTION
28 Frees a requester made with BuildSysRequest() or
29 BuildEasyRequestArgs().
31 INPUTS
32 Window - The requester to be freed. May be NULL or 1.
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
41 BuildSysRequest() requesters not supported, yet.
43 SEE ALSO
44 BuildSysRequest(), BuildEasyRequestArgs()
46 INTERNALS
48 HISTORY
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct Screen *scr;
55 struct Gadget *gadgets;
56 STRPTR *gadgetlabels;
57 struct IntRequestUserData *requserdata;
59 DEBUG_FREESYSREQUEST(dprintf("intrequest_freesysrequest: window 0x%lx\n", (ULONG) window));
61 if ((window == NULL) || (window == (void *)1L))
62 return;
64 scr = window->WScreen;
66 requserdata = (struct IntRequestUserData *)window->UserData;
68 DEBUG_FREESYSREQUEST(dprintf("intrequest_freesysrequest: requserdata 0x%lx\n", (ULONG) requserdata));
70 gadgets = requserdata->Gadgets;
72 DEBUG_FREESYSREQUEST(dprintf("intrequest_freesysrequest: gadgets 0x%lx\n", (ULONG) gadgets));
74 /* Remove gadgets before closing window to avoid conflicts with system gadgets */
75 RemoveGList(window, gadgets, requserdata->NumGadgets);
77 gadgetlabels = requserdata->GadgetLabels;
79 DEBUG_FREESYSREQUEST(dprintf("intrequest_freesysrequest: gadgetlabels 0x%lx\n", (ULONG) gadgetlabels));
81 window->UserData = 0;
82 CloseWindow(window);
83 intrequest_freegadgets(gadgets, IntuitionBase);
84 intrequest_freelabels(gadgetlabels, IntuitionBase);
86 #ifdef SKINS
87 DEBUG_FREESYSREQUEST(dprintf("intrequest_freesysrequest: freeitext 0x%lx\n", (ULONG) requserdata->freeitext));
88 if (requserdata->freeitext) intrequest_freeitext(requserdata->Text,IntuitionBase);
89 if (requserdata->backfilldata.image) int_FreeCustomImage(TYPE_REQUESTERCLASS,requserdata->dri,IntuitionBase);
90 if (requserdata->Logo) int_FreeCustomImage(TYPE_REQUESTERCLASS,requserdata->dri,IntuitionBase);
91 if (requserdata->ReqGadgets) FreeVec(requserdata->ReqGadgets);
92 if (requserdata->dri) FreeScreenDrawInfo(requserdata->ReqScreen,(struct DrawInfo *)requserdata->dri);
93 #endif
94 FreeVec(requserdata);
96 return;
97 AROS_LIBFUNC_EXIT
98 } /* FreeSysRequest */