#define PUTTY_DO_GLOBALS /* actually _define_ globals */
#include "putty.h"
+#include "storage.h"
#include "win_res.h"
#define IDM_SHOWLOG 0x0010
static HWND hwnd;
+static HBITMAP caretbm;
+
static int dbltime, lasttime, lastact;
static Mouse_Button lastbtn;
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");
}
SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
/*
+ * Set up a caret bitmap, with no content.
+ */
+ {
+ char *bits;
+ int size = (font_width+15)/16 * 2 * font_height;
+ bits = calloc(size, 1);
+ memset(bits, 0x55, size);
+ caretbm = CreateBitmap(font_width, font_height, 1, 1, bits);
+ free(bits);
+ }
+
+ /*
* Initialise the scroll bar.
*/
{
KillTimer(hwnd, timer_id);
timer_id = 0;
}
+ HideCaret(hwnd);
if (inbuf_head)
term_out();
term_update();
+ ShowCaret(hwnd);
if (!has_focus)
timer_id = SetTimer(hwnd, 1, 2000, NULL);
else if (cfg.blinktext)
enact_pending_netevent();
if (inbuf_head)
term_out();
+ HideCaret(hwnd);
term_update();
+ ShowCaret(hwnd);
return 0;
case WM_CREATE:
break;
case WM_PAINT:
{
PAINTSTRUCT p;
+ HideCaret(hwnd);
hdc = BeginPaint (hwnd, &p);
if (pal) {
SelectPalette (hdc, pal, TRUE);
SelectObject (hdc, GetStockObject(SYSTEM_FONT));
SelectObject (hdc, GetStockObject(WHITE_PEN));
EndPaint (hwnd, &p);
+ ShowCaret(hwnd);
}
return 0;
case WM_NETEVENT:
return 0;
case WM_SETFOCUS:
has_focus = TRUE;
+ CreateCaret(hwnd, caretbm, 0, 0);
+ ShowCaret(hwnd);
term_out();
term_update();
break;
case WM_KILLFOCUS:
has_focus = FALSE;
+ DestroyCaret();
term_out();
term_update();
break;
}
/*
+ * 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.
*