Format SSH2_MSG_DISCONNECT correctly (with reason code, reason
[sgt/putty] / window.c
index 680f065..68e2bf2 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1,4 +1,5 @@
 #include <windows.h>
+#include <imm.h>
 #include <commctrl.h>
 #ifndef AUTO_WINSOCK
 #ifdef WINSOCK_TWO
@@ -500,14 +501,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
        }
        AppendMenu (m, MF_ENABLED, IDM_SHOWLOG, "&Event Log");
        AppendMenu (m, MF_SEPARATOR, 0, 0);
-       AppendMenu (m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session");
+       AppendMenu (m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
        AppendMenu (m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session");
        s = CreateMenu();
        get_sesslist(TRUE);
        for (i = 1 ; i < ((nsessions < 256) ? nsessions : 256) ; i++)
          AppendMenu (s, MF_ENABLED, IDM_SAVED_MIN + (16 * i) , sessions[i]);
        AppendMenu (m, MF_POPUP | MF_ENABLED, (UINT) s, "Sa&ved Sessions");
-       AppendMenu (m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings");
+       AppendMenu (m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings...");
        AppendMenu (m, MF_SEPARATOR, 0, 0);
        AppendMenu (m, MF_ENABLED, IDM_CLRSB, "C&lear Scrollback");
        AppendMenu (m, MF_ENABLED, IDM_RESET, "Rese&t Terminal");
@@ -1902,7 +1903,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            compose_state = 0;
 
        /* Nastyness with NUMLock - Shift-NUMLock is left alone though */
-       if ( (cfg.funky_type == 3 || (cfg.funky_type <= 1 && app_keypad_keys))
+       if ( (cfg.funky_type == 3 ||
+              (cfg.funky_type <= 1 && app_keypad_keys && !cfg.no_applic_k))
              && wParam==VK_NUMLOCK && !(keystate[VK_SHIFT]&0x80)) {
 
            wParam = VK_EXECUTE;
@@ -1947,7 +1949,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
     if (compose_state>1 && left_alt) compose_state = 0;
 
     /* Sanitize the number pad if not using a PC NumPad */
-    if( left_alt || (app_keypad_keys && cfg.funky_type != 2)
+    if( left_alt || (app_keypad_keys && !cfg.no_applic_k
+                     && cfg.funky_type != 2)
        || cfg.funky_type == 3 || cfg.nethack_keypad || compose_state )
     {
        if ((HIWORD(lParam)&KF_EXTENDED) == 0)
@@ -2029,13 +2032,14 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
           int xkey = 0;
 
           if ( cfg.funky_type == 3 ||
-             ( cfg.funky_type <= 1 && app_keypad_keys)) switch(wParam) {
+             ( cfg.funky_type <= 1 &&
+               app_keypad_keys && !cfg.no_applic_k)) switch(wParam) {
               case VK_EXECUTE: xkey = 'P'; break;
               case VK_DIVIDE:  xkey = 'Q'; break;
               case VK_MULTIPLY:xkey = 'R'; break;
               case VK_SUBTRACT:xkey = 'S'; break;
           }
-          if(app_keypad_keys) switch(wParam) {
+          if(app_keypad_keys && !cfg.no_applic_k) switch(wParam) {
               case VK_NUMPAD0: xkey = 'p'; break;
               case VK_NUMPAD1: xkey = 'q'; break;
               case VK_NUMPAD2: xkey = 'r'; break;
@@ -2197,7 +2201,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            {
                if (vt52_mode)
                    p += sprintf((char *)p, "\x1B%c", xkey);
-               else if (app_cursor_keys)
+               else if (app_cursor_keys && !cfg.no_applic_c)
                    p += sprintf((char *)p, "\x1BO%c", xkey);
                else
                    p += sprintf((char *)p, "\x1B[%c", xkey);