Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / commodities / addievents.c
bloba710f81f25d888d79410967ce2f95e93e8a297c4
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include <aros/debug.h>
14 #include <proto/exec.h>
15 #include <devices/inputevent.h>
16 #include <exec/memory.h>
17 #include "cxintern.h"
19 #define DEBUG_COPYIEVENT(x) x;
21 BOOL CopyInputEvent(struct InputEvent *from, struct InputEvent *to, struct CommoditiesBase *CxBase);
23 AROS_LH1(VOID, AddIEvents,
25 /* SYNOPSIS */
27 AROS_LHA(struct InputEvent *, events, A0),
29 /* LOCATION */
31 struct Library *, CxBase, 30, Commodities)
33 /* FUNCTION
35 Send input events though the commodity hierarchy. After the call the
36 list of InputEvents may be disposed.
38 INPUTS
40 events -- a NULL-terminated linked list of InputEvents (may be NULL).
42 RESULT
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 HISTORY
56 ******************************************************************************/
59 AROS_LIBFUNC_INIT
61 CxMsg *msg;
63 if (events == NULL)
65 return;
68 ObtainSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
72 msg = (CxMsg *)AllocCxStructure(CX_MESSAGE, CXM_DOUBLE, CxBase);
74 if (msg == NULL)
76 break;
79 if (!CopyInputEvent(events, msg->cxm_Data, GPB(CxBase)))
81 DEBUG_COPYIEVENT(dprintf("AddIEvents: CopyInputEvent() failed!\n"));
84 ROUTECxMsg(msg, (CxObj *) GPB(CxBase)->cx_BrokerList.lh_Head);
85 AddTail(&GPB(CxBase)->cx_MessageList, (struct Node *)msg);
87 events = events->ie_NextEvent;
88 } while(events != NULL);
90 ReleaseSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
92 AROS_LIBFUNC_EXIT
93 } /* AddIEvents */