11 #include <Carbon/Carbon.h> 18 *reply,
long handlerRefcon)
21 FXApp::instance()->exit();
26 *reply,
long handlerRefcon)
34 *reply,
long handlerRefcon)
40 OSStatus
AEHandler(EventHandlerCallRef inCaller, EventRef inEvent,
void* inRefcon)
42 Boolean release =
false;
43 EventRecord eventRecord;
44 OSErr ignoreErrForThisSample;
48 if (IsEventInQueue(GetMainEventQueue(), inEvent))
54 RemoveEventFromQueue(GetMainEventQueue(), inEvent);
57 ConvertEventRefToEventRecord(inEvent, &eventRecord);
58 ignoreErrForThisSample = AEProcessAppleEvent(&eventRecord);
60 ReleaseEvent(inEvent);
69 if (event->what == osEvt) {
70 if (((event->message >> 24) & 0xff) == suspendResumeMessage) {
71 if (event->message & resumeFlag) {
88 puts(
"Calling ProcessAppleEvent\n");
89 AEProcessAppleEvent(event);
99 static const EventTypeSpec appleEvents[] =
101 { kEventClassAppleEvent, kEventAppleEvent }
105 InstallApplicationEventHandler(NewEventHandlerUPP(
AEHandler),
106 GetEventTypeCount(appleEvents), appleEvents, 0,
NULL);
110 err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
112 err = AEInstallEventHandler(kCoreEventClass, kAEReopenApplication,
116 err = AEInstallEventHandler(kCoreEventClass, typeWildCard,
117 NewAEEventHandlerUPP(HandleWildMessage), 0,
false);
124 RgnHandle cursorRgn =
NULL;
125 Boolean gotEvent=
TRUE;
129 gotEvent = WaitNextEvent(everyEvent, &event, 0L, cursorRgn);
static pascal OSErr HandleQuitMessage(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon)
static pascal OSErr HandleWildCardMessage(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon)
void init_apple_message_system()
OSStatus AEHandler(EventHandlerCallRef inCaller, EventRef inEvent, void *inRefcon)
static pascal OSErr HandleReopenMessage(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon)
void check_apple_events()
FXMainWindow * g_main_window
static void HandleEvent(EventRecord *event)