X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/76a3e871f16ade91d573945193070afaa65fc6c7..2e06dc9f00218c08f2d15bf84477b1d592f7b6e7:/mac/macterm.c diff --git a/mac/macterm.c b/mac/macterm.c index 6374a1f5..dad26883 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -595,7 +595,7 @@ static void text_click(Session *s, EventRecord *event) lastwhen = TickCount(); } -void write_clip(void *cookie, wchar_t *data, int len, int must_deselect) +void write_clip(void *cookie, wchar_t *data, int *attr, int len, int must_deselect) { #if !TARGET_API_MAC_CARBON Session *s = cookie; @@ -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); @@ -1476,7 +1488,7 @@ void sys_cursor(void *frontend, int x, int y) * may want to perform additional actions on any kind of bell (for * example, taskbar flashing in Windows). */ -void beep(void *frontend, int mode) +void do_beep(void *frontend, int mode) { if (mode != BELL_VISUAL) SysBeep(30); @@ -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. */ @@ -1865,7 +1883,8 @@ void frontend_keypress(void *handle) * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename filename) +int askappend(void *frontend, Filename filename, + void (*callback)(void *ctx, int result), void *ctx) { /* FIXME: not implemented yet. */ @@ -1879,6 +1898,12 @@ int from_backend(void *frontend, int is_stderr, const char *data, int len) return term_data(s->term, is_stderr, data, len); } +int get_userpass_input(prompts_t *p, unsigned char *in, int inlen) +{ + Session *s = p->frontend; + return term_get_userpass_input(s->term, p, in, inlen); +} + /* * Emacs magic: * Local Variables: