home *** CD-ROM | disk | FTP | other *** search
- #ifndef __SYSTEMIDLE__
- #define __SYSTEMIDLE__
-
- #ifndef __MACTYPES__
- #include <MacTypes.h>
- #endif
- #ifndef __MIXEDMODE__
- #include <MixedMode.h>
- #endif
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
-
- #if PRAGMA_ONCE
- #pragma once
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=mac68k
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(push, 2)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack(2)
- #endif
-
- struct EventParams {
- EventMask mask; // mask to use when polling
- EventRecord event; // copy of last event received
- short filler; //
- RgnHandle mouseRgn; // mouseRgn for system to use
- UInt32 sleep; // sleep time for WNE
- UInt32 wakeTime; // time to call threads
- long refcon; // use as you like
- };
- typedef struct EventParams EventParams;
- typedef EventParams * EventParamsPtr;
-
-
- typedef CALLBACK_API( OSErr , SystemEventHandlerProcPtr )(EventRecord *theEvent, UInt32 *sleepTime, RgnHandle *mouseRgn, long refcon);
- typedef STACK_UPP_TYPE(SystemEventHandlerProcPtr) SystemEventHandlerUPP;
- enum { uppSystemEventHandlerProcInfo = 0x00003FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
- #define NewSytemIdleProcProc(userRoutine) (AESystemEventHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSystemEventHandlerProcInfo, GetCurrentArchitecture())
- #define CallSystemEventHandlerProc(userRoutine, theEvent, sleepTime, mouseRgn, refcon) CALL_FOUR_PARAMETER_UPP((userRoutine), uppSystemEventHandlerProcInfo, (theEvent), (sleepTime), (mouseRgn), (refcon))
-
- typedef CALLBACK_API( OSErr , CalcSleepProcPtr )(long *sleepTime, RgnHandle *mouseRgn, long refcon);
- typedef STACK_UPP_TYPE(CalcSleepProcPtr) CalcSleepUPP;
- enum { uppCalcSleepProcInfo = 0x00000FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
- #define CallCalcSleepProc(userRoutine, sleepTime, mouseRgn, refcon) CALL_THREE_PARAMETER_UPP((userRoutine), uppSystemEventHandlerProcInfo, (theEvent), (sleepTime), (mouseRgn), (refcon))
-
-
- EXTERN_API( OSErr )
- InstallSystemEventHandler (SystemEventHandlerUPP handler,
- long handlerRefcon,
- EventParamsPtr eventParams);
-
- EXTERN_API( OSErr )
- GetSystemEventHandler (SystemEventHandlerUPP* handler,
- long* handlerRefcon);
-
- EXTERN_API( OSErr )
- SystemIdle (void);
-
- EXTERN_API( Boolean )
- XWaitNextEvent (EventMask eventMask,
- EventRecord * theEvent,
- UInt32 sleep,
- RgnHandle mouseRgn);
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(pop)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack()
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif __SYSTEMIDLE__