X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/c3aef739857885cfc23b8aad3579032126c61e4d..c99b88a4be8174265c6a0ce95e1ee9287355fe11:/mac/macterm.c?ds=sidebyside diff --git a/mac/macterm.c b/mac/macterm.c index 9bcef099..02232a57 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1,4 +1,4 @@ -/* $Id: macterm.c,v 1.47 2003/01/14 18:43:26 ben Exp $ */ +/* $Id: macterm.c,v 1.50 2003/01/15 23:30:21 ben Exp $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris @@ -152,6 +152,7 @@ void mac_startsession(Session *s) { char *errmsg; + init_ucs(s); /* XXX: Own storage management? */ if (HAVE_COLOR_QD()) s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1); @@ -159,7 +160,7 @@ void mac_startsession(Session *s) s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1); SetWRefCon(s->window, (long)s); s->scrollbar = GetNewControl(cVScroll, s->window); - s->term = term_init(&s->cfg, s); + s->term = term_init(&s->cfg, &s->ucsdata, s); mac_initfont(s); mac_initpalette(s); @@ -189,7 +190,7 @@ void mac_startsession(Session *s) ShowWindow(s->window); s->next = sesslist; - s->prev = s->next->prev; + s->prev = &sesslist; if (s->next != NULL) s->next->prev = &s->next; sesslist = s; @@ -208,11 +209,9 @@ static void mac_workoutfontscale(Session *s, int wantwidth, const char text = 'W'; FontInfo fi; - fprintf(stderr, "want width = %d\n", wantwidth); numer.v = denom.v = 1; /* always */ numer.h = denom.h = 1; for (i = 0; i < 3; i++) { - fprintf(stderr, "Trying %d:%d\n", numer.h, denom.h); tmpnumer = numer; tmpdenom = denom; if (s->window->grafProcs != NULL) @@ -223,7 +222,6 @@ static void mac_workoutfontscale(Session *s, int wantwidth, /* The result of StdTxMeas must be scaled by the factors it returns. */ gotwidth = FixRound(FixMul(gotwidth << 16, FixRatio(tmpnumer.h, tmpdenom.h))); - fprintf(stderr, "width = %d\n", gotwidth); if (gotwidth == wantwidth) break; numer.h *= wantwidth; @@ -919,6 +917,25 @@ static pascal void mac_growtermdraghook(void) SetPort(portsave); } +void mac_closeterm(WindowPtr window) +{ + Session *s = (Session *)GetWRefCon(window); + + /* XXX warn on close */ + HideWindow(s->window); + *s->prev = s->next; + s->next->prev = s->prev; + ldisc_free(s->ldisc); + s->back->free(s->backhandle); + log_free(s->logctx); + if (s->uni_to_font != NULL) + DisposeUnicodeToTextInfo(&s->uni_to_font); + term_free(s->term); + DisposeWindow(s->window); + DisposePalette(s->palette); + sfree(s); +} + void mac_activateterm(WindowPtr window, Boolean active) { Session *s;