-/* $Id: mac.c,v 1.34 2003/01/20 22:55:08 ben Exp $ */
+/* $Id: mac.c,v 1.36 2003/01/24 00:25:33 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
static void mac_closewindow(WindowPtr);
static void mac_zoomwindow(WindowPtr, short);
#pragma noreturn (cleanup_exit)
-static pascal OSErr mac_aevt_quit(const AppleEvent *, AppleEvent *, long);
struct mac_windows {
WindowPtr about;
DisposeHandle((Handle)ti);
}
-#if 0 /* OpenTransport? */
- if (Gestalt(gestaltOpenTpt, &mac_gestalts.otptattr) != noErr ||
- (mac_gestalts.otptattr & gestaltOpenTptTCPPresentMask) == 0 ||
- ot_init() != noErr)
-#endif
- mac_gestalts.otptattr = 0;
- if (mac_gestalts.otptattr == 0) {
- /* MacTCP? */
- if (Gestalt(FOUR_CHAR_CODE('mtcp'), &mac_gestalts.mtcpvers) != noErr)
- mac_gestalts.mtcpvers = 0;
- if (mac_gestalts.mtcpvers > 0) {
- if (mactcp_init() != noErr)
- mac_gestalts.mtcpvers = 0;
- }
- } else
- mac_gestalts.mtcpvers = 0;
+ sk_init();
/* We've been tested with the Appearance Manager */
if (mac_gestalts.apprvers != 0)
}
/* Install Apple Event handlers. */
+ AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
+ NewAEEventHandlerUPP(&mac_aevt_oapp), 0, FALSE);
+ AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
+ NewAEEventHandlerUPP(&mac_aevt_odoc), 0, FALSE);
+ AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
+ NewAEEventHandlerUPP(&mac_aevt_pdoc), 0, FALSE);
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerUPP(&mac_aevt_quit), 0, FALSE);
}
mac_event(&event);
if (borednow)
cleanup_exit(0);
- if (mac_gestalts.mtcpvers != 0)
- mactcp_poll();
- if (mac_gestalts.otptattr != 0)
- ot_poll();
+ sk_poll();
mac_pollterm();
}
DisposeRgn(cursrgn);
}
}
-static pascal OSErr mac_aevt_quit(const AppleEvent *req, AppleEvent *reply,
+pascal OSErr mac_aevt_quit(const AppleEvent *req, AppleEvent *reply,
long refcon)
{
+ DescType type;
+ Size size;
+
+ if (AEGetAttributePtr(req, keyMissedKeywordAttr, typeWildCard,
+ &type, NULL, 0, &size) == noErr)
+ return errAEParamMissed;
borednow = 1;
return noErr;