X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=mac%2Fmacterm.c;h=443c0c8bcf2d93b8747679a6a239ffdbd0c8fb1c;hb=49d2cf19accb059b3b68d1fc2b78e606a578c3e8;hp=78efa65fe2fa63ab297b8488e234550494e1427c;hpb=f73fcb042423866a06b9e41b6934906a0fe9502e;p=PuTTY.git diff --git a/mac/macterm.c b/mac/macterm.c index 78efa65f..443c0c8b 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1012,14 +1012,26 @@ static pascal void mac_growtermdraghook(void) void mac_closeterm(WindowPtr window) { + int alertret; Session *s = mac_windowsession(window); - /* XXX warn on close */ + if (s->cfg.warn_on_close && !s->session_closed) { + ParamText("\pAre you sure you want to close this session?", + NULL, NULL, NULL); + alertret=CautionAlert(wQuestion, NULL); + if (alertret == 2) { + /* Cancel */ + return; + } + } + HideWindow(s->window); *s->prev = s->next; s->next->prev = s->prev; - ldisc_free(s->ldisc); - s->back->free(s->backhandle); + if (s->ldisc) + ldisc_free(s->ldisc); + if (s->back) + s->back->free(s->backhandle); log_free(s->logctx); if (s->uni_to_font != NULL) DisposeUnicodeToTextInfo(&s->uni_to_font); @@ -1833,6 +1845,12 @@ void ldisc_update(void *frontend, int echo, int edit) { } +char *get_ttymode(void *frontend, const char *mode) +{ + Session *s = frontend; + return term_get_ttymode(s->term, mode); +} + /* * Mac PuTTY doesn't support printing yet. */