X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/36577dc964417f87585976af191e7a1e35c2ff08..ce2832135394f17cf34a9ca00db3c7394b591d46:/mac/mac.c?ds=sidebyside diff --git a/mac/mac.c b/mac/mac.c index f931faf2..0abb3375 100644 --- a/mac/mac.c +++ b/mac/mac.c @@ -1,4 +1,4 @@ -/* $Id: mac.c,v 1.5 2002/12/06 00:09:34 ben Exp $ */ +/* $Id: mac.c,v 1.10 2002/12/30 18:21:17 ben Exp $ */ /* * Copyright (c) 1999 Ben Harris * All rights reserved. @@ -42,7 +42,9 @@ #include #include #include +#include #include +#include #include #include @@ -100,6 +102,7 @@ int main (int argc, char **argv) { static void mac_startup(void) { Handle menuBar; + TECInfoHandle ti; /* Init Memory Manager */ MaxApplZone(); @@ -117,6 +120,11 @@ static void mac_startup(void) { InitDialogs(nil); cold = 0; + /* Get base system version (only used if there's no better selector) */ + if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr || + (mac_gestalts.sysvers & 0xffff) < 0x700) + fatalbox("PuTTY requires System 7 or newer"); + mac_gestalts.sysvers &= 0xffff; /* Find out if we've got Color Quickdraw */ if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr) mac_gestalts.qdvers = gestaltOriginalQD; @@ -137,6 +145,19 @@ static void mac_startup(void) { /* Mac OS 8.5 Window Manager? */ if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr) mac_gestalts.windattr = 0; + /* Text Encoding Conversion Manager? */ + if ( +#if TARGET_RT_MAC_CFM + &TECGetInfo == kUnresolvedCFragSymbolAddress || +#else + InitializeUnicodeConverter(NULL) != noErr || +#endif + TECGetInfo(&ti) != noErr) + mac_gestalts.encvvers = 0; + else { + mac_gestalts.encvvers = (*ti)->tecVersion; + DisposeHandle((Handle)ti); + } /* We've been tested with the Appearance Manager */ if (mac_gestalts.apprvers != 0) @@ -392,6 +413,9 @@ static void mac_menucommand(long result) { case iNew: mac_newsession(); goto done; + case iOpen: + mac_opensession(); + goto done; case iClose: mac_closewindow(window); goto done; @@ -435,11 +459,6 @@ static void mac_openabout(void) { } static void mac_openlicence(void) { - DialogItemType itemtype; - Handle item; - VersRecHndl vers; - Rect box; - StringPtr longvers; if (windows.licence) SelectWindow(windows.licence); @@ -543,6 +562,10 @@ static void mac_adjustcursor(RgnHandle cursrgn) { static void mac_shutdown(void) { +#if !TARGET_RT_MAC_CFM + if (mac_gestalts.encvvers != 0) + TerminateUnicodeConverter(); +#endif exit(0); }