X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fdedf2c8af53ae30fc508b55dc9754405ae3c9af..1cd246bbcbac9071752ff80152c39e0569030aa8:/window.c diff --git a/window.c b/window.c index 3cd719ae..829abe79 100644 --- a/window.c +++ b/window.c @@ -866,7 +866,10 @@ static int WINAPI WndProc (HWND hwnd, UINT message, if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) SetWindowText (hwnd, window_name); if (!ignore_size) { - int width, height, w, h, ew, eh; + int width, height, w, h; +#if 0 /* we have fixed this using WM_SIZING now */ + int ew, eh; +#endif width = LOWORD(lParam); height = HIWORD(lParam); @@ -1084,18 +1087,24 @@ void do_text (Context ctx, int x, int y, char *text, int len, TextOut (hdc, x-1, y, text, len); } if (und_mode == UND_LINE && (attr & ATTR_UNDER)) { - SelectObject (hdc, CreatePen(PS_SOLID, 0, fg)); + HPEN oldpen; + oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, fg)); MoveToEx (hdc, x, y+descent, NULL); LineTo (hdc, x+len*font_width, y+descent); + oldpen = SelectObject (hdc, oldpen); + DeleteObject (oldpen); } if (attr & ATTR_PASCURS) { POINT pts[5]; + HPEN oldpen; pts[0].x = pts[1].x = pts[4].x = x; pts[2].x = pts[3].x = x+font_width-1; pts[0].y = pts[3].y = pts[4].y = y; pts[1].y = pts[2].y = y+font_height-1; - SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23])); + oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23])); Polyline (hdc, pts, 5); + oldpen = SelectObject (hdc, oldpen); + DeleteObject (oldpen); } } @@ -1347,7 +1356,8 @@ void set_sbar (int total, int start, int page) { si.nMax = total - 1; si.nPage = page; si.nPos = start; - SetScrollInfo (hwnd, SB_VERT, &si, TRUE); + if (hwnd) + SetScrollInfo (hwnd, SB_VERT, &si, TRUE); } Context get_ctx() {