Patch to use enum constants for cfg.funky_type instead of numeric
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Fri, 20 Aug 2004 14:04:13 +0000 (14:04 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Fri, 20 Aug 2004 14:04:13 +0000 (14:04 +0000)
literals, from "Anthony" <410C2A86.2010003@mail2004.ajrh.net>.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4491 cda61777-01e9-0310-a592-d414129be87e

unix/pterm.c
window.c

index 04c722c..fba3398 100644 (file)
@@ -714,7 +714,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                 * in xterm function key mode we change which two...
                 */
              case GDK_KP_Add:
-               if (inst->cfg.funky_type == 2) {
+               if (inst->cfg.funky_type == FUNKY_XTERM) {
                    if (event->state & GDK_SHIFT_MASK)
                        xkey = 'l';
                    else
@@ -844,7 +844,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                break;
            }
            /* Reorder edit keys to physical order */
-           if (inst->cfg.funky_type == 3 && code <= 6)
+           if (inst->cfg.funky_type == FUNKY_VT400 && code <= 6)
                code = "\0\2\1\4\5\3\6"[code];
 
            if (inst->term->vt52_mode && code > 0 && code <= 6) {
@@ -853,7 +853,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                goto done;
            }
 
-           if (inst->cfg.funky_type == 5 &&     /* SCO function keys */
+           if (inst->cfg.funky_type == FUNKY_SCO &&     /* SCO function keys */
                code >= 11 && code <= 34) {
                char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
                int index = 0;
@@ -877,7 +877,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                use_ucsoutput = FALSE;
                goto done;
            }
-           if (inst->cfg.funky_type == 5 &&     /* SCO small keypad */
+           if (inst->cfg.funky_type == FUNKY_SCO &&     /* SCO small keypad */
                code >= 1 && code <= 6) {
                char codes[] = "HL.FIG";
                if (code == 3) {
@@ -889,7 +889,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                use_ucsoutput = FALSE;
                goto done;
            }
-           if ((inst->term->vt52_mode || inst->cfg.funky_type == 4) &&
+           if ((inst->term->vt52_mode || inst->cfg.funky_type == FUNKY_VT100P) &&
                code >= 11 && code <= 24) {
                int offt = 0;
                if (code > 15)
@@ -905,12 +905,12 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
                use_ucsoutput = FALSE;
                goto done;
            }
-           if (inst->cfg.funky_type == 1 && code >= 11 && code <= 15) {
+           if (inst->cfg.funky_type == FUNKY_LINUX && code >= 11 && code <= 15) {
                end = 1 + sprintf(output+1, "\x1B[[%c", code + 'A' - 11);
                use_ucsoutput = FALSE;
                goto done;
            }
-           if (inst->cfg.funky_type == 2 && code >= 11 && code <= 14) {
+           if (inst->cfg.funky_type == FUNKY_XTERM && code >= 11 && code <= 14) {
                if (inst->term->vt52_mode)
                    end = 1 + sprintf(output+1, "\x1B%c", code + 'P' - 11);
                else
index 4cb6003..d4ebcf5 100644 (file)
--- a/window.c
+++ b/window.c
@@ -3383,8 +3383,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
 
 
        /* Nastyness with NUMLock - Shift-NUMLock is left alone though */
-       if ((cfg.funky_type == 3 ||
-            (cfg.funky_type <= 1 && term->app_keypad_keys &&
+       if ((cfg.funky_type == FUNKY_VT400 ||
+            (cfg.funky_type <= FUNKY_LINUX && term->app_keypad_keys &&
              !cfg.no_applic_k))
            && wParam == VK_NUMLOCK && !(keystate[VK_SHIFT] & 0x80)) {
 
@@ -3450,8 +3450,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
 
     /* Sanitize the number pad if not using a PC NumPad */
     if (left_alt || (term->app_keypad_keys && !cfg.no_applic_k
-                    && cfg.funky_type != 2)
-       || cfg.funky_type == 3 || cfg.nethack_keypad || compose_state) {
+                    && cfg.funky_type != FUNKY_XTERM)
+       || cfg.funky_type == FUNKY_VT400 || cfg.nethack_keypad || compose_state) {
        if ((HIWORD(lParam) & KF_EXTENDED) == 0) {
            int nParam = 0;
            switch (wParam) {
@@ -3580,8 +3580,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
        if (!left_alt) {
            int xkey = 0;
 
-           if (cfg.funky_type == 3 ||
-               (cfg.funky_type <= 1 &&
+           if (cfg.funky_type == FUNKY_VT400 ||
+               (cfg.funky_type <= FUNKY_LINUX &&
                 term->app_keypad_keys && !cfg.no_applic_k)) switch (wParam) {
                  case VK_EXECUTE:
                    xkey = 'P';
@@ -3633,7 +3633,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
                    xkey = 'n';
                    break;
                  case VK_ADD:
-                   if (cfg.funky_type == 2) {
+                   if (cfg.funky_type == FUNKY_XTERM) {
                        if (shift_state)
                            xkey = 'l';
                        else
@@ -3645,15 +3645,15 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
                    break;
 
                  case VK_DIVIDE:
-                   if (cfg.funky_type == 2)
+                   if (cfg.funky_type == FUNKY_XTERM)
                        xkey = 'o';
                    break;
                  case VK_MULTIPLY:
-                   if (cfg.funky_type == 2)
+                   if (cfg.funky_type == FUNKY_XTERM)
                        xkey = 'j';
                    break;
                  case VK_SUBTRACT:
-                   if (cfg.funky_type == 2)
+                   if (cfg.funky_type == FUNKY_XTERM)
                        xkey = 'm';
                    break;
 
@@ -3825,7 +3825,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            break;
        }
        /* Reorder edit keys to physical order */
-       if (cfg.funky_type == 3 && code <= 6)
+       if (cfg.funky_type == FUNKY_VT400 && code <= 6)
            code = "\0\2\1\4\5\3\6"[code];
 
        if (term->vt52_mode && code > 0 && code <= 6) {
@@ -3833,7 +3833,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            return p - output;
        }
 
-       if (cfg.funky_type == 5 &&     /* SCO function keys */
+       if (cfg.funky_type == FUNKY_SCO &&     /* SCO function keys */
            code >= 11 && code <= 34) {
            char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
            int index = 0;
@@ -3856,7 +3856,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            p += sprintf((char *) p, "\x1B[%c", codes[index]);
            return p - output;
        }
-       if (cfg.funky_type == 5 &&     /* SCO small keypad */
+       if (cfg.funky_type == FUNKY_SCO &&     /* SCO small keypad */
            code >= 1 && code <= 6) {
            char codes[] = "HL.FIG";
            if (code == 3) {
@@ -3866,7 +3866,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            }
            return p - output;
        }
-       if ((term->vt52_mode || cfg.funky_type == 4) && code >= 11 && code <= 24) {
+       if ((term->vt52_mode || cfg.funky_type == FUNKY_VT100P) && code >= 11 && code <= 24) {
            int offt = 0;
            if (code > 15)
                offt++;
@@ -3879,11 +3879,11 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
                    sprintf((char *) p, "\x1BO%c", code + 'P' - 11 - offt);
            return p - output;
        }
-       if (cfg.funky_type == 1 && code >= 11 && code <= 15) {
+       if (cfg.funky_type == FUNKY_LINUX && code >= 11 && code <= 15) {
            p += sprintf((char *) p, "\x1B[[%c", code + 'A' - 11);
            return p - output;
        }
-       if (cfg.funky_type == 2 && code >= 11 && code <= 14) {
+       if (cfg.funky_type == FUNKY_XTERM && code >= 11 && code <= 14) {
            if (term->vt52_mode)
                p += sprintf((char *) p, "\x1B%c", code + 'P' - 11);
            else