From 37508af4ab231b1fde58345f5237f3ee82803829 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 8 Jan 1999 13:10:19 +0000 Subject: [PATCH] John Sullivan's patches plus more fixes: - Stop using the identifier `environ' as some platforms make it a macro - Fix silly error box at end of connection in FWHACK mode - Fix GPF on maximise-then-restore - Use SetCapture to allow drag-selecting outside the window - Correctly update window title when iconic and in win_name_always mode git-svn-id: svn://svn.tartarus.org/sgt/putty@12 cda61777-01e9-0310-a592-d414129be87e --- putty.h | 2 +- ssh.c | 6 ++++++ ssh.h | 2 ++ sshdes.c | 22 ++++++++++++++++------ telnet.c | 2 +- terminal.c | 13 ++++++++++--- windlg.c | 18 +++++++++--------- window.c | 42 ++++++++++++++++++++++++++---------------- 8 files changed, 71 insertions(+), 36 deletions(-) diff --git a/putty.h b/putty.h index c570392a..a456fdb7 100644 --- a/putty.h +++ b/putty.h @@ -98,7 +98,7 @@ typedef struct { /* Telnet options */ char termtype[32]; char termspeed[32]; - char environ[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */ + char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */ char username[32]; int rfc_environ; /* Keyboard options */ diff --git a/ssh.c b/ssh.c index f80055c9..8092c985 100644 --- a/ssh.c +++ b/ssh.c @@ -114,6 +114,12 @@ static void ssh_gotdata(unsigned char *data, int datalen) { data++, datalen--; } +#ifdef FWHACK + if (len == 0x52656d6f) { /* "Remo"te server has closed ... */ + len = 0x300; /* big enough to carry to end */ + } +#endif + pad = 8 - (len%8); biglen = len + pad; diff --git a/ssh.h b/ssh.h index 260d0629..5c72eeb1 100644 --- a/ssh.h +++ b/ssh.h @@ -1,3 +1,5 @@ +#include + struct RSAKey { int bits; int bytes; diff --git a/sshdes.c b/sshdes.c index 897457a0..66e70416 100644 --- a/sshdes.c +++ b/sshdes.c @@ -17,10 +17,15 @@ information. */ /* - * $Id: sshdes.c,v 1.1 1999/01/08 13:02:12 simon Exp $ + * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $ * $Log: sshdes.c,v $ - * Revision 1.1 1999/01/08 13:02:12 simon - * Initial checkin: beta 0.43 + * Revision 1.2 1999/01/08 13:10:15 simon + * John Sullivan's patches plus more fixes: + * - Stop using the identifier `environ' as some platforms make it a macro + * - Fix silly error box at end of connection in FWHACK mode + * - Fix GPF on maximise-then-restore + * - Use SetCapture to allow drag-selecting outside the window + * - Correctly update window title when iconic and in win_name_always mode * * Revision 1.1.1.1 1996/02/18 21:38:11 ylo * Imported ssh-1.2.13. @@ -111,10 +116,15 @@ cryptography and data security, including the following: */ /* - * $Id: sshdes.c,v 1.1 1999/01/08 13:02:12 simon Exp $ + * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $ * $Log: sshdes.c,v $ - * Revision 1.1 1999/01/08 13:02:12 simon - * Initial checkin: beta 0.43 + * Revision 1.2 1999/01/08 13:10:15 simon + * John Sullivan's patches plus more fixes: + * - Stop using the identifier `environ' as some platforms make it a macro + * - Fix silly error box at end of connection in FWHACK mode + * - Fix GPF on maximise-then-restore + * - Use SetCapture to allow drag-selecting outside the window + * - Correctly update window title when iconic and in win_name_always mode * * Revision 1.1.1.1 1996/02/18 21:38:11 ylo * Imported ssh-1.2.13. diff --git a/telnet.c b/telnet.c index 14881f96..b6e4802d 100644 --- a/telnet.c +++ b/telnet.c @@ -350,7 +350,7 @@ static void process_subneg (void) { b[0] = IAC; b[1] = SB; b[2] = sb_opt; b[3] = TELQUAL_IS; n = 4; - e = cfg.environ; + e = cfg.environmt; while (*e) { b[n++] = var; while (*e && *e != '\t') b[n++] = *e++; diff --git a/terminal.c b/terminal.c index 1e286cea..feec70a4 100644 --- a/terminal.c +++ b/terminal.c @@ -1254,8 +1254,8 @@ void term_paint (Context ctx, int l, int t, int r, int b) { right = (r - 1) / font_width; top = t / font_height; bottom = (b - 1) / font_height; - for (i = top; i <= bottom; i++) - for (j = left; j <= right; j++) + for (i = top; i <= bottom && j=rows) y = rows-1; + if (x<0) x = 0; + if (x>=cols) x = cols-1; + + selpoint = disptop + y * (cols+1) + x; if (b == MB_SELECT && a == MA_CLICK) { deselect(); diff --git a/windlg.c b/windlg.c index ecd3e5f2..b5d1b57f 100644 --- a/windlg.c +++ b/windlg.c @@ -134,9 +134,9 @@ static void save_settings (char *section, int do_host) { wpps (sesskey, "TerminalType", cfg.termtype); wpps (sesskey, "TerminalSpeed", cfg.termspeed); { - char buf[2*sizeof(cfg.environ)], *p, *q; + char buf[2*sizeof(cfg.environmt)], *p, *q; p = buf; - q = cfg.environ; + q = cfg.environmt; while (*q) { while (*q) { int c = *q++; @@ -245,10 +245,10 @@ static void load_settings (char *section, int do_host) { gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed, sizeof(cfg.termspeed)); { - char buf[2*sizeof(cfg.environ)], *p, *q; + char buf[2*sizeof(cfg.environmt)], *p, *q; gpps (sesskey, "Environment", "", buf, sizeof(buf)); p = buf; - q = cfg.environ; + q = cfg.environmt; while (*p) { while (*p && *p != ',') { int c = *p++; @@ -712,7 +712,7 @@ static int CALLBACK TelnetProc (HWND hwnd, UINT msg, SetDlgItemText (hwnd, IDC3_TSEDIT, cfg.termspeed); SetDlgItemText (hwnd, IDC3_LOGEDIT, cfg.username); { - char *p = cfg.environ; + char *p = cfg.environmt; while (*p) { SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_ADDSTRING, 0, (LPARAM) p); @@ -746,7 +746,7 @@ static int CALLBACK TelnetProc (HWND hwnd, UINT msg, case IDC3_ENVADD: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { - char str[sizeof(cfg.environ)]; + char str[sizeof(cfg.environmt)]; char *p; GetDlgItemText (hwnd, IDC3_VAREDIT, str, sizeof(str)-1); if (!*str) { @@ -760,12 +760,12 @@ static int CALLBACK TelnetProc (HWND hwnd, UINT msg, MessageBeep(0); break; } - p = cfg.environ; + p = cfg.environmt; while (*p) { while (*p) p++; p++; } - if ((p-cfg.environ) + strlen(str) + 2 < sizeof(cfg.environ)) { + if ((p-cfg.environmt) + strlen(str) + 2 < sizeof(cfg.environmt)) { strcpy (p, str); p[strlen(str)+1] = '\0'; SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_ADDSTRING, @@ -790,7 +790,7 @@ static int CALLBACK TelnetProc (HWND hwnd, UINT msg, SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_DELETESTRING, i, 0); - p = cfg.environ; + p = cfg.environmt; while (i > 0) { if (!*p) goto disaster; diff --git a/window.c b/window.c index 151441f8..9210d159 100644 --- a/window.c +++ b/window.c @@ -698,33 +698,43 @@ static int WINAPI WndProc (HWND hwnd, UINT message, break; } break; + +#define X_POS(l) ((int)(short)LOWORD(l)) +#define Y_POS(l) ((int)(short)HIWORD(l)) + case WM_LBUTTONDOWN: - click (MB_SELECT, LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + SetCapture(hwnd); + click (MB_SELECT, X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); return 0; case WM_LBUTTONUP: - term_mouse (MB_SELECT, MA_RELEASE, LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + term_mouse (MB_SELECT, MA_RELEASE, X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); + ReleaseCapture(); return 0; case WM_MBUTTONDOWN: + SetCapture(hwnd); click (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND, - LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); return 0; case WM_MBUTTONUP: term_mouse (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND, - MA_RELEASE, LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + MA_RELEASE, X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); return 0; + ReleaseCapture(); case WM_RBUTTONDOWN: + SetCapture(hwnd); click (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE, - LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); return 0; case WM_RBUTTONUP: term_mouse (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE, - MA_RELEASE, LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + MA_RELEASE, X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); + ReleaseCapture(); return 0; case WM_MOUSEMOVE: /* @@ -742,8 +752,8 @@ static int WINAPI WndProc (HWND hwnd, UINT message, b = cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND; else b = cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE; - term_mouse (b, MA_DRAG, LOWORD(lParam) / font_width, - HIWORD(lParam) / font_height); + term_mouse (b, MA_DRAG, X_POS(lParam) / font_width, + Y_POS(lParam) / font_height); } lastbtn = MB_NOTHING; lastact = MA_NOTHING; @@ -1315,7 +1325,7 @@ void set_title (char *title) { sfree (window_name); window_name = smalloc(1+strlen(title)); strcpy (window_name, title); - if (!IsIconic(hwnd)) + if (cfg.win_name_always || !IsIconic(hwnd)) SetWindowText (hwnd, title); } @@ -1323,7 +1333,7 @@ void set_icon (char *title) { sfree (icon_name); icon_name = smalloc(1+strlen(title)); strcpy (icon_name, title); - if (IsIconic(hwnd)) + if (!cfg.win_name_always && IsIconic(hwnd)) SetWindowText (hwnd, title); } -- 2.11.0