home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / dev / ev_keymap.h < prev    next >
Text File  |  1993-10-19  |  3KB  |  100 lines

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  *    ev_keymap.h
  4.  *    Defines the structure used for parsing keymappings.  These structures
  5.  *    and definitions are used by event sources in the kernel and by
  6.  *    applications and utilities which manipulate keymaps.
  7.  *    
  8.  * HISTORY
  9.  * 02-Jun-1992    Mike Paquette at NeXT
  10.  *      Created. 
  11.  */
  12. #import <bsd/dev/ev_types.h>    /* Kernel keymap, keyboard info */
  13.  
  14. #define    NX_NUMKEYCODES    128    /* Highest key code is 0x7f */
  15. #define NX_NUMSEQUENCES    128    /* Maximum possible number of sequences */
  16. #define    NX_NUMMODIFIERS    16    /* Maximum number of modifier bits */
  17. #define    NX_BYTE_CODES    0    /* If first short 0, all are bytes (else shorts) */
  18.  
  19. #define    NX_WHICHMODMASK    0x0f     /* bits out of keyBits for bucky bits */
  20. #define    NX_MODMASK    0x10    /* Bit out of keyBits indicates modifier bit */
  21. #define    NX_CHARGENMASK    0x20    /* bit out of keyBits for char gen */
  22. #define    NX_SPECIALKEYMASK 0x40    /* bit out of keyBits for specialty key */
  23. #define    NX_KEYSTATEMASK    0x80    /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
  24.  
  25. /*
  26.  * Special keys currently known to and understood by the system.
  27.  * If new specialty keys are invented, extend this list as appropriate.
  28.  * The presence of these keys in a particular implementation is not
  29.  * guaranteed.
  30.  */
  31. #define NX_NOSPECIALKEY            0xFFFF
  32. #define NX_KEYTYPE_SOUND_UP        0    /* Processed by kernel */
  33. #define NX_KEYTYPE_SOUND_DOWN        1    /* Processed by kernel */
  34. #define NX_KEYTYPE_BRIGHTNESS_UP    2    /* Processed by kernel */
  35. #define NX_KEYTYPE_BRIGHTNESS_DOWN    3    /* Processed by kernel */
  36. #define NX_KEYTYPE_CAPS_LOCK        4    /* Processed by kernel */
  37. #define NX_KEYTYPE_HELP            5
  38. #define NX_POWER_KEY            6
  39. #define NX_UP_ARROW_KEY            7
  40. #define NX_DOWN_ARROW_KEY        8
  41. #define    NX_NUMSPECIALKEYS        9 /* Maximum number of special keys */
  42. #define NX_NUM_SCANNED_SPECIALKEYS    5 /* First 5 special keys are */
  43.                       /* actively scanned in kernel */
  44.  
  45. /* Modifier key indices into modDefs[] */
  46. #define NX_MODIFIERKEY_ALPHALOCK    0
  47. #define NX_MODIFIERKEY_SHIFT        1
  48. #define NX_MODIFIERKEY_CONTROL        2
  49. #define NX_MODIFIERKEY_ALTERNATE    3
  50. #define NX_MODIFIERKEY_COMMAND        4
  51. #define NX_MODIFIERKEY_NUMERICPAD    5
  52. #define NX_MODIFIERKEY_HELP        6
  53.  
  54. typedef struct _NXParsedKeyMapping_ {
  55.      /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
  56.     short    shorts;
  57.     
  58.     /*
  59.      *  For each keycode, low order bit says if the key
  60.      *  generates characters.
  61.      *  High order bit says if the key is assigned to a modifier bit.
  62.      *  The second to low order bit gives the current state of the key.
  63.      */
  64.     char    keyBits[NX_NUMKEYCODES];
  65.     
  66.     /* Bit number of highest numbered modifier bit */
  67.     int            maxMod;
  68.     
  69.     /* Pointers to where the list of keys for each modifiers bit begins,
  70.      * or NULL.
  71.      */
  72.     unsigned char *modDefs[NX_NUMMODIFIERS];
  73.     
  74.     /* Key code of highest key deinfed to generate characters */
  75.     int            numDefs;
  76.     
  77.     /* Pointer into the keyMapping where this key's definitions begin */
  78.     unsigned char *keyDefs[NX_NUMKEYCODES];
  79.     
  80.     /* number of sequence definitions */
  81.     int            numSeqs;
  82.     
  83.     /* pointers to sequences */
  84.     unsigned char *seqDefs[NX_NUMSEQUENCES];
  85.     
  86.     /* Special key definitions */
  87.     int            numSpecialKeys;
  88.     
  89.     /* Special key values, or 0xFFFF if none */
  90.     unsigned short specialKeys[NX_NUMSPECIALKEYS];
  91.     
  92.     /* Pointer to the original keymapping string */    
  93.     unsigned char *mapping;
  94.     
  95.     /* Length of the original string */
  96.     int    mappingLen;    
  97. } NXParsedKeyMapping;
  98.  
  99.  
  100.