X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/88b187aa91decdc5f3bcdbbf30361b25490106b2..a9422f39e34f55d1925d1ebef35ace1a0f1c2f6a:/window.c?ds=sidebyside diff --git a/window.c b/window.c index 43e305f8..de431d62 100644 --- a/window.c +++ b/window.c @@ -132,7 +132,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { default_protocol = DEFAULT_PROTOCOL; default_port = DEFAULT_PORT; - do_defaults(NULL); + do_defaults(NULL, &cfg); p = cmdline; while (*p && isspace(*p)) p++; @@ -190,7 +190,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { * An initial @ means to activate a saved session. */ if (*p == '@') { - do_defaults (p+1); + do_defaults (p+1, &cfg); if (!*cfg.host && !do_config()) { WSACleanup(); return 0; @@ -415,7 +415,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { */ { char *error; - char msg[1024]; + char msg[1024], *title; char *realhost; error = back->init (hwnd, cfg.host, cfg.port, &realhost); @@ -425,9 +425,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { return 0; } window_name = icon_name = NULL; - sprintf(msg, "%s - PuTTY", realhost); - set_title (msg); - set_icon (msg); + if (*cfg.wintitle) { + title = cfg.wintitle; + } else { + sprintf(msg, "%s - PuTTY", realhost); + title = msg; + } + set_title (title); + set_icon (title); } session_closed = FALSE; @@ -2237,7 +2242,7 @@ void palette_reset (void) { } } -void write_clip (void *data, int len) { +void write_clip (void *data, int len, int must_deselect) { HGLOBAL clipdata; void *lock; @@ -2251,14 +2256,18 @@ void write_clip (void *data, int len) { ((unsigned char *) lock) [len] = 0; GlobalUnlock (clipdata); - SendMessage (hwnd, WM_IGNORE_CLIP, TRUE, 0); + if (!must_deselect) + SendMessage (hwnd, WM_IGNORE_CLIP, TRUE, 0); + if (OpenClipboard (hwnd)) { EmptyClipboard(); SetClipboardData (CF_TEXT, clipdata); CloseClipboard(); } else GlobalFree (clipdata); - SendMessage (hwnd, WM_IGNORE_CLIP, FALSE, 0); + + if (!must_deselect) + SendMessage (hwnd, WM_IGNORE_CLIP, FALSE, 0); } void get_clip (void **p, int *len) {