home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_07 / 9n07097a < prev    next >
Text File  |  1991-05-27  |  1KB  |  53 lines

  1.  
  2.     XEvent      event;
  3.     int         length;
  4.     char        new_string[ 12 ];
  5.     KeySym      keysym;
  6.     XComposeStatus  composestatus;
  7.  
  8.     length = XLookupString( &event,
  9.                 new_string, 1,  /* 1 = max length */
  10.                 &keysym, &composestatus );
  11.  
  12.     new_string[1] = '\0';   /* some systems add garbage */
  13.  
  14.     /*
  15.      * This is a US ASCII test, 
  16.      * so you may need to change this.
  17.      */
  18.     if ( ( length > 0 ) && ( keysym > 31 ) && 
  19.         ( keysym < 127 ) )
  20.         {
  21.         /*
  22.          * We have alphanumeric keyboard input  
  23.          */
  24.         }
  25.     else
  26.         {
  27.         /*
  28.          * Test for some special keys.
  29.          * This is not an exhaustive list.
  30.          */
  31.         switch( keysym )
  32.                 {
  33.                 case XK_Return: /* Return key */
  34.                     break;
  35.                 case XK_Escape:
  36.                     break;
  37.                 case XK_BackSpace: 
  38.                     break;
  39.                 case XK_Delete:
  40.                     break;
  41.                 case XK_Right: /* right arrow */
  42.                     break;
  43.                 case XK_Prior: /* PageUp to DOS folks */
  44.                     break;
  45.                 case XK_Next:  /* PageDn to DOS folks */
  46.                     break;
  47.                 case XK_F1:    /* functionkey 1 */
  48.                     break;
  49.                 }
  50.  
  51.             }
  52.  
  53.