View Single Post
Old June 1, 2012, 19:34   #2
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,799
PowerWyrm is on a distinguished road
See http://angband.oook.cz/forum/showthread.php?t=5514.

By design, pressing shift-numlock-keypad key has the same effect as pressing the keypad key with no modifiers. The fix should then be applied so that the behavior is correct for NUMLOCK off.

Code:
        /* Use these keys to handle shift-dir when NUMLOCK is off */
        case 0x31: i = '1'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x32: i = '2'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x33: i = '3'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x34: i = '4'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x35: i = '5'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x36: i = '6'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x37: i = '7'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x38: i = '8'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;
        case 0x39: i = '9'; mods |= (KC_MOD_SHIFT | KC_MOD_KEYPAD); break;

        /* Virtual keypad keys (NUMLOCK off) */
        case KEY_A1: i = '7'; mods |= KC_MOD_KEYPAD; break;
        case KEY_A2: i = '8'; mods |= KC_MOD_KEYPAD; break;
        case KEY_A3: i = '9'; mods |= KC_MOD_KEYPAD; break;
        case KEY_B1: i = '4'; mods |= KC_MOD_KEYPAD; break;
        case KEY_B2: i = '5'; mods |= KC_MOD_KEYPAD; break;
        case KEY_B3: i = '6'; mods |= KC_MOD_KEYPAD; break;
        case KEY_C1: i = '1'; mods |= KC_MOD_KEYPAD; break;
        case KEY_C2: i = '2'; mods |= KC_MOD_KEYPAD; break;
        case KEY_C3: i = '3'; mods |= KC_MOD_KEYPAD; break;
This has the problem of forcing running when pressing a numpad key with numlock on, which could be problematic...
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

Last edited by PowerWyrm; June 4, 2012 at 10:01.
PowerWyrm is offline   Reply With Quote