From RDB: a patch to allow special keys (^C, ^Z, Delete, Return) to
[u/mdw/putty] / windlg.c
index 5b2bac2..2f9ca56 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -291,6 +291,7 @@ enum { IDCX_ABOUT =
     IDC_CURAPPLIC,
     IDC_COMPOSEKEY,
     IDC_CTRLALTKEYS,
+    IDC_TELNETKEY,
     keyboardpanelend,
 
     terminalpanelstart,
@@ -408,6 +409,9 @@ enum { IDCX_ABOUT =
     IDC_EMSTATIC,
     IDC_EMBSD,
     IDC_EMRFC,
+    IDC_ACTSTATIC,
+    IDC_TPASSIVE,
+    IDC_TACTIVE,
     telnetpanelend,
 
     rloginpanelstart,
@@ -585,6 +589,7 @@ static void init_dlg_ctrls(HWND hwnd)
     CheckDlgButton(hwnd, IDC_ALTONLY, cfg.alt_only);
     CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key);
     CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys);
+    CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard);
     CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO,
                     cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND :
                     cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO);
@@ -658,6 +663,8 @@ static void init_dlg_ctrls(HWND hwnd)
     }
     CheckRadioButton(hwnd, IDC_EMBSD, IDC_EMRFC,
                     cfg.rfc_environ ? IDC_EMRFC : IDC_EMBSD);
+    CheckRadioButton(hwnd, IDC_TPASSIVE, IDC_TACTIVE,
+                    cfg.passive_telnet ? IDC_TPASSIVE : IDC_TACTIVE);
 
     SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);
     SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
@@ -1093,6 +1100,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
            staticedit(&cp, "Auto-login &username", IDC_LOGSTATIC,
                       IDC_LOGEDIT, 50);
            endbox(&cp);
+       } else {
+           beginbox(&cp, "Adjust telnet session.", IDC_BOX_CONNECTION1);
+           checkbox(&cp, "Keyboard sends telnet Backspace and Interrupt",
+                    IDC_TELNETKEY);
+           endbox(&cp);
        }
        beginbox(&cp, "Sending of null packets to keep session active",
                 IDC_BOX_CONNECTION2);
@@ -1102,7 +1114,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == telnetpanelstart) {
-       /* The Telnet panel. Accelerators used: [acgo] svldr bf */
+       /* The Telnet panel. Accelerators used: [acgo] svldr bftk */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -1120,6 +1132,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
            radioline(&cp, "Handling of OLD_ENVIRON ambiguity:",
                      IDC_EMSTATIC, 2, "&BSD (commonplace)", IDC_EMBSD,
                      "R&FC 1408 (unusual)", IDC_EMRFC, NULL);
+           radioline(&cp, "&Telnet negotiation mode:", IDC_ACTSTATIC, 2,
+                     "Passive", IDC_TPASSIVE, "Active",
+                     IDC_TACTIVE, NULL);
+           checkbox(&cp, "&Keyboard sends telnet Backspace and Interrupt",
+                    IDC_TELNETKEY);
            endbox(&cp);
        }
     }
@@ -1690,6 +1707,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.ctrlaltkeys =
                        IsDlgButtonChecked(hwnd, IDC_CTRLALTKEYS);
                break;
+             case IDC_TELNETKEY:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                       cfg.telnet_keyboard =
+                       IsDlgButtonChecked(hwnd, IDC_TELNETKEY);
+               break;
              case IDC_WRAPMODE:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED)
@@ -1987,6 +2010,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
              case IDC_EMRFC:
                cfg.rfc_environ = IsDlgButtonChecked(hwnd, IDC_EMRFC);
                break;
+             case IDC_TPASSIVE:
+             case IDC_TACTIVE:
+               cfg.passive_telnet =
+                   IsDlgButtonChecked(hwnd, IDC_TPASSIVE);
+               break;
              case IDC_ENVADD:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED) {