X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/fa1ce94ffb400a726a342c864a7940c9d7c96f10..100122a9630f497dce8016811821997da2335e10:/window.c diff --git a/window.c b/window.c index e966b431..4c83e9bd 100644 --- a/window.c +++ b/window.c @@ -13,6 +13,7 @@ #define PUTTY_DO_GLOBALS /* actually _define_ globals */ #include "putty.h" +#include "storage.h" #include "win_res.h" #define IDM_SHOWLOG 0x0010 @@ -153,6 +154,32 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { tolower(p[1]) == 'o' && tolower(p[2]) == 'g') { logfile = "putty.log"; + } else if (q == p + 7 && + tolower(p[0]) == 'c' && + tolower(p[1]) == 'l' && + tolower(p[2]) == 'e' && + tolower(p[3]) == 'a' && + tolower(p[4]) == 'n' && + tolower(p[5]) == 'u' && + tolower(p[6]) == 'p') { + /* + * `putty -cleanup'. Remove all registry entries + * associated with PuTTY, and also find and delete + * the random seed file. + */ + if (MessageBox(NULL, + "This procedure will remove ALL Registry\n" + "entries associated with PuTTY, and will\n" + "also remove the PuTTY random seed file.\n" + "\n" + "THIS PROCESS WILL DESTROY YOUR SAVED\n" + "SESSIONS. Are you really sure you want\n" + "to continue?", + "PuTTY Warning", + MB_YESNO | MB_ICONWARNING) == IDYES) { + cleanup_all(); + } + exit(0); } p = q + strspn(q, " \t"); } @@ -1242,11 +1269,13 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, return 0; case WM_SETFOCUS: has_focus = TRUE; + CreateCaret(hwnd, NULL, font_width, font_height); term_out(); term_update(); break; case WM_KILLFOCUS: has_focus = FALSE; + DestroyCaret(); term_out(); term_update(); break; @@ -1421,6 +1450,16 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, } /* + * Move the system caret. (We maintain one, even though it's + * invisible, for the benefit of blind people: apparently some + * helper software tracks the system caret, so we should arrange to + * have one.) + */ +void sys_cursor(int x, int y) { + SetCaretPos(x * font_width, y * font_height); +} + +/* * Draw a line of text in the window, at given character * coordinates, in given attributes. *