From 2d3411e92334d83d913cac4298fb218dfaebe291 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 17 Jan 2001 17:20:28 +0000 Subject: [PATCH] Tidy up that latest checkin. PS_DOTTED is spelled PS_DOT and in any case doesn't really cut it; we have to SetPixel every other one manually because although PS_ALTERNATE exists it only works under NT. Meanwhile, IDC_CURSTATIC was already used, for the cursor _keys_. Duh. git-svn-id: svn://svn.tartarus.org/sgt/putty@871 cda61777-01e9-0310-a592-d414129be87e --- windlg.c | 4 ++-- window.c | 37 ++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/windlg.c b/windlg.c index 7f2c8a15..dbccb372 100644 --- a/windlg.c +++ b/windlg.c @@ -274,7 +274,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_BOX_APPEARANCE1, IDC_BOXT_APPEARANCE1, IDC_BOX_APPEARANCE2, IDC_BOXT_APPEARANCE2, IDC_BOX_APPEARANCE3, IDC_BOXT_APPEARANCE3, - IDC_CURSTATIC, + IDC_CURSORSTATIC, IDC_CURBLOCK, IDC_CURUNDER, IDC_CURVERT, @@ -843,7 +843,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, IDC_TITLE_APPEARANCE); beginbox(&cp, "Adjust the use of the cursor", IDC_BOX_APPEARANCE1, IDC_BOXT_APPEARANCE1); - radioline(&cp, "Cursor appearance:", IDC_CURSTATIC, 3, + radioline(&cp, "Cursor appearance:", IDC_CURSORSTATIC, 3, "B&lock", IDC_CURBLOCK, "&Underline", IDC_CURUNDER, "&Vertical line", IDC_CURVERT, diff --git a/window.c b/window.c index 0a7419c0..26fcb0de 100644 --- a/window.c +++ b/window.c @@ -1824,7 +1824,7 @@ void do_text (Context ctx, int x, int y, char *text, int len, oldpen = SelectObject (hdc, oldpen); DeleteObject (oldpen); } - if ((attr & ATTR_PASCURS) && cfg.cursor.type == 0) { + if ((attr & ATTR_PASCURS) && cfg.cursor_type == 0) { POINT pts[5]; HPEN oldpen; pts[0].x = pts[1].x = pts[4].x = x; @@ -1837,25 +1837,32 @@ void do_text (Context ctx, int x, int y, char *text, int len, DeleteObject (oldpen); } if ((attr & (ATTR_ACTCURS | ATTR_PASCURS)) && cfg.cursor_type != 0) { - HPEN oldpen; - int pentype; - if (attr & ATTR_PASCURS) - pentype = PS_DOTTED; - else - pentype = PS_SOLID; - oldpen = SelectObject (hdc, CreatePen(pentype, 0, colours[23])); + int startx, starty, dx, dy, length, i; if (cfg.cursor_type == 1) { - MoveToEx (hdc, x, y+descent, NULL); - LineTo (hdc, x+fnt_width-1, y+descent); - } else { + startx = x; starty = y+descent; + dx = 1; dy = 0; length = fnt_width; + } else { int xadjust = 0; if (attr & ATTR_RIGHTCURS) xadjust = fnt_width-1; - MoveToEx (hdc, x+xadjust, y, NULL); - LineTo (hdc, x+xadjust, y+font_height-1); + startx = x+xadjust; starty = y; + dx = 0; dy = 1; length = font_height; } - oldpen = SelectObject (hdc, oldpen); - DeleteObject (oldpen); + if (attr & ATTR_ACTCURS) { + HPEN oldpen; + oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23])); + MoveToEx (hdc, startx, starty, NULL); + LineTo (hdc, startx+dx*length, starty+dy*length); + oldpen = SelectObject (hdc, oldpen); + DeleteObject (oldpen); + } else { + for (i = 0; i < length; i++) { + if (i % 2 == 0) { + SetPixel(hdc, startx, starty, colours[23]); + } + startx += dx; starty += dy; + } + } } } -- 2.11.0