Add an invisible System Caret for blind-helper-software to track
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 25 Sep 2000 16:17:53 +0000 (16:17 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 25 Sep 2000 16:17:53 +0000 (16:17 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@627 cda61777-01e9-0310-a592-d414129be87e

putty.h
terminal.c
window.c

diff --git a/putty.h b/putty.h
index 1ab5b99..016c56c 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -249,6 +249,7 @@ void connection_fatal(char *, ...);
 void fatalbox (char *, ...);
 void beep (int);
 void begin_session(void);
+void sys_cursor(int x, int y);
 #define OPTIMISE_IS_SCROLL 1
 
 /*
index d62c8cd..f5a2ae0 100644 (file)
@@ -211,6 +211,7 @@ void term_update(void) {
            seen_disp_event = seen_key_event = 0;
        }
        do_paint (ctx, TRUE);
+        sys_cursor(curs_x, curs_y + (scrtop - disptop) / (cols+1));
        free_ctx (ctx);
     }
 }
@@ -1695,7 +1696,7 @@ static int linecmp (unsigned long *a, unsigned long *b) {
  * Given a context, update the window. Out of paranoia, we don't
  * allow WM_PAINT responses to do scrolling optimisations.
  */
-static void do_paint (Context ctx, int may_optimise){ 
+static void do_paint (Context ctx, int may_optimise){
     int i, j, start, our_curs_y;
     unsigned long attr, rv, cursor;
     char ch[1024];
index 5b05a0b..91b4dc5 100644 (file)
--- a/window.c
+++ b/window.c
@@ -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.
  *