Rationalised host key storage. Also started code reorg: persistent-state
[sgt/putty] / window.c
index 5b05a0b..4c83e9b 100644 (file)
--- 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
@@ -176,8 +177,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
                                "to continue?",
                                "PuTTY Warning",
                                MB_YESNO | MB_ICONWARNING) == IDYES) {
-                    random_destroy_seed();
-                    registry_cleanup();
+                    cleanup_all();
                 }
                 exit(0);
            }
@@ -1269,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;
@@ -1448,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.
  *